Binary Input

Program ASM_Bin2Dec demonstrates how to use the binary representation for an operand using Intel syntax. It converts the hard-coded binary value to denary.

program ASM_Bin2Dec;
  {$APPTYPE CONSOLE}
  {$ASMMODE INTEL}
uses
  SysUtils;
var
  Int : integer;
begin
  asm
    MOV Int, 1010100101b
  end;
  writeln('Denary: ', Int);
  readln;
end.

Program ASM_Bin2DecA demonstrates how to use the binary representation for an operand using AT&T syntax. It converts the hard-coded binary value to denary.

program ASM_Bin2DecA;
  {$mode objfpc}{$H+}
  {$ASMMODE ATT}
uses
  SysUtils;
var
  Int : integer;
begin
  asm
    MOV  $0b1010100101, Int
  end;
  writeln('Denary: ', Int);
  readln;
end.
Programming - a skill for life!

Getting started with in-line assembler