Question

I've started to learn assembly and tried to compile the following code on visual studio 2010

DSEG SEGMENT
    A DW 8
    B DW 10
DSEG ENDS

SSEG SEGMENT STACK
    DW 100H DUP(?)
SSEG ENDS

CSEG SEGMENT
ASSUME CS:CSEG, DS:DSEG, SS:SSEG

MAIN PROC FAR
    PUSH DS
    MOV  AX, 0
    PUSH AX
    MOV  AX, DSEG
    MOV  DS, AX

    ; The start of the program

    MOV  AX, A
    MOV  BX, B
    ADD  AX, BX
    MOV  A, AX

    RET
MAIN ENDP

CSEG ENDS

END MAIN

I got the following errors:

1>main.asm(17): error A2004: symbol type conflict
1>main.asm(32): warning A4023: with /coff switch, leading underscore required for start address : MAIN
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm.targets(49,5): error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\main.obj" /W3 /errorReport:prompt /coff  /Tamain.asm" exited with code 1.

I searched the web for a soulution and the only thing I found is that error A2004 happes because the /coff directive.

How can I remove the /coff from the argument list? (If this is what cusing This error to apeare).


Thanks,
Ido Sorozon

Était-ce utile?

La solution

If you are learning the assembly language basics, you should give a try with emu8086: it is a tool dedicated to assembly learning that features a Masm compatible assembler with support for macros (it can also support fasm syntax) and a 8086 cpu simulator with DOS screen emulation to test / debug your work.

It makes it possible to produce 16 bit COM programs, old fashioned EXEs and even boot sectors.

The sample program that you show in your question assembles without problem with that tool.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top