I want to declare the following macro in my common.h
file:
.macro HEX_NIBBLE reg
//LOCAL letter, end
cmp $10, \reg
jae letter
add $'0, \reg
jmp end
letter:
/* 0x37 == 'A' - 10 */
add $0x37, \reg
end:
.endm
Whenever I call the above core at more than one place in my main.S
code, I get the following errors :
$ as --32 -o main.o main.S -g
main.S: Assembler messages:
main.S:17: Error: symbol `letter' is already defined
main.S:17: Error: symbol `end' is already defined
main.S:17: Error: symbol `letter' is already defined
main.S:17: Error: symbol `end' is already defined
main.S:17: Error: symbol `letter' is already defined
main.S:17: Error: symbol `end' is already defined
I want to use only GNU assembler (GAS), no GCC. How can I avoid these errors? Is there any assembly directive for this situation?
main.S
can be taken anything for this examples, say below code :
.include "common.h"
BEGIN
HEX_NIBBLE %ax
HEX_NIBBLE %ax
HEX_NIBBLE %ax
HEX_NIBBLE %ax
hlt