ok I have a value in ax and a value in dx
I want ax to be the first 2 bytes of EBX
and i want dx to be the last 2 bytes of EBX
how do i do this?
Are you asking for moving ax in lowword of ebx and dx in highword of ebx ?
If so:
mov bx,dx
shl ebx,16
mov bx,ax
-> ebx == dx:ax
regards qWord
ok thank you, that makes sense, we just havent studied the shl code yet.
i had though my professor had mentioned something about accessing it with bracket syntax like
mov ax, intOperand1
imul intOperand2
mov WORD PTR [ebx], ax
mov WORD PTR [ebx+2], dx
Also when dealing with memory addresses, keep in mind that byte order written to (and read from) memory is reversed -- so if EAX was 0x00000012h, when written to memory it would be stored as 0x12000000h (and when read back into eax, would be 0x00000012h again.) So in this example, if you then wrote EBX to a memory offset, don't be surprised to see it stored reversed. When that value is read back into EDX from memory though, it would once again be in the correct order.
What may be really helpful is writing some simple code such as this, then stepping through its execution in a debugger such as OllyDbg (http://ollydbg.de/). Then the effects of each instruction can be seen easily.
Quotei had though my professor had mentioned something about accessing it with bracket syntax like
mov ax, intOperand1
imul intOperand2
mov WORD PTR [ebx], ax
mov WORD PTR [ebx+2], dx
the result is written to an 32bit memory-location pointed by ebx
PS: why starting two discussions with the same topic ?
oh ok, i see what i was doing
i should have moved the offset of some piece of memory into EBX and then accessed from there
a little confusing but this is what i came up with
mov ax, intOperand1
imul intOperand2
mov EBX, offset doubleResult
mov WORD PTR [ebx], ax
mov WORD PTR [ebx+2], dx