News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

please help me....

Started by Vineel Kumar Reddy Kovvuri, May 15, 2007, 05:25:03 PM

Previous topic - Next topic

Vineel Kumar Reddy Kovvuri




hi everybody

i am new to assembly and trying to understand the various possible combinations of mov instructions

please look at the following code

include c:\masm32\include\masm32rt.inc

.data
n db 10,20,30
x db ?
.code
start:
cls
lea  esi ,x
mov byte ptr [esi] ,10             ; This is working fine
mov byte ptr [esi] ,n[0]          ;This is not compiling

print str$(x)

exit
end start



plz clarify the differnce b/w the above two mov instructions whats wrong with the second one .


thanks in advance




Vortex

mov     al,BYTE PTR n[0]
mov     BYTE PTR [esi],al

sebart7

In short, You may NOT use direct memory to memory transfers like mov memory, memory
You should move it to register first and then from register back to memory like Vortex's example above show.


raymond

And, as you experienced yourself, you CAN also move immediate values directly to memory without using registers.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com