Assembly NASM程序集16位“操作码和操作数的组合无效”

Assembly NASM程序集16位“操作码和操作数的组合无效”,assembly,nasm,16-bit,Assembly,Nasm,16 Bit,所以我正试图编写一个程序,在其中创建一个文件和我的名字。 但我得到的是操作码和操作数的无效组合 mov手柄,斧头,我不知道为什么。 我看到你能做到,为什么我不能。 提前感谢您的帮助 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

所以我正试图编写一个程序,在其中创建一个文件和我的名字。 但我得到的是操作码和操作数的无效组合 mov手柄,斧头,我不知道为什么。 我看到你能做到,为什么我不能。 提前感谢您的帮助

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

。正确的语法是mov[handle],ax。foo使用的是地址,[foo]是内容。您可能在其他地方也有这种情况。

如果您将句柄的定义放在顶部,如您链接到的示例中所示,会发生什么情况?