开发者

"error A2006: undefined symbol" in masm32 in window 7 64 bit?

开发者 https://www.devze.com 2023-04-07 14:54 出处:网络
When i run this example, I get an error. After removing PROC1 PROC FAR, I get another error "symbol type conflict". With /coff: "leading underscore required for start address : START&qu

When i run this example, I get an error. After removing PROC1 PROC FAR, I get another error "symbol type conflict". With /coff: "leading underscore required for start address : START".

Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved.

Assembling: D:\Linux\test1.asm D:\Linux\test1.asm(28) : error A2006: undefined symbol : START

D:\Linux\test1.asm(16) : error A2004: symbol type conflict

D:\Linux\test1.asm(28) : error A2148: invalid symbol type in expression : STAR

        TITLE EXAMPLE
DATA    SEGMENT
VARX    DW          6
VARY    DW          7
RESULT  DW          ?
DATA    ENDS
STACK1  SEGMENT PARA STACK
        DW          20H DUP(0)
STACK1  ENDS
COSEG   SEGMENT
PROC1   PROC    FAR
        ASSUME  CS:COSEG, DS:DATA, SS:STACK1
START:  PUSH    DS
        MOV     AX, 0
        PUSH    AX
        MOV     AX, DATA
        MOV     DS, AX
 开发者_JS百科       MOV     DX, VARX
        MOV     DX, VARY
        MOV     CL, 3
        SAL     DX, CL
        SUB     DX, VARX
        SAR     DX, 1
        MOV     RESULT, DX
        RET
PROC1   ENDP
COSEG   ENDS
        END START

Addendum:

After removing start, it left error at line 16. Why happens this error at MOV AX, DATA?

Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved.

Assembling: D:\Linux\test1.asm D:\Linux\test1.asm(16) : error A2004: symbol type conflict


Because START is defined inside a procedure, it is not a valid identifier outside it.

Also, if it did work you would be creating a bug. PROC is a macro that expands to setup a stack frame, so your label START is not actually at the start of the code, while END START indicates that the entry point for your program is START. If you want your program to start with a main procedure you should just use the name of that procedure after END, like END PROC1.

If it really was your intent to set the entry point to somewhere in your procedure, you could surround the label with OPTION NOSCOPED and OPTION SCOPED, so the label will be public, and not just visible inside the procedure.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号