Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NASM "register size specification ignored"

Tags:

nasm

I tried to assemble a file with NASM, but it pointed to this line in the file:

mov al, byte ptr es:[bx]

saying:

error: comma, colon or end of line expected

I found a page on this site saying that NASM doesn't like the word "ptr" and it would be happy if I wrote:

mov al, byte es:[bx]

instead. So I took out the word "ptr" and NASM is still not happy. Here is what NASM gives me when I leave out the word "ptr":

warning: register size specification ignored

and:

error: invalid combination of opcode and operands

It's a catch 22! NASM is angry whether or not I put in the word "ptr". Can anybody help me with this?

like image 680
Isaac D. Cohen Avatar asked Jan 26 '14 02:01

Isaac D. Cohen


1 Answers

I got it! NASM is happy if I write:

mov al,byte [es:bx]

like Guy Sirton said. If I leave out the word "byte" from the instruction, here is what would happen. If the instruction is one like this:

mov al, [es:bx]

where NASM can see that I want to move one byte, since I'm storing it in al, it won't complain. But, if the instruction is one like this:

mov [es:bx],0xff

where NASM can't see how much memory I want to store 0xff in, it will give you such an error:

error: operation size not specified

It's important to know, especially if you are using this tutorial, that NASM won't except the regular way.

like image 97
Isaac D. Cohen Avatar answered Oct 31 '22 13:10

Isaac D. Cohen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!