[英]nasm error: label or instruction expected at the start of line
您好,我是匯編語言的新手(今天才剛剛開始),在執行本教程中所說的內容時遇到了這個問題。 我用以下文本制作了一個asm文件:
org 0x100
start:
mov bx, [a]
mov ax, [val]
mov cx, 8
sub sp, 8
call search
ret
search:
mov di, sp
go:
cmp [bx], ax
jz detected
continue:
add bx, 2
dec cx
jnz go
ret
detected:
add di, 2
shl word[bx], 2
mov dx, [bx]
mov [di], dx
jmp continue
a dw 1, 2, 1, 4, 1, 6, 7 , 8
val dw 1
我得到這個錯誤
laber.asm:1: error: label or instruction expected at the start of line
我想知道這是一個不好的教程還是我輸入的錯誤。 我也想知道“標簽或說明”的含義。
您忘記了顯示用於匯編的命令,所用的操作系統以及所需的輸出格式。 由於org 0x100
我假設您需要DOS .com
文件。 現在,您的nasm
可能未默認使用該格式,因此您應該嘗試使用nasm -f bin -o laber.com laber.asm
。
錯誤label or instruction expected
並不是一個非常好的信息,基本上意味着nasm無法識別org
並告訴您使用標簽(后跟冒號)或指令(我希望您知道這些是什么; ))。 當然,您也可以使用其他方法,例如有效的指令,但是nasm不會告訴您。
您需要插入
section .text
在文件的頂部。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.