!pr0
Macro-Calculated Spiral Screen Clear..............Bruce V. Love
                                          Hamilton, New Zealand

Here is what I think is a beautiful example of using nested recursive macros with the new .SE directive to calculate the addresses for a Spiral Screen Clear.

The macro SPIRAL calls, in order, LEFT, BOTTOM, RIGHT, and TOP to produce the code to handle each side of the screen.  Each of those macros adjusts the appropriate X or Y coordinate and then calls GETADR to calculate the addresses and actually assemble the next instruction pair.

This program won't win any prizes for fast assembly:  I timed it at almost 4 minutes.  You could speed up the process by rewriting the BOTTOM and TOP macros.  They really don't have to call GETADR for all the calculation, they only need to increment or decrement the addresses, but that destroys the symmetry of the original.

I have also produced a faster version of the program.  This one uses self-modifying code to avoid shifting the already-cleared bytes on the screen.  It's interesting to watch the self-modifying version accelerate as it moves fewer bytes each time through the loop.  To produce the faster version, just replace the code from line 1680 on with this new code:
