如何在 TASM 的程序中使用本地标签? [英] How to use local labels in procedures in TASM?
本文介绍了如何在 TASM 的程序中使用本地标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写的很简单
.MODEL small
.STACK 100h
.DATA
liczba dw 0h
licznik dw 0
potega dw 1
liczbaString dw ?
buff db 26
.CODE
Program:
mov ax, @DATA
mov ds, ax
call PobierzString
call PetlaIteracjiZnaku
;zwraca do ax pobraną liczbę
PetlaIteracjiZnaku PROC
mov si, liczbaString
call ZnajdzDlugoscString
mov si, liczbaString
add si, 2
mov bl, 1
petla:
xor ax, ax
mov al, [si]
cmp al, 24h; sprawdza czy nie jest koniec wprowadzanej liczby '$'
je return
sub al, 30h ; odejmuję 30 żeby zamienić znak na liczbę
mul bx
add [liczba], ax
mov ax, bx
mov bx, 0Ah
mul bx
mov bx, ax
inc si
jmp petla
return:
ret
PetlaIteracjiZnaku ENDP
; ! si - caly string
; - ax - dlugosc stringu
ZnajdzDlugoscString PROC
mov al, 0h
petla:
mov dl, [si]
cmp dl, 24h
je return
inc al
jmp petla
return:
ret
ZnajdzDlugoscString ENDP
PobierzString PROC
xor ax,ax
mov ah, 0Ah
mov dx, offset buff
int 21h
mov liczbaString, dx
ret
PobierzString ENDP
Koniec:
mov ah, 4ch
int 21h
end Program
但是我不能用 tasm 编译它,因为我得到错误:
But I can't compile it with tasm because I get error:
已定义的符号为:PETLA
已定义的符号为:RETURN
Symbol already defined elswere: PETLA
Symbol already defined elswere: RETURN
如何为程序使用本地标签?我尝试在 使用过程范围来避免局部标签? 但它仍然不起作用.
我不知道如何实现这一点...
How to use local labels for procedures? I tried to add .PETLA
and %%PETLA
as in Use procedure scope to avoid local labels? but it still doesn't work.
I have no idea how to achive this...
推荐答案
要在带有 TASM 的过程中使用局部标签,您需要:
To use local labels in procedures with TASM you need to:
- 使用
@@
前缀作为标签名称;和 - 将
LOCALS @@
放在文件的开头.
- Use the
@@
prefix for your label name; and - Place
LOCALS @@
in the beginning of your file.
您可以使用不同的前缀代替 @@
,但 @@
是常见的.
You can use a diferent prefix instead of @@
, but @@
is the common one.
请参阅 TASM 用户指南的第 130 页.
这篇关于如何在 TASM 的程序中使用本地标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文