The .RADIX directive lets you change the default RADIX (decimal) to base 2, 8, 10, or 16.
Syntax
.RADIX ExpressionRemarks
The Expression entry is in decimal radix regardless of the current radix setting.
The .RADIX directive does not affect real numbers initialized as variables with DD, DQ, or DT.
When using .RADIX 16, be aware that if the hex constant ends in either B or D, the assembler thinks that the B or D is a request to cancel the current radix specification with a base of binary or decimal, respectively. In such cases, add the H base override (just as if .RADIX 16 were not in use).
The statement:
.RADIX 16 DW 120B
produces an error because 2 is not a valid binary number. The correct specification is:
DW 120BH
The following example:
.RADIX 16 DW 89CD
also produces an error because C is not a valid decimal number. The correct specification is:
DW 89CDH
The dangerous case is when no error is produced. For example:
.RADIX 16 DW 120D
produces a constant whose value is 120 decimal, not '120D' hex, which might have been the intended value.
The following two move instructions are the same:
MOV BX,OFFH .RADIX 16 MOV BX,OFF
The following example:
.RADIX 8 DQ 19.0 ; Treated as decimal
produces a constant whose value is 19 decimal because 19.0 is a real number. However, if you leave off the decimal point, the following:
.RADIX 8 DQ 19 ; uses current radix
produces a syntax error because nine is not a valid number in .RADIX 8.