Hello All, My brain is on leave and I can't translate the following. (I know I know how to do it...) *pSomething = 1; Help! Thanks. Xtreme
In a miraculous turn of events I started thinking again. mov , 1 Yippee!!! Xtreme
Close, but not quite there. Try the following.
This message was edited by tank, on 2/6/2001 2:54:25 AM
mov eax, mov dword ptr , 1
i think in c, the * means pointer, that is, and you found it, it means :
roy http://www.effervescence.com these thingies are *soooo* cool
mov dword ptr ,1
Except if thingie is a memory address, the x86 doesn't support such an instruction. The assembler will reject it and won't generate the two instructions I wrote.
Actually, this is a complete mind-bleep. I use indirection all the time in asm (COM is all indurection), and I still screw it up all the time. Example 1:
Indirection is most useful when passing params to a proc BY REFERENCE (address of). Passing a reference means the procedure may change the variable itself
.data Var DWORD ? pVar DWORD OFFSET Var .code start: mov Var, NULL ; these both generate IDENTICAL code mov , NULL ; (masm assumes the brackets)
This can be lots more fun (and actually useful too) if you pass the address of a structure, then get each element from that one pointer:
invoke SomeProc, ADDR Var invoke SomeProc, pVar ; equivalent statements SomeProc PROC pResult:DWORD mov ecx, pResult ; get the address mov eax, NULL ; set-up the return value mov , eax ; move the return value to the address passed in mov , NULL ; ILLEGAL Instruction, no immediate to mem mode ret SomeProc ENDP
This message was edited by Ernie, on 2/25/2001 2:11:09 PM
OtherProc PROC pRect:DWORD mov ecx, pRect mov eax, .RECT.right sub eax, .RECT.left ret ; width of the rect is in eax OtherProc ENDP