Macro params scope issue
An assembler for the legendary 6502 processor and it's derivatives
Brought to you by:
soci
unpacking, locals and macros are wack.
_points = ((0,-3),(1,-3),(2,-2),(3,-1),(3,0),(3,1),(2,2),(1,3),(0,3),(-1,3),(-2,2),(-3,1),(-3,0),(-3,-1),(-2,-2),(-1,-3))
.for _pon in _points[:-1]
#mDrawPixel _pon[0],_pon[1]
ldy BallY
.next
this will fail as it doesn't know what _pon is for the second case
also if one doesn't do the split and uses the '*' form
#mDrawPixel *_pon
it fails
even if pon isn't local.
Seems once it gets to the second param of the macro its already in its own scope somewhere.
when in mDrawPixel is defined as a .macro and takes 2 params.
That's an expected limitation of a .macro. It's just copy/pasting the parameters as plain text. Using a .segment instead of .macro would solve the scoping problem here.
If mDrawPixel would be a .function then the parameters would be passed properly and would work as well.