1

こんにちは、x86アセンブラコードのコンパイルに問題があります。nasmを使用してコンパイルしていますが、コンパイラから構文が間違っていると言われます。簡単なラベルを使ってジャンプしているのでわかりませんか?誰かが私にそれを説明してもらえますか。

; reads character and prints ascii code in console

[BITS 16]

SEGMENT code
..start:
    mov ax, pile
    mov ss, ax
    mov ax, topofstack
    mov sp, ax

loop:               ; gives syntax error
    mov ah, 00h
    int 16h
    cmp ax, 1c0dh   ; user pressed enter, jump to end
    je end

    mov ah, 09h     ; write character and attribute at cursor position
    mov bh, 0h      ; flags...
    mov bl, 08h
    mov cx, 01h
    int 10h
    jmp loop        ; gives syntax error

end:
    mov ax, 04c00h
    int 21h

SEGMENT pile stack
resb 64
topofstack:
4

1 に答える 1

5

loop is an instruction, I would suggest changing the label to something like loop1.

Interestingly enough, this doesn't cause an error in my version of nasm (2.10.03) , at least with the command nasm -fobj xx.asm, but the fact that your two errors on on the lines containing loop make it a pretty safe bet that this is the problem.

You may have an earlier (or later) version, or you may be using different options. Certainly worth investigating, anyway.

于 2012-09-24T04:30:32.817 に答える