NASM x86 16-bit addressing modes

∥☆過路亽.° 提交于 2019-11-26 01:49:58

问题


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

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

mov byte[EAX], byte 0x0

What am I missing here?


回答1:


[AX] is an invalid memory operand specification.

The valid 16-bit ones are:

[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] is formally invalid, but many assemblers will quietly convert it into [BP+0].

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



来源:https://stackoverflow.com/questions/12474010/nasm-x86-16-bit-addressing-modes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!