I am trying to convert some equates from a header file and am scratching my head:

I know that,

0x00000000 = 0 is it decimal or 0h?

0x00000001 = 1 is it dec or 1h?

do I convert 0x00000010 to hex (Ah) or leave as 10 or add an h at the end?

since there are hex values for some items:

0x4000001A <- I would just strip off 0x and add an h at the end right?

how would I convert these values to MASM equates? Would i just strip off all the 0x's and leading zeros and add an h at the end of the values or what?

TIA

I know that,

0x00000000 = 0 is it decimal or 0h?

0x00000001 = 1 is it dec or 1h?

do I convert 0x00000010 to hex (Ah) or leave as 10 or add an h at the end?

since there are hex values for some items:

0x4000001A <- I would just strip off 0x and add an h at the end right?

how would I convert these values to MASM equates? Would i just strip off all the 0x's and leading zeros and add an h at the end of the values or what?

TIA

Hi Gunner,

As far as I know 0x0000000A is a hexadecimal representation of any number and that's too in C ( may be in someother high level language ) hence to convert it into decimal you can use " L " in C.

However, in masm if you write

Number dd 12345678 ; <-- this is a decimal number

and when you declare

Number1 dd 12345678h ;<-- this is a hexadecimal number

and to convert it into Decimal base you what to do.

I hope this will solve you problem.

regards

As far as I know 0x0000000A is a hexadecimal representation of any number and that's too in C ( may be in someother high level language ) hence to convert it into decimal you can use " L " in C.

However, in masm if you write

Number dd 12345678 ; <-- this is a decimal number

and when you declare

Number1 dd 12345678h ;<-- this is a hexadecimal number

and to convert it into Decimal base you what to do.

I hope this will solve you problem.

regards

there's no reason to write 0x00000000 or 00000000h...zero is zero anyway you look at it.

However it pays if you've got a consistent naming practice...

Since the .h files are allready in hex then it's easier and less error prone,to keep the hex representation.

so to convert

0x4000001A from c to masm syntax simply: drop the 0x and append an " H"

0x4000001A ->4000001AH.

however masm requires a number to start with a decimal digit so:

0xFFEE1122 ->FFEE1122H wrong!

0XFFEE1122->0FFEE1122H correct!

btw:0x00000010 is already in hex(C notation). it is 16 in decimal

However it pays if you've got a consistent naming practice...

Since the .h files are allready in hex then it's easier and less error prone,to keep the hex representation.

so to convert

0x4000001A from c to masm syntax simply: drop the 0x and append an " H"

0x4000001A ->4000001AH.

however masm requires a number to start with a decimal digit so:

0xFFEE1122 ->FFEE1122H wrong!

0XFFEE1122->0FFEE1122H correct!

btw:0x00000010 is already in hex(C notation). it is 16 in decimal

Ah, thank you MC, makes sense now. :)