TASM中的本地标签:符号已定义 [英] Local labels in TASM: Symbol already defined
问题描述
我想在我的过程中使用本地标签,以防止在程序中为通用标签使用前缀.我尝试使用本地标签(@@).根据我的书,本地标签的寿命仅向前和向后延伸到下一个非本地标签".但是,当我尝试编译文件时,返回以下错误消息:
I want to use local labels in my procedures to prevent the use of prefixes for common labels in my program. I tried using local labels (@@). According to my book, "The life of a local label extends only forward and back to the next nonlocal label". However, when I try to compile the file, the following error message is returned:
Turbo Assembler Version 3.1 Copyright (c) 1988, 1992 Borland International
Assembling file: test.ASM
**Error** test.ASM(20) Symbol already defined elsewhere: @@EXIT
**Error** test.ASM(33) Symbol already defined elsewhere: @@EXIT
Error messages: 2
Warning messages: None
Passes: 1
Remaining memory: 472k
这是源代码:
Data segment
Data ends
Stack1 segment Stack "Stack"
dw 256 dup(?)
Stack1 ends
Code segment
assume cs:Code, ss:Stack1, ds:Data
.386
proc1 proc
; some code here
@@exit:
ret
proc1 endp
proc2 proc
; some code here
@@exit:
ret
proc2 endp
main proc
mov ax, Data
mov ds, ax
@@repeat:
call proc1
call proc2
jz @@repeat
@@exit:
mov ah, 4Ch
mov al, 0
int 21h
main endp
Code ends
end main
推荐答案
默认情况下未启用本地符号.要启用它,源中需要LOCALS
指令.该指令必须放在自己的行中,并且可以多次使用.它需要一个由两个字符组成的参数.该文本将用作所有本地符号的前缀.
Local symbols isn't enabled by default. To enable it, the LOCALS
directive is needed in the source. This directive must be placed in its own line and can be used multiple times. It needs one parameter that consist of two characters. This text will be used as the prefix for all local symbols.
例如:LOCALS @@
或LOCALS ZZ
这篇关于TASM中的本地标签:符号已定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!