
 1000  *SAVE S.CLEAR ARRAYS
 1010  *--------------------------------
 1020  *   &CLEAR <ARRAY LIST>
 1030  *      SETS ALL VALUES IN REAL ARRAYS TO 0
 1040  *                      INTEGER ARRAYS TO 0
 1050  *                       STRING ARRAYS TO ""
 1060  *--------------------------------
 1070  *   WRITTEN BY JOHAN ZWIEKHORST, BASED ON
 1080  *   "CLEAR STRING ARRAY" BY BOB SANDER-CEDERLOF
 1090  *   IN DECEMBER, 1982 APPLE ASSEMBLY LINE
 1100  *--------------------------------
 1110  T.CLEAR    .EQ $BD  "CLEAR" TOKEN
 1120  *--------------------------------
 1130  ARYPT      .EQ $94
 1140  LOWTR      .EQ $9B
 1150  ARYEND     .EQ $9D  (= FAC)
 1160  *--------------------------------
 1170  CHRGET     .EQ $B1
 1180  CHRGOT     .EQ $B7
 1190  SYNERR     .EQ $DEC9
 1200  GETARYPT   .EQ $F7D9
 1210  *--------------------------------
 1220         .OR $300     (COULD BE ANYWHERE YOU LIKE)
 1230  *--------------------------------
 1240  CLEAR.ARRAYS
 1250         CMP #T.CLEAR      &CLEAR?
 1260         BEQ .3            ...YES
 1270  .1     JMP SYNERR
 1280  .2     CMP #$2C          COMMA?
 1290         BNE .1
 1300  *---GET STARTING ADDRESS---------
 1310  .3     JSR CHRGET   GET NEXT CHAR (SHOULD BE LETTER)
 1320         JSR GETARYPT FIND NAME/ADDRESS OF ARRAY
 1330         LDY #4       COMPUTE SIZE OF PREAMBLE
 1340         LDA (LOWTR),Y     # DIMENSIONS
 1350         ASL               *2, AND CLEAR CARRY
 1360         ADC #5            +5 (2 FOR NAME)
 1370         ADC LOWTR            (2 FOR OFFSET)
 1380         PHA                  (1 FOR # DIMS)
 1390         LDA LOWTR+1
 1400         ADC #0            ADD CARRY
 1410         STA ARYPT+1
 1420  *---GET ENDING ADDRESS-----------
 1430         CLC          ADD OFFSET TO GET ADDRESS OF END
 1440         LDY #2
 1450         LDA (LOWTR),Y
 1460         ADC LOWTR
 1470         STA ARYEND
 1480         INY
 1490         LDA (LOWTR),Y
 1500         ADC LOWTR+1
 1510         STA ARYEND+1
 1520  *---SET UP POINTER TO START------
 1530         PLA
 1540         TAY
 1550         LDA #0
 1560         STA ARYPT
 1570         LDX ARYPT+1
 1580  *---LOOP TO SET ELEMENTS ZERO----
 1590  .4     STA (ARYPT),Y
 1600         INY
 1610         BNE .5       ...USUALLY
 1620         INX          ...NEXT PAGE
 1630         STX ARYPT+1
 1640  .5     CPY ARYEND   AT END YET?
 1650         BNE .4       ...NO
 1660         CPX ARYEND+1
 1670         BNE .4       ...NO
 1680  *---CHECK IF ANOTHER ARRAY-------
 1690         JSR CHRGOT
 1700         BNE .2       ...YES, UNLESS SYNTAX ERROR
 1710         RTS

