NASM组件16位“操作码和操作数的无效组合" [英] NASM Assembly 16bit "invalid combination of opcode and operands"
本文介绍了NASM组件16位“操作码和操作数的无效组合"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我试图编写一个程序来创建文件和我的名字.
但是我得到了操作码和操作数的无效组合"
mov handle, ax
,我不知道为什么.
我看到了此处,您可以做到那我为什么不能
预先感谢您的帮助.
So I'm trying to write a program that creates a file and my name in it.
But I get the "invalid combination of opcode and operands" on
the mov handle, ax
, and I don't know why.
I saw here that you can do it so why can't I.
Thank you in advance for any help.
org 100h
mov ah, 3ch ;create a file
mov dx, name ;file name
mov cx, 0
int 21h
mov handle, ax ; save handle
mov ah, 40h ;write to file
mov bx, handle
mov cx, 1000
mov dx, text ; what to write
int 21h
mov ah, 3eh ;close the file
mov bx, handle
int 21h
mov ax, 4C00h ; end
int 21h
section .data
name db "name.txt", 0
text db "Michal",0ah,0dh,"$"
section .bss
handle resb 2
推荐答案
NASM需要方括号才能引用内存.正确的语法是mov [handle], ax
. foo
使用的是地址,而[foo]
是的内容.您可能还会在其他地方将其混淆.
NASM Requires Square Brackets For Memory References. The correct syntax is mov [handle], ax
. foo
is using the address and [foo]
is the content. You might have that mixed up elsewhere too.
这篇关于NASM组件16位“操作码和操作数的无效组合"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文