NASM x86 16位寻址模式 [英] NASM x86 16-bit addressing modes

查看:216
本文介绍了NASM x86 16位寻址模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在指向地址时遇到麻烦,在我的情况下写了一个字节大小的变量.这给了我错误错误:无效的有效地址":

I am having trouble with pointing to a address and write in my case a variable of byte in size. This gives me the error "error: invalid effective address":

mov byte[AX], byte 0x0

经过一些试验和错误,我用EAX进行了相同的测试.这样编译就可以了:

After some trail and error i tested the same but with EAX. This compiles just fine:

mov byte[EAX], byte 0x0

我在这里想念什么?

推荐答案

[AX]是无效的内存操作数规范.

[AX] is an invalid memory operand specification.

有效的16位数字是:

[constant]  
[BX]  
[SI]  
[DI]  
[BX+constant]  
[BP+constant]  
[SI+constant]  
[DI+constant]  
[BX+SI]  
[BX+DI]  
[BP+SI]  
[BP+DI]  
[BX+SI+constant]  
[BX+DI+constant]  
[BP+SI+constant]  
[BP+DI+constant]  

[BP]在形式上无效,但是许多汇编程序会悄悄将其转换为[BP + 0].

[BP] is formally invalid, but many assemblers will quietly convert it into [BP+0].

有关内存操作数编码以及ModR/M和SIB字节,请参见CPU手册.

See the CPU manual for memory operand encodings and the ModR/M and SIB bytes.

这篇关于NASM x86 16位寻址模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆