I am learning assembly coding, here's my code of Greatest common divisor (GCD), after trying to compile the code, it gives this error :
error: symbol 'etq1' redefined
error: symbol 'etq2' redefined
segment .data
r db 0
segment .bss
segment .text
global _main
extern _printf
_main:
mov al,[200]
mov bl,[201]
etq1: cmp al,bl
jb fin
etq2: call PGCD
mov [202],bl
fin:
ret
and heres's the call function ;
function
PGCD:
mov [r],al
reste: cmp [r],bl
jb etq1
sub [r],bl
etq1: cmp [r],0
jne etq2
etq2: mov al, bl
mov bl,[r]
jmp PGCD
ret
All the labels in your asm source are global. Local labels (those which have smaller scope of visibility) are usually have special syntax. For example nasm
gives special treatment to symbols beginning with a period. A label beginning with a single period is treated as a local label, which means that it is associated with the previous non-local label.
ARM asm allows numeric labels, etc. You have to read documentation on your assembly program to find out specific syntax.