I wrote:
mov 60, %rax
GNU as
accepted it, although I should have written
mov $60, %rax
Is there any difference between two such calls?
I wrote:
mov 60, %rax
GNU as
accepted it, although I should have written
mov $60, %rax
Is there any difference between two such calls?
Yes; the first loads the value stored in memory at address 60 and stores the result in
rax
, the second stores the immediate value 60 intorax
.Just try it...
Ewww! Historically the dollar sign meant hex $60 = 0x60, but gas also has a history of screwing up assembly languages...and historically x86 assembly languages allowed 60h to indicate hex, but got an error when I did that.
So with and without the dollar sigh you get a different instruction.
0x8B is a register/memory to register, 0xC7 is an immediate to register. so as davmac answered mov 60,%rax is a mov memory location to register, and mov $60,%rax is mov immediate to register.