程序集(Intel 语法 + NASM)错误:尝试在任何非本地标签之前定义本地标签 [英] Assembly (Intel syntax + NASM) Error: attempt to define a local label before any non-local labels

查看:24
本文介绍了程序集(Intel 语法 + NASM)错误:尝试在任何非本地标签之前定义本地标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对程序集很陌生,我正在尝试使用程序.因此,每当我尝试编译它时,都会收到该行的错误,如代码中的注释下所列.

I am quite new regarding the assembly and I am trying to work with a program. So whenever I try to compile it, I get the error for the line, as listed under the comments in the code.

我想知道是否有人知道为什么在我为其余的汇编代码定义某些内容时 NASM 会检测到此错误?

也许它与 main 的定义方式有关?

Maybe it has to do something with how the main is defined?

附言我只列出了代码的第一部分,因为程序很长.

P.S. I listed just the first part of the code, since the program is quite long.

感谢您的帮助

.xlist               ;attempt to define a local label before any non-local labels
include  stdlib.a     ;  parser: instruction expected
includelib stdlib.lib    ; parser: instruction expected
.list
.286

dseg            segment para public 'data' 
;  Unknown section attribute 'public' ignored on declaration of section `para'
h               word    ?
i               word    ?

cseg            segment para public 'code'
                assume  cs:cseg, ds:dseg

Main

推荐答案

在 NASM 中,以点开头的标签称为局部标签.它被附加到最后一个全局标签,例如,

In NASM a label starting with dot is called a local label. It is appended to the last global label, for example,

L:
.l2: ; it is really L.l2

所以你不能在任何全局标签之前有一个本地标签

So you cannot have a local label before any global ones

这篇关于程序集(Intel 语法 + NASM)错误:尝试在任何非本地标签之前定义本地标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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