I have a problem with the MASM32 assembler
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
On attempt to assemble, MASM32 throws A2004 error with the following comment:
C:\masm32\console.asm(11) : error A2004: symbol type conflict
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.
In case this is relevant, I am have a 32bit CPU running Win7 OS.
Thanks.
I’m pretty certain that
.model smallandsegare artefacts of an earlier age when the x86 architecture was truly segmented (into 64K chunks).The
masm32IDE 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).The problem lies in the fact that the
bin\assmbl.batfile is being used by the editor to assemble the file and it contains the line:(with the
/coffoption). This is what’s making the assembler complain.You can get it to work by reverting to the command line. Assuming your file is
tst.asm, use the following commands:and you’ll have a
tst.exethat works fine.The following transcript shows that this works:
Alternatively, the editor is very configurable. If you open up the
menus.inifile for editing (back it up first, I shouldn’t need to tell you that) and change:to:
you can get your new menu item added on IDE restart.
You also need to copy
bin\assmbl.battobin\assmbl2.batand remove the/cofffrom the latter.Then you can compile fine from within the IDE with the new menu option.
Of course, you’ll have to do the same thing for the
linkandassemble/linkmenu items as well. But, now that you know how it’s done, that shouldn’t present a problem.