how can I use hex and decimal number together in my sourcecode ?


Thank you,
Posted on 2002-05-19 07:03:14 by Nordwind64

mov eax, 10


mov eax, 10d

is for decimal.

mov eax, 10h

for hex.

But you can also set a compiler option to make all numbers hex/decimal/binary.
Posted on 2002-05-19 08:24:18 by bazik
Hi bAZik,

mov eax,10h

won't work.
How can I to set the compiler option...?

Greetings, Nordwind
Posted on 2002-05-19 13:15:48 by Nordwind64
mov eax, 10h

should work, however

mov eax, d1h

would cause a problem (Masm would think this was a label instead of a number) so you have to do:

mov eax, 0d1h

Are you sure mov eax, 10h isn't working?

And am I very much mistaken or did Hiro edit your sig?
Posted on 2002-05-19 13:35:16 by Qweerdy

0h - 3fffh ist working ok, a000h - ffffffffh not...
How can I use hex number from a000h to ffffffffh in MASM32 ???

Posted on 2002-05-20 13:39:06 by Nordwind64
lead number with a zero:


Or, use twos-complement of number:


If you don't want to use the letters on the end of numbers, search the MASM manual for RADIX. All numbers need to begin with a number [0,9]. Otherwise MASM doesn't know if it is a label or number.
Posted on 2002-05-20 13:42:09 by bitRAKE
You can also set the "RADIX" option in masm,

But this doesnt solve your problem, rather its like using ASSUME on registers, you tell the compiler to "assume" all following numbers are base 10, or 16 etc.

.radix 16

bob dd 12345678 ; Considered HEX

.radix 10

bob2 dd 12345678 ; considered decmal

Posted on 2002-05-20 13:54:15 by NaN

0a000h works fine...

Thank you !!!
Greetings, Nordwind64
Posted on 2002-05-22 14:39:42 by Nordwind64