I am writing a program on assembler using TASM 4.1 and I have stumbled upon a problem I have been unable to fix for 2 days. The problem is that TASM just won't recognize labels in macro as local labels and would give me an error when assembling (Symbol already defined elsewhere). So far I have tried the following things:
- Putting LOCALS at the very beginning of .asm file and using @@ for local labels (as was suggested in one of the answers to a similar problem). Produced zero effect whatsoever.
- Using LOCAL inside a macro to list all my local labels starting with @@ (again, as was suggested on the web). However, this produced even more errors when assembling: "Symbol already different kind" and "Expecting pointer type"
- Putting LOCALS @@ at the beginning of macro. Just like with the first case, zero effect.
- Putting LOCALS at the beginning of .asm file and listing labels using LOCAL. Same effect as with #2.
- Putting LOCALS at the beginning of .asm file and using LOCALS @@ inside macro. No effect.
- Putting LOCALS @@ at the beginning of .asm file. No effect.
This is my very first time trying to program, so I apologize if I missed some trivial thing that causes this problem. Here is the macro that I have troubles using more than once:
dot_connect_oct1 macro dot1_x, dot1_y, dot2_x, dot2_y, colour
;;code
@@check_1:
;;code
jz @@exit_1
;;code
jg @@draw_1_2
@@draw_1_1:
;;code
jmp @@check_1
@@draw_1_2:
;;code
jmp @@check_1
@@exit_1:
endm
Update:
Alright, I seem to have found the solution. What worked for me was declaring LABELS at the beginning of .asm file and using LOCAL in the macro itself for each label like this:
LOCAL @@label1
LOCAL @@label2
LOCAL @@label3
...
Listing them in one line (LOCAL @@label1, @@label2, @@label3, ...) does not work.
Maybe someone will find this useful.