Any labels in a macro have to be declared with a "local" directive to keep from creating duplicates. Since you have no control over which labels are assigned by PBP, all you can do is let the compiler find them, and then add the labels that cause a problem to a local directive.
@Print_Distance macro arg
@ local L00001, L00003
As the program changes, so will the labels that automatically get generated. So you will be constantly changing the "local" statement to match the current label usage. Also, as Steve and I have already pointed out. You shouldn't put that much code in a macro to begin with.
Create a subroutine with the heavy duty PBP code in it, and just use the macro's to pass the paramters to it. It not only saves on code space, but it also solves the label problem.Code:Dist_To_Print var word system ;------------------------------ Print_Distance_code: if dist_to_print < 200 then lcdout " " endif if dist_to_print < 20 then lcdout " " endif lcdout #(dist_to_print / 2), ".", dec1 ((Dist_To_Print // 2) * 5), "cm" return ;------------------------------ ASM Print_Distance macro arg MOVE?WW arg, Dist_To_Print L?CALL _Print_Distance_code endm ENDASM
Bookmarks