Search code examples
assemblyx86x86-16masmdosbox

Multi Defined symbol masm 5.0


sorry I would have a probelam. In practice The MASM Assembler does not recognize my macro labels, or rather, even if I define them as local, the following returns to me:

ERROR A2005 Multidefined Symbol

....

This for more and more time

I'll post the macro code here:

input_int MACRO register

    LOCAL input, stop_input

    push    ax
    push    cx

    xor     register, register

    mov     cx, 5

    input:  mov   ah, 01h
            int   21h
            xor   ah, ah

            cmp   al, 13
            je   stop_input

            cmp   al, 48
            jb    stop
    
            cmp   al, 57
            ja    stop

            sub   al, 48
            mov   store_in, ax
            mov   ax, 10
            mul   register
            add   store_in, ax
            mov   register, store_in

            loop  input
            pop   cx
            pop   ax
    
    stop_input: mov  ah, 02h
                mov  dl, 13
                int  21h
                mov  dl, 10
                int  21h
       ENDM

And here the expansion of there

code SEGMENT PARA PUBLIC        

    ASSUME ss: stack, ds: data, cs: code

_start:
    ;load the DS
    mov     ax, data
    mov     ds, ax

    ;ouput msg1
    mov     ah, 09h
    mov     dx, OFFSET msg1
    int     21h

    ;input1
    input_int bx

    ;output msg2
    mov   ah, 09h
    mov   dx, OFFSET msg2
    int   21h 
    
    ;input msg2
    input_int dx

    stop: mov   ah, 04ch
          mov   al, 1
          int   21h

 code ENDS       
    END _start

I have no errors, but there are. In my opinion the assembler has gone mad, you recommend another version of MASM to generate 16bit executables that does not have this bug. I am currently using MASM 5.0.

EDIT: I wrote a new program calling the same macro twice here is the result:

Image

The same mistakes. The code:

abMacro MACRO

    LOCAL jump, doNothing

    mov     cx, 5

    jump: add   ax,10

           cmp   ax, 30
           je    doNothing

           loop  jump

     doNothing: nop

ENDM

stack SEGMENT PARA STACK

    db      ?

stack ENDS


data SEGMENT PARA PUBLIC

     db      ?

data ENDS

code SEGMENT PARA PUBLIC

     ASSUME ss: stack, ds: data, cs: code

_start:

     mov     ax, data
     mov     ds, ax

     abMacro

     abMacro

     mov     ah, 04ch
     mov     al, 1
     int     21h

code ENDS
     END _start

In my opinion the assembler has gone mad. For me It was given me a badly written Assembler, or I touched some files, which is unlikely since I don't even know where the sources are.


Solution

  • It's super weird but it started to work after removing the empty line between macro definition and LOCALs.

    So if your macro declaration is

    abMacro MACRO
    
        LOCAL jump, doNothing
    

    It will return bunch of redefinition errors as in your post enter image description here

    but if you remove that empty line, so it is like this

    abMacro MACRO
        LOCAL jump, doNothing
    

    enter image description here