Integer Constants


An integer constant is made up of an optional leading sign, one or more digits and an optional suffix character, a radix, indicating the base:
       [ { + | - } ]  digits  [ radix ]
If no radix is given, the integer constant is assumed to be decimal.

Radix Description
h hexadecimal
q/o octal
d decimal
b binary
r encoded real
t decimal (alternate)
y binary (alternate)
A hexadecimal constant beginning with a letter must have a leading zero to prevent the assembler from interpreting it as an identifier.
Constant Representation
130 decimal
78d decimal
10010101b binary
520q octal
34o octal
15A0h hexadecimal
0F1Ah hexadecimal

Binary and Octal Decimal and Hexadecimal Decimal and Hexadecimal
 INCLUDE Irvine32.inc
 .data
  dummy WORD ?
 .code
 main PROC
  mov   eax, 1010b - 10q
  call  WriteInt
  exit
 main ENDP
 END main
 INCLUDE Irvine32.inc
 .data
  dummy WORD ?
 .code
 main PROC
  mov   eax, 10 * 10h
  call  WriteInt
  exit
 main ENDP
 END main
 INCLUDE Irvine32.inc
 .data
  dummy WORD ?
 .code
 main PROC
  mov   eax, 10d + Ah
  call  WriteInt
  exit
 main ENDP
 END main
Output Output Output

 

 

 

 

 

 

The procedure writes a 32-bit signed integer to standard output in decimal format with a leading sign and no leading zeros. Before calling it, place the integer in .