【问题标题】:NASM Assembly 16bit "invalid combination of opcode and operands"NASM 汇编 16 位“操作码和操作数的无效组合”
【发布时间】:2015-10-14 21:59:40
【问题描述】:

所以我正在尝试编写一个程序来创建一个文件和我的名字。 但我得到“操作码和操作数的无效组合” mov handle, ax,我不知道为什么。 我看到here 你可以做到,我为什么不能。 提前感谢您的帮助。

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

【问题讨论】:

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

标签: assembly nasm 16-bit


【解决方案1】:

NASM Requires Square Brackets For Memory References。正确的语法是mov [handle], ax。 foo 使用地址,[foo] 是内容。你可能在其他地方也搞混了。

【讨论】:

    猜你喜欢
    • 2015-07-31
    • 2022-01-11
    • 2013-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多