问题
I'm trying to write a bootloader for an OS I'm developing.
I'm getting a syntax error on the first line.
Here is my assembly code:
.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
Here's my compile line:
"*location*\14.10.25017\bin\HostX86\x86\ML.EXE" /c StartPoint.asm
The error I'm getting:
StartPoint.asm(1): error A2008: syntax error : .
As far as I know, this line shouldn't be a problem.
Thanks for the help :)
回答1:
As @Michael Petch suggested in the comments, using an older version of MASM (6.15 in my case), and it worked.
Note that if you are using C/CPP code in your project and intend on linking them with the assembly files (as I was doing), you will need to downgrade your C compiler as well. In my case, I changed it from CL (Microsoft C/C++ Optimizing Compiler Version 19.10.25017) to dmc.
来源:https://stackoverflow.com/questions/46611550/error-a2008-syntax-error