A2004问题MASM32 [英] A2004 Problem With MASM32
问题描述
我跟MASM32汇编问题
I have a problem with the MASM32 assembler
以下code是,我从MASM32教程复制一个Hello World的例子:
The following code is a Hello World example that I copied from the MASM32 tutorial:
.model small
.stack
.data
message db "Hello world!", "$"
.code
_main proc
mov ax,seg message
mov ds,ax
mov ah,09
lea dx,message
int 21h
mov ax,4c00h
int 21h
_main endp
end _main
在试图组装,MASM32抛出A2004错误与以下注释:
On attempt to assemble, MASM32 throws A2004 error with the following comment:
C:\masm32\console.asm(11) : error A2004: symbol type conflict
谁能帮我吗?
这code工作完全正常的TASM汇编,但现在我必须使用MASM32和我有任何集会code,我已经证明了早些时候与TASM来解决这个A2004错误。
Can anyone help me with that? This code worked perfectly fine with the TASM assembler, but now I have to use MASM32 and I am having this A2004 error for any assembly code that I've earlier proven to work with TASM.
在这种情况下是相关的,我是在运行Win7操作系统32位的CPU。
In case this is relevant, I am have a 32bit CPU running Win7 OS.
感谢。
推荐答案
我是pretty肯定的是, .MODEL小
和赛格
是更早时代的文物时,x86架构才真正分割(成64K块)。
I'm pretty certain that .model small
and seg
are artefacts of an earlier age when the x86 architecture was truly segmented (into 64K chunks).
的 MASM32
IDE不喜欢他们驾轻就熟所有(并不意外,因为它是更为常见时下做的32位平面模型code)
The masm32
IDE doesn't like them very much at all (not unexpected since it's far more common nowadays to be doing 32-bit flat model code).
问题在于一个事实,即斌\\ assmbl.bat
文件正在由编辑器对文件进行汇编,它包含行:
The problem lies in the fact that the bin\assmbl.bat
file is being used by the editor to assemble the file and it contains the line:
\masm32\bin\ml /c /coff %1.asm > \masm32\bin\asmbl.txt
(用 / COFF
选项)。这是什么使汇编抱怨。
(with the /coff
option). This is what's making the assembler complain.
您可以得到它通过恢复到命令行工作。假设你的文件 tst.asm
,请使用以下命令:
You can get it to work by reverting to the command line. Assuming your file is tst.asm
, use the following commands:
c:\masm32\bin\ml.exe /c tst.asm
c:\masm32\bin\link16 tst.obj.tst.exe,,,,
,你就会有一个 tst.exe
工作正常。
下面的记录表明这个作品:
The following transcript shows that this works:
C:\masm32> type tst.asm
.model small
.stack
.data
message db "Hello world!", "$"
.code
_main proc
mov ax,seg message
mov ds,ax
mov ah,09
lea dx,message
int 21h
mov ax,4c00h
int 21h
_main endp
end _main
 
C:\masm32> bin\ml.exe /c tst.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: tst.asm
 
C:\masm32> bin\link16 tst.obj,tst.exe,,,,
Microsoft (R) Segmented Executable Linker Version 5.60.339 Dec 5 1994
Copyright (C) Microsoft Corp 1984-1993. All rights reserved.
 
C:\masm32> tst.exe
Hello world!
另外,编辑器是非常可配置的。如果你打开进行编辑 menus.ini
文件(背它首先,我不应该要告诉你,)和变化:
Alternatively, the editor is very configurable. If you open up the menus.ini
file for editing (back it up first, I shouldn't need to tell you that) and change:
&Assemble ASM file,\MASM32\BIN\Assmbl.bat "{b}"
到
&Assemble ASM file,\MASM32\BIN\Assmbl.bat "{b}"
Assemble ASM file (no COFF),\MASM32\BIN\Assmbl2.bat "{b}"
您可以添加在IDE重启新的菜单项。
you can get your new menu item added on IDE restart.
您还需要assmbl.bat 复制斌\\到
斌\\ assmbl2.bat
和删除 / COFF
从后者。
You also need to copy bin\assmbl.bat
to bin\assmbl2.bat
and remove the /coff
from the latter.
然后就可以从使用新的菜单选项,在IDE中编译罚款。
Then you can compile fine from within the IDE with the new menu option.
当然,你必须做的链接
和汇编/链接
菜单项同样的事情为好。但是,现在你知道它是如何做,这应该不是present一个问题。
Of course, you'll have to do the same thing for the link
and assemble/link
menu items as well. But, now that you know how it's done, that shouldn't present a problem.
这篇关于A2004问题MASM32的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!