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
mov al,BYTE PTR n[0]
mov BYTE PTR [esi],al
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.
And, as you experienced yourself, you CAN also move immediate values directly to memory without using registers.
Raymond