编译NASM简单程序

时间:2017-05-09 02:13:42

标签: linux assembly nasm

我正在尝试使用NASM编译此程序:

.model small
.STACK 100h
.data
    no dw 31429
    nstr db 6 dup(' ')
    idv dw 10
.code
.startup
    mov ax, dgroup
    mov ds, ax
    mov si,5
    mov nstr[si], '$'
    dec si
    mov ax, no
    mov dx,0

loop1:
    div idv
    add dl, '0'
    mov nstr[si],dl
    dec si
    mov dx,0
    cmp ax,0
    jne loop1

listn:
    mov ah, 09h
    mov dx, offset nstr
    int 21h 

stopprg:
    mov ah, 4ch
    int 21h
end

这是输出:

Afis.asm:6: error: attempt to define a local label before any non-local labels
Afis.asm:6: error: parser: instruction expected
Afis.asm:7: error: attempt to define a local label before any non-local labels
Afis.asm:7: error: parser: instruction expected
Afis.asm:8: warning: label alone on a line without a colon might be in error
Afis.asm:8: error: attempt to define a local label before any non-local labels
Afis.asm:10: error: comma expected after operand 1
Afis.asm:12: warning: label alone on a line without a colon might be in error
Afis.asm:13: warning: label alone on a line without a colon might be in error
Afis.asm:20: error: comma, colon, decorator or end of line expected after operand
Afis.asm:37: error: comma, colon, decorator or end of line expected after operand
Afis.asm:49: error: comma, colon, decorator or end of line expected after operand
Afis.asm:55: warning: label alone on a line without a colon might be in error

据我所知,该程序可以正常使用DosBOX,正如我的同事告诉我的那样,不幸的是我正在使用linux而我无法理解为什么我会收到这些错误。 有人可以指出我在哪里犯错误以及如何解决这个问题?

0 个答案:

没有答案