简体   繁体   English

使用nasm“在文件开始时应加上标签或说明”进行汇编

[英]assembly using nasm “label or instruction expected at start of file”

I'm learning how to make a boot-sector and im following all the codes in notepad++ (wine used) and i tried to assemble the code: 我正在学习如何制作启动扇区,并按照记事本++(用于葡萄酒)中的所有代码进行即时通讯,并尝试汇编代码:

{BITS 16}
{ORG 0x7C00}

jmp 0x0:Start

Start:
cli
mov AX,0x9000
mov SS,AX
mov SP,0xFB00
sti

mov AH,0Eh
mov AL,'E'
int 10h

cli
hlt

times 510 - ($ - $$) db 0
dw 0xAA55

i keep getting the error thats up above in the description, and i have no idea how to fix this... 我一直在上面的描述中得到错误,并且我不知道如何解决这个问题...

(the code IS spaced properly i dont know why this site put them on the same line like that) (代码间距正确,我不知道为什么这个站点将它们放在同一行上)

Directives in NASM have a user form (eg bits 16 ) and a lower level form (eg [bits 16] ). NASM中的指令具有用户形式(例如, bits 16 )和较低级别的形式(例如, [bits 16] )。 For a lot of cases they're the same (the user form just gets converted into the lower level form internally). 在许多情况下,它们是相同的(用户表单只是在内部转换为较低级别的表单)。 For some cases they aren't the same and the user form does some extra book-keeping stuff that the lower level form doesn't do (eg section vs [section] ). 在某些情况下,它们是不同的,并且用户表单会做一些额外的簿记工作,而较低级别的表单则不会(例如section[section] )。 In any case, neither of these involve curly braces and you should be using the user form (without square brackets) and not the lower level form (with square brackets). 无论如何,这些都不涉及花括号,您应该使用用户表单(不带方括号),而不要使用较低级别的表单(带方括号)。

I don't see any other problems that would cause the error. 我没有看到其他任何会导致错误的问题。

I do see a few unrelated problems though (eg assuming the EBDA is a specific size, and the cli before the hlt that prevents "control+alt+delete"). 我看到,虽然一些不相关的问题(例如,假设EBDA是一个特定的大小和cli的前hlt防止“控制+ Alt + Delete”)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM