pat*_*ues 1 x86 assembly interrupt
嗨,我在编译 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:
Run Code Online (Sandbox Code Playgroud)
loop是一条指令,我建议将标签更改为类似loop1.
有趣的是,这不会在我的nasm(2.10.03)版本中导致错误,至少在命令中是这样nasm -fobj xx.asm,但事实上你在包含的行上的两个错误loop使它很安全地打赌这是问题所在。
您可能有一个更早(或更高)的版本,或者您可能正在使用不同的选项。无论如何,当然值得研究。
| 归档时间: |
|
| 查看次数: |
5133 次 |
| 最近记录: |