
 1000         .TF CLEAR
 1010         .LIST OFF
 1020  *--------------------------------
 1030         .MA SPIRAL
 1040         >LEFT             move left side up
 1050  BOTLFT .SE BOTLFT-1        and move corner up
 1060         >BOTTOM           move bottom left
 1070  BOTRGT .SE BOTRGT-1        and move corner left
 1080         >RIGHT            move right side down
 1090  TOPRGT .SE TOPRGT+1        and move corner down
 1100         >TOP              move top right
 1110  TOPLFT .SE TOPLFT+1        and move corner right
 1120         .DO TOPLFT<13     done?
 1130         >SPIRAL           no, do it again
 1140         .FIN
 1150         .EM
 1160  *--------------------------------
 1170         .MA GETADR
 1180  ADRTO  .SE ADRFRM
 1190  BLOCK  .SE Y.CORD/8      hi, mid, or low, 0-2
 1200  BLK.AD .SE BLOCK*$28     block offset
 1210  TEMP   .SE BLOCK*8
 1220  LINE   .SE Y.CORD-TEMP   line within block, 0-7
 1230  LIN.AD .SE LINE*$80      line offset
 1240  ADRFRM .SE $400+BLK.AD+LIN.AD+X.CORD
 1250         LDA ADRFRM
 1260         STA ADRTO
 1270         .EM
 1280  *--------------------------------
 1290         .MA LEFT
 1300  Y.CORD .SE Y.CORD+1      down one step
 1310         >GETADR
 1320         .DO Y.CORD<BOTLFT done?
 1330         >LEFT             no, again
 1340         .FIN
 1350         .EM
 1360  *--------------------------------
 1370         .MA BOTTOM
 1380  X.CORD .SE X.CORD+1      right one step
 1390         >GETADR
 1400         .DO X.CORD<BOTRGT done?
 1410         >BOTTOM           no, again
 1420         .FIN
 1430         .EM
 1440  *--------------------------------
 1450         .MA RIGHT
 1460  Y.CORD .SE Y.CORD-1      up one step
 1470         >GETADR
 1480         .DO Y.CORD>TOPRGT done?
 1490         >RIGHT            no, again
 1500         .FIN
 1510         .EM
 1520  *--------------------------------
 1530         .MA TOP
 1540  X.CORD .SE X.CORD-1      left one step
 1550         >GETADR
 1560         .DO X.CORD>TOPLFT done?
 1570         >TOP              no, again
 1580         .FIN
 1590         .EM
 1600  *--------------------------------
 1610  BOTLFT .SE 23       bottom left Y coord
 1620  BOTRGT .SE 39       bottom right X coord
 1630  TOPRGT .SE 0        top right Y coord
 1640  TOPLFT .SE 1        top left X coord
 1650  X.CORD .SE 0        start with upper
 1660  Y.CORD .SE 0          left corner
 1670  ADRFRM .SE $400
 1680  POINTER .EQ 0
 1690  *--------------------------------
 1700         LDY #0       no indexing
 1710         LDA #END     start pointer at end of code
 1720         STA POINTER
 1730         LDA /END
 1740         STA POINTER+1
 1750  .2     JSR LOOP     do one step
 1760         LDA #$AD     restore LDA code
 1770         STA (POINTER),Y
 1780  *--------------------------------
 1790         LDA POINTER  decrement pointer
 1800         SEC          by 6
 1810         SBC #6
 1820         STA POINTER
 1830         BCS .1
 1840         DEC POINTER+1
 1850  .1     LDA #$60     insert RTS code
 1860         STA (POINTER),Y
 1870  *--------------------------------
 1880         LDA POINTER  compare pointer
 1890         CMP #LOOP    to beginning of code
 1900         BNE .2
 1910         LDA POINTER+1
 1920         SBC /LOOP
 1930         BNE .2       branch if not yet done
 1940  *--------------------------------
 1950  FIXUP  LDA #$AD     restore LDA
 1960         STA LOOP      at beginning
 1970         LDA #$60     and RTS
 1980         STA END       at end
 1990         JMP $3D0     and reenter DOS
 2000  *--------------------------------
 2010  SAVE   .DA #$A0     <space> to fill screen
 2020  *--------------------------------
 2030  LOOP   >SPIRAL
 2040         LDA SAVE
 2050         STA $5B4
 2060  END    RTS

