mingw在汇编代码时报告错误

时间:2015-08-20 14:22:53

标签: assembly mingw intel directive

我尝试汇编这段代码:

.MODEL small
.STACK
.DATA
    op1 dw 10
    op2 dw 5
    result dw ?
.CODE
.STARTUP
    mov ax, op1
    add ax, op2
    mov result, ax
    mov al, result
    mov ah, 2
    int 21h
.EXIT
END

使用这个mingw命令:       as example.asm

它报告了我这些错误:

a.asm: Assembler messages:
a.asm: Warning: end of file not at end of a line; newline inserted
a.asm:1: Error: no such instruction: `section .MODEL small'
a.asm:2: Error: no such instruction: `section .STACK'
a.asm:3: Error: no such instruction: `section .DATA'
a.asm:4: Error: no such instruction: `op1 dw 10'
a.asm:5: Error: no such instruction: `op2 dw 5'
a.asm:6: Error: no such instruction: `result dw?'
a.asm:7: Error: no such instruction: `section .CODE'
a.asm:8: Error: no such instruction: `section .STARTUP'
a.asm:9: Error: too many memory references for `mov'
a.asm:10: Error: too many memory references for `add'
a.asm:11: Error: too many memory references for `mov'
a.asm:12: Error: too many memory references for `mov'
a.asm:13: Error: too many memory references for `mov'
a.asm:14: Error: junk `h' after expression
a.asm:14: Error: operand size mismatch for `int'
a.asm:15: Error: no such instruction: `section .EXIT'
a.asm:16: Error: no such instruction: `section END'

我学会了以这种方式编程,我不明白为什么它不起作用......解决方案是什么?

0 个答案:

没有答案