我想在我的程序中使用本地标签,以防止在我的程序中使用常用标签的前缀。我尝试使用本地标签(@@)。根据我的书,“当地标签的生命只向前延伸到下一个非本地标签”。但是,当我尝试编译该文件时,将返回以下错误消息:
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
答案 0 :(得分:3)
默认情况下不启用本地符号。要启用它,源中需要LOCALS
指令。该指令必须放在自己的行中,并且可以多次使用。它需要一个由两个字符组成的参数。此文本将用作所有本地符号的前缀。
例如:LOCALS @@
或LOCALS ZZ