
 1000  *SAVE S.REPEAT/UNTIL
 1010  *--------------------------------
 1020  *   BY BOBBY DEEN
 1030  *      629 WINCHESTER DR
 1040  *      RICHARDSON,TX. 75080
 1050  *      (214) 235-4391
 1060  *--------------------------------
 1070  AMPERSAND.VECTOR .EQ $3F5
 1080  AS.FRMEVL  .EQ $DD7B     EVALUATE A FORMULA
 1090  AS.CHRGOT  .EQ $00B7     GET CHAR AT TXTPTR
 1100  AS.TXTPTR  .EQ $00B8     POINT TO PROGRAM TEXT
 1110  AS.SYNERR  .EQ $DEC9     SYNTAX ERROR
 1120  AS.ADDON   .EQ $D998     ADDS (Y) TO TXTPTR
 1130  AS.CURLIN  .EQ $75       CURRENT LINE NUMBER
 1140  FAC.EXP    .EQ $9D       EXPONENT OF FAC
 1150  AS.BADFOR  .EQ $DD0B     NEXT WITHOUT FOR ERROR
 1160  AS.NEWSTT  .EQ $D7D2     EXECUTE NEW STATEMENT
 1170  *--------------------------------
 1180         .OR $300
 1190         .TF B.REPEAT/UNTIL
 1200  *--------------------------------
 1210  START  LDA #AMPER.PARSE
 1220         STA AMPERSAND.VECTOR+1
 1230         LDA /AMPER.PARSE
 1240         STA AMPERSAND.VECTOR+2
 1250         RTS
 1260  *--------------------------------
 1270  AMPER.PARSE
 1280         LDX #-1      START OF TABLE
 1290  .1     LDY #-1      START OF AMPER-CALL
 1300  .2     INX
 1310         INY
 1320         LDA TABLE,X  NEXT CHAR FROM TABLE
 1330         BEQ .4       END OF KEYWORD, MATCHED
 1340         CMP (AS.TXTPTR),Y   COMPARE WITH AMPER-CALL
 1350         BEQ .2       MATCHES SO FAR
 1360  *---SKIP TO NEXT TABLE ENTRY-----
 1370  .3     INX          ...TO END OF KEYWORD
 1380         LDA TABLE,X
 1390         BNE .3
 1400         INX          ...OVER THE ADDRESS
 1410         INX
 1420         BNE .1       ...ALWAYS
 1430  *---MATCHED A KEYWORD------------
 1440  .4     JSR AS.ADDON      ADJUST TXTPTR PAST KEYWORD
 1450         LDA TABLE+2,X     GET ADDRESS AND BRANCH
 1460         PHA
 1470         LDA TABLE+1,X
 1480         PHA
 1490         JMP AS.CHRGOT     GET CHAR AT TXTPTR
 1500  *--------------------------------
 1510  TABLE
 1520         .HS 52455045C500    "REPEAT"
 1530         .DA REPEAT-1
 1540         .HS 554E54494C00    "UNTIL"
 1550         .DA UNTIL-1
 1560         .HS A15200          "POPR"
 1570         .DA POPR-1
 1580         .HS 00              ANYTHING
 1590         .DA AS.SYNERR-1
 1600  *--------------------------------
 1610  * REPEAT COMMAND
 1620  *--------------------------------
 1630  REPEAT
 1640         BNE SYNERR       NOT THERE
 1650         PLA          SAVE RETURN ADDRESS
 1660         TAX
 1670         PLA
 1680         TAY
 1690         LDA AS.CURLIN+1 PUSH CURRENT LINE NUMBER
 1700         PHA
 1710         LDA AS.CURLIN
 1720         PHA
 1730         LDA AS.TXTPTR+1 PUSH TEXT POINTER
 1740         PHA
 1750         LDA AS.TXTPTR
 1760         PHA
 1770         LDA #$B8 IDENTIFIER FOR REPEAT LOOP
 1780         PHA      SO THIS ISN'T MISTAKEN FOR FOR/NEXT
 1790  *               OR GOSUB/RETURN
 1800         TYA       PUT RETURN ADDRESS ON STACK
 1810         PHA
 1820         TXA
 1830         PHA
 1840         RTS       AND GO BACK
 1850  *--------------------------------
 1860  * PROCESS UNTIL COMMAND
 1870  *--------------------------------
 1880  UNTIL
 1890         JSR AS.FRMEVL GET EXPRESSION
 1900         LDA FAC.EXP  GET EXPONENT
 1910         BNE POP.IT   TRUE,END LOOP
 1920         TSX          KEEP LOOPING
 1930         LDA $103,X
 1940         CMP #$B8     IS IT A REPEAT?
 1950         BNE BADFOR   NO,ERROR
 1960         LDA $104,X   GET THE DATA
 1970         STA AS.TXTPTR AND TELL APPLESOFT
 1980         LDA $105,X
 1990         STA AS.TXTPTR+1
 2000         LDA $106,X
 2010         STA AS.CURLIN
 2020         LDA $107,X
 2030         STA AS.CURLIN+1
 2040         INX          WE DON'T NEED THE RETURN ADDRESS
 2050         INX
 2060         TXS          KILL SUB CALL
 2070         JMP AS.NEWSTT  NEW STATEMENT
 2080  *--------------------------------
 2090  * POP A REPEAT LOOP OFF STACK
 2100  *--------------------------------
 2110  POPR
 2120         BNE SYNERR
 2130  POP.IT TSX          EXP TRUE,SO END LOOP
 2140         LDA $103,X   MAKE SURE IT IS A REPEAT
 2150         CMP #$B8
 2160         BNE BADFOR
 2170         TXA
 2180         CLC
 2190         ADC #7       PULL 7 THINGS
 2200         TAX
 2210         TXS
 2220         JMP AS.NEWSTT
 2230  *--------------------------------
 2240  BADFOR JMP AS.BADFOR
 2250  SYNERR JMP AS.SYNERR
 2260  *--------------------------------

