error A2008: syntax error :

不羁岁月 提交于 2021-01-28 01:32:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!