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 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.
来源:https://stackoverflow.com/questions/33136336/nasm-assembly-16bit-invalid-combination-of-opcode-and-operands