多定义符号 masm 5.0

问题描述

对不起,我会有一个问题。 实际上,MASM 汇编器无法识别我的宏标签,或者更确切地说,即使我将它们定义为本地,以下内容也会返回给我:

ERROR A2005 Multidefined Symbol

....

This for more and more time

我会在这里发布宏代码:

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

这里是那里的扩展

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

我没有错误,但是有。 在我看来,汇编程序已经疯了,您建议使用另一个版本的 MASM 来生成没有此错误的 16 位可执行文件。 我目前使用的是 MASM 5.0。

编辑: 我编写了一个新程序,两次调用相同的宏,结果如下:

Image

同样的错误。 代码:

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,cs: code

_start:

     mov     ax,data
     mov     ds,ax

     abMacro

     abMacro

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

code ENDS
     END _start

在我看来,汇编程序已经疯了。 对我来说,它给了我一个写得很糟糕的汇编程序,或者我接触了一些文件,这不太可能,因为我什至不知道来源在哪里。

解决方法

这很奇怪,但在删除宏定义和 LOCAL 之间的空行后它开始工作了。

所以如果你的宏声明是

abMacro MACRO

    LOCAL jump,doNothing

它会像你的帖子一样返回一堆重定义错误 enter image description here

但是如果你去掉那个空行,就是这个样子

abMacro MACRO
    LOCAL jump,doNothing

enter image description here

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...