我正在尝试为我正在开发的操作系统编写引导加载程序。
我在第一行遇到语法错误。
这是我的汇编代码:
.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 : .
据我所知,这条线应该不会有问题。
感谢您的帮助:)
最佳答案
正如 @Michael Petch 在评论中建议的那样,使用旧版本的 MASM(在我的例子中为 6.15),并且它有效。
请注意,如果您在项目中使用 C/CPP 代码并打算将它们与汇编文件链接(就像我所做的那样),您还需要降级您的 C 编译器。就我而言,我将其从 CL(Microsoft C/C++ 优化编译器版本 19.10.25017)更改为 dmc .
关于assembly - 错误 A2008 : syntax error :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46611550/