[MASM syntax question]How to assemble hard coded address value in mov?

Started by Valerón, June 11, 2010, 07:36:54 AM

Previous topic - Next topic

Valerón

Hi, folks.
I'm not newbie to assembly. I've been working in assembly for years.
This is a question about the syntax of MASM. Recently I work with MSVC, so it is the assembler in hand.

I need to assembler this instruction
mov eax, [0x89abcdef]
I don't want the hard coded 0x89abcdef act as  an immediate value but a pointer.
I don't know how to do it in MASM. MASM seems to lack of convenient syntax to hard code pointer value(I don't know how to assemble far jmp and far call as well), at least I don't know yet.
I know I can employee db(or _emit in C++) to hard code the whole instruction, but that make the code less readable.

Thank you.

jj2007

include \masm32\include\masm32rt.inc

.data
MyVal dd 12345678h

.code
start:
mov eax, ds:[0402000h]
exit

end start


Now it's your turn to explain why you want to hardcode an address...

Valerón

Thank you.
Frankly I'm going to patch something. To help analyze a protocol.

Wait... the problem hasn't been solved yet.

mov eax, ds:[0x12345678] is assembled to a "far" move with the segment register in mind.

Is there any method to assemble without segment register?

BogdanOntanu

Warning: No "patching" and reversing / analyzing of "protocols" is allowed in here  :green
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro