错误A2008:语法错误: [英] error A2008: syntax error :

查看:53
本文介绍了错误A2008:语法错误:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为正在开发的OS编写引导加载程序.

I'm trying to write a bootloader for an OS I'm developing.

第一行出现语法错误.

这是我的汇编代码:

.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):错误A2008:语法错误:.

StartPoint.asm(1): error A2008: syntax error : .

据我所知,这行应该没问题.

As far as I know, this line shouldn't be a problem.

感谢您的帮助:)

推荐答案

正如@Michael Petch在评论中建议的那样,使用的是MASM的较旧版本(在我的情况下为6.15),并且有效.

As @Michael Petch suggested in the comments, using an older version of MASM (6.15 in my case), and it worked.

请注意,如果您在项目中使用C/CPP代码并打算将它们与程序集文件链接(如我所做的那样),则还需要降级C编译器.就我而言,我将其从CL(Microsoft C/C ++优化编译器版本19.10.25017)更改为dmc .

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.

这篇关于错误A2008:语法错误:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆