本文介绍了NASM“忽略寄存器大小规格".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用NASM汇编文件,但是它指向文件中的这一行:

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

mov al, byte ptr es:[bx]

说:

error: comma, colon or end of line expected

我在此站点上找到了页面,说NASM没有不喜欢"ptr"这个词,如果我写的话会很高兴的:

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]

相反.所以我拿出"ptr"一词,NASM仍然不高兴.这是我遗漏"ptr"一词时NASM给我的:

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

和:

error: invalid combination of opcode and operands

这是一个陷阱22!不管我是否输入"ptr"一词,NASM都很生气.有人可以帮我吗?

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

推荐答案

我明白了!如果我写的话,NASM很高兴:

I got it!NASM is happy if I write:

mov al,byte [es:bx]

就像盖伊·西顿(Guy Sirton)说的那样.如果我在指令中遗漏了字节"一词,将会发生这种情况.如果指令是这样的:

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]

NASM可以看到我要移动一个字节,因为我将其存储在al中,所以不会抱怨.但是,如果指令是这样的:

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

NASM无法看到我要在其中存储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

重要的是要知道,尤其是如果您使用的是教程,NASM不会使用常规方法.

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

这篇关于NASM“忽略寄存器大小规格".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 03:17