组装"mov si,ah"产生"invalid combination of opcode and operands"



所以我在按下键时尝试将字符打印到屏幕上.
我收到此错误:

src/kernel/main.asm:20:错误:操作码和操作数的组合无效

mov ah, 00h
int 16h
mov si, ah ;where the error is
mov si, ah

上面是混合一个 8 位操作数 (ah) 和一个 16 位操作数 (si)。你不能用 MOV 做到这一点。使用 MOV 指令时,操作数必须具有相同的大小。

正如Peter所建议的,如果你想混合这样的操作数大小,你需要使用像MOVSX或MOVZX这样的指令。

相关内容

最新更新