hi, i coded a program some time ago and i used assume, but i forgot what i needed that for? is assume edi:ptr IMAGE_DOS_HEADER the same as lea edi,IMAGE_DOS_HEADER (i'm not sure if this lea stuff is possible here) bye
Posted on 2001-03-30 08:45:00 by [SaFc0n]
Assume makes ML use the assumed register like what ever it is instructed assume (a nice and clear description :P )

assume eax:PTR MyStruct
mov eax.Element1, ecx
mov eax.Element2, edx
assume eax:NOTHING
However, you must assume NOTHING after you've finished or else MASM may do the unexpected (it'll keep treating it like a pointer to MyStruct). Much safer to use

mov (MyStruct PTR ).Element1, ecx
mov (MyStruct PTR ).Element2, edx
The compiled code is the same, and you only treat eax like a pointer when YOU want to! Plus its easier to read, you don't have to scan through your code for what you last assumed eax to be... Plus it kind of makes more sense when you come back to it later :P Mirno
Posted on 2001-03-30 08:55:00 by Mirno
ASSUME is the opposite of LEA. ASSUME tells the assembler what kind of addresses a register is supposed to have. The assembler uses this information to encode an addressing mode in an instruction. LEA is actual code that constructs the actual address when it executes.
Posted on 2001-03-30 14:23:00 by tank