.RADIX Sets the default Radix for integer constants
.RADIX selects the bas in which numbers without suffixes are assumed to be specified. For example,
selects base 16, or hexadecimal, as the default notation. The following code illustrates the effect of the .RADIX directive:
. . . .RADIX 16 ;select base 16, hexadecimal, as the default mov ax,100 ;=100h, or 256 decimal .RADIX 10 ;select base 10, decimal, as the default sub ax,100 ;-100d decimal, result is 256 - 100 = 156 decimal .RADIX 2 ;select base 2, binary, as the default add as,100 ;+100b, or 4 decimal, result is 156 + 6 = 160 decimal . . .
.RADIX can select base 2, 8, 10, or 16 as the default. Incidentally, the operand to .RADIX is always decimal, no matter what default noation is selected; in other words, one .RADIX directive doesn't affect the notaion of the next .RADIX directive's operand.
There is a potential problem to consider when you use the
.RADIX directive. No matter what default notation is selected, values specified
with DD, DQ, and
DT are assumed to be decimal values unless a suffix is used. This means that in
. . . .RADIX 16 DD 1E7 . . .
1E7 is taken to be 1 times 10 to the seventh power, not 1E7h. In fact, you're best advised to place the h suffix on all hexadecimal values even after a .RADIX 16 directive. Why? Remember that b and d are valid suffixes, specifying binary and decimal notation, respectively. Unfortunately, b and d are also valid hexadecimal digits. If .RADIX 16 is in effect, what is Turbo Assembler to make of numbers like 129D and 101B?
As it happens, Turbo Assembler always pays attention to valid suffixes, so 129D is 129 decimal and 101B is 101 binary, or 5 decimal. What this means is that even when .RADIX 16 is in effect, any hexadecimal number ending in D or B must have an h suffix. Given that, it's simplest just to put h suffixes on all hexadecimal numbers, and given that, if becomes clear that, in general, it's not particularly useful to use .RADIX 16.
|file: /Techref/language/tasm/radix.htm, 2KB, , updated: 1999/4/21 08:22, local time: 2023/12/3 23:15,
|©2023 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.massmind.org/techref/language/tasm/radix.htm"> *** Your Title Here ***</A>
|Did you find what you needed?|
Welcome to massmind.org!
Welcome to www.massmind.org!