when i use things like
db A1h,00h
it saz when compliling error A1h not defined,
any one know why it wont recognize it???

EDIT:
also i am gettting problems with this
mov DWORD PTR [007D384Ch], edx
: error A2001: immediate operand not allowed
the code is right!! but why wont it take it???
Posted on 2002-06-15 16:27:52 by Qages
You have to always start hex number with a 0.
Posted on 2002-06-15 17:00:58 by Kudos
Add a prefix 0 if the hex value starts with a letter.

0Ah = 10
16h = 22
0Dh = 13
0DEADh = 57005
0BEEFh = 48879

As for mov DWORD PTR [007D384Ch] ...

Sounds like putting a value directly from a known memory location ... as far as I know MASM doesn't allow this.

:)
Posted on 2002-06-15 21:08:21 by stryker
if you want hex numbers without prefix 0, use "radix 16" - be careful though :).
For immediate memory addreses, stupid and non-standard masm wasnt's
a DS override (even though it wont be in your opcode). Ie, use
"Mov dword ptr , 401000h"
Posted on 2002-06-15 21:11:50 by f0dder
hmmmm,

How interesting, below every assembler are opcodes, I wonder what opcode you had in mind with this statement ?

Qages original question was why he got an error with the following code.


mov DWORD PTR [007D384Ch], edx

You can certainly do it this way.


mov ecx, 12345678h
mov eax, 00401000h
mov [eax],ecx

I wonder what opcodes you had in mind ?

Regards,

hutch@movsd.com
Posted on 2002-06-15 22:57:09 by hutch--
hmmm... i certainly remember having to move stuff to known locations when working with .com files with DEBUG (never practiced safe HEX, though)
Posted on 2002-06-15 23:03:48 by jademtech
If you use FASM (IMHO the best+ assembler out there) you can also use $ as HEX prefix, and other than being more immediately readable/identifyable as HEX, you will also not have to put a leading '0' if the first digit is a letter.

Take a look at FASM, you won't regret it, for many other reasons.

http://fasm.metro-nt.pl
Posted on 2002-06-16 02:59:57 by Maverick
"mov DWORD PTR [007D384Ch], edx" gives "error A2001: immediate operand not allowed".
Why use the long form and lots of register stuff when you can do it directly?
If you add the DS: prefix (which doesn't actually end up in the output binary),
it works. Ie, "mov DWORD PTR [DS:007D384Ch], edx" generates the opcode
89154C387D00. Stupid that masm requires the prefix.
Posted on 2002-06-16 05:06:48 by f0dder
OK,

Opcode 89h.

Your form was,


mov DWORD PTR [DS:007D384Ch], edx

Remove the TASM/NASM imitations from it and note that the register size of EDX sets the memory operand size and you end up with the efficient MASM form of the notation,


mov DS:007D384Ch, edx

You can also specify the code section if you need to with,


mov CS:007D384Ch, edx


Its very gracious of you f0dder to demonstrate the sheer elegance and power of the worlds leading assembler, MASM, the one that sets the standard. :)

Regards,

hutch@movsd.com
Posted on 2002-06-16 08:35:11 by hutch--
Thing is, the DS: prefix shouldn't be necessary as it's implicit...
but oh well.
Posted on 2002-06-16 08:38:44 by f0dder