Nasm 错误;未定义的标签
Nasm error; undefined labels
这段时间在努力学习汇编。我使用 ms-dos "debug" 命令来创建简单的程序,但现在我想制作大型程序。我下载了 nasm 并尝试 assemble 以下代码:
.model small
.code
mov ax, bx
但是在标签 .model 和 .code 中它说它们是未定义的。我在其他几个 assemblers 中再次尝试了这个,同样的事情发生了。谁能帮我解决这个问题?
我正在使用 Windows 10.
Nasm 程序语法:
segment code
..start:
mov ax, bx
特殊符号 ..start 标记程序的入口点。
Here 是一本关于在 Nasm
中编写 16 位代码的好手册
关于 .model small
- Nasm 中没有内存模型,引用自文档 http://www.nasm.us/doc/nasmdoc2.html:
NASM also does not have any directives to support different 16-bit
memory models. The programmer has to keep track of which functions are
supposed to be called with a far call and which with a near call, and
is responsible for putting the correct form of RET instruction (RETN
or RETF; NASM accepts RET itself as an alternate form for RETN); in
addition, the programmer is responsible for coding CALL FAR
instructions where necessary when calling external functions, and must
also keep track of which external variable definitions are far and
which are near.
我建议您阅读 Nasm documentation - 大多数问题都有答案。
这段时间在努力学习汇编。我使用 ms-dos "debug" 命令来创建简单的程序,但现在我想制作大型程序。我下载了 nasm 并尝试 assemble 以下代码:
.model small
.code
mov ax, bx
但是在标签 .model 和 .code 中它说它们是未定义的。我在其他几个 assemblers 中再次尝试了这个,同样的事情发生了。谁能帮我解决这个问题? 我正在使用 Windows 10.
Nasm 程序语法:
segment code
..start:
mov ax, bx
特殊符号 ..start 标记程序的入口点。 Here 是一本关于在 Nasm
中编写 16 位代码的好手册关于 .model small
- Nasm 中没有内存模型,引用自文档 http://www.nasm.us/doc/nasmdoc2.html:
NASM also does not have any directives to support different 16-bit memory models. The programmer has to keep track of which functions are supposed to be called with a far call and which with a near call, and is responsible for putting the correct form of RET instruction (RETN or RETF; NASM accepts RET itself as an alternate form for RETN); in addition, the programmer is responsible for coding CALL FAR instructions where necessary when calling external functions, and must also keep track of which external variable definitions are far and which are near.
我建议您阅读 Nasm documentation - 大多数问题都有答案。