I just started to learn assembly language. I used the online compiler, but today I downloaded NASM. I tried to assemble this simple code that multiplies 10 by 15:
mov eax, 0xa
mov edx, 0xf
imul eax, edx
ret
An attempt to execute the machine code generated by NASM has failed so I opened this code in hex editor and compared it with code generated by online assembler that I can successfully execute.
NASM:
66 b8 0a 00 00 00 66 ba 0f 00 00 00 66 0f af c2 c3
online editor:
b8 0a 00 00 00 ba 0f 00 00 00 0f af c2 c3
The only differences between these two codes are the unwanted 66
's in the code generated by NASM. Can anyone help me?
It is as Jester suggested. I do not included BITS 64 declaration. Now when I included BITS 64 everything works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With