我試圖寫一個操作系統,我開發一個引導程序。錯誤A2008:語法錯誤:
我在第一行得到一個語法錯誤。
這裏是我的彙編代碼:
.286 ; CPU Type
.model TINY ; memory of model
;---------------------- EXTERNS -----------------------------
extrn _BootMain:near ; prototype of C func
;------------------------------------------------------------
;------------------------------------------------------------
.code
org 07c00h ; for BootSector
_main:
jmp short _start ; go to main
nop
;----------------------- CODE SEGMENT -----------------------
_start:
cli
mov ax,cs ; Setup segment registers
mov ds,ax ; Make DS correct
mov es,ax ; Make ES correct
mov ss,ax ; Make SS correct
mov bp,7c00h
mov sp,7c00h ; Setup a stack
sti
; start the program
call _BootMain
ret
END _start
END _main ; End of program
這裏是我的編譯行:
"*location*\14.10.25017\bin\HostX86\x86\ML.EXE" /c StartPoint.asm
我得到的錯誤:
StartPoint.asm(1): error A2008: syntax error : .
據我所知,這行不應該是一個問題。
感謝您的幫助:)
'.286'不是根據[MSDN](https://msdn.microsoft.com/en-us/library/8t163bt0.aspx)有效的指令。只要刪除它。 – Jester
您可能希望考慮使用老版本的MASM或TASM組合16位代碼和16位鏈接器。我也希望你不會試圖調用32位代碼。 –
或者使用NASM,它仍然組合16位代碼就好了,AFAIK。 (但是,使用Intel的語法的不同變型中,看到https://stackoverflow.com/tags/intel-syntax/info –