Can someone please explain what the difference between the following two are? I'm finding it a little difficult to understand the concepts behind addressing modes
mov ax, [bx + di + 10]
mov ax, [bx + di] + 10
Thanks so much!
You labelled this MASM32 but neither instruction is legitimate for x86. Unless you are doing 16 bit programming, in which case you should make that clear.
mov ax, [bx+di+10]
Is not legal in x86 because it uses 16 bit addressing. The following is allowed, however:
mov ax, [ebx+edi+10]
Which means take the value of ebx, add it to the value of edi, and add 10 to that value. Then treat the final value as a pointer. Take the word
(2 bytes) pointed to by that address and assign the value to ax.
mov ax, [bx+di]+10
Is not legal similarly (16 bit addressing). If you were to do:
mov ax, [ebx+edi]+10
That is also not allowed since mov
does not allow an extra input after [ebx+edi]