S-C DocuMentor — Applesoft

               SAVE S.DCF9
               1010 *--------------------------------
               1020 *      "NEXT" STATEMENT
               1030 *--------------------------------
DCF9- D0 04    1040 NEXT   BNE NEXT.1   VARIABLE AFTER "NEXT"
DCFB- A0 00    1050        LDY #0       FLAG BY SETTING FORPNT+1 = 0
DCFD- F0 03    1060        BEQ NEXT.2  ...ALWAYS
               1070 *--------------------------------
DCFF- 20 E3 DF 1080 NEXT.1 JSR PTRGET   GET PNTR TO VARIABLE IN (Y,A)
DD02- 85 85    1090 NEXT.2 STA FORPNT   
DD04- 84 86    1100        STY FORPNT+1
DD06- 20 65 D3 1110        JSR GTFORPNT  FIND FOR-FRAME FOR THIS VARIABLE
DD09- F0 04    1120        BEQ NEXT.3    FOUND IT
DD0B- A2 00    1130        LDX #ERR.NOFOR    NOT THERE, ABORT
DD0D- F0 69    1140 GERR   BEQ JERROR    ...ALWAYS
DD0F- 9A       1150 NEXT.3 TXS          SET STACK PTR TO POINT TO THIS FRAME,
DD10- E8       1160        INX              WHICH TRIMS OFF ANY INNER LOOPS
DD11- E8       1170        INX
DD12- E8       1180        INX
DD13- E8       1190        INX
DD14- 8A       1200        TXA          LOW BYTE OF ADRS OF STEP VALUE
DD15- E8       1210        INX
DD16- E8       1220        INX
DD17- E8       1230        INX
DD18- E8       1240        INX
DD19- E8       1250        INX
DD1A- E8       1260        INX
DD1B- 86 60    1270        STX DEST     LOW BYTE ADRS OF FOR VAR VALUE
DD1D- A0 01    1280        LDY /STACK   (Y,A) IS ADDRESS OF STEP VALUE
DD1F- 20 F9 EA 1290        JSR LOAD.FAC.FROM.YA   STEP TO FAC
DD22- BA       1300        TSX
DD23- BD 09 01 1310        LDA STACK+9,X
DD26- 85 A2    1320        STA FAC.SIGN
DD28- A5 85    1330        LDA FORPNT
DD2A- A4 86    1340        LDY FORPNT+1
DD2C- 20 BE E7 1350        JSR FADD     ADD TO FOR VALUE
DD2F- 20 27 EB 1360        JSR SETFOR   PUT NEW VALUE BACK
DD32- A0 01    1370        LDY /STACK   (Y,A) IS ADDRESS OF END VALUE
DD34- 20 B4 EB 1380        JSR FCOMP2   COMPARE TO END VALUE
DD37- BA       1390        TSX
DD38- 38       1400        SEC
DD39- FD 09 01 1410        SBC STACK+9,X   SIGN OF STEP
DD3C- F0 17    1420        BEQ .2       BRANCH IF FOR COMPLETE
DD3E- BD 0F 01 1430        LDA STACK+15,X  OTHERWISE SET UP
DD41- 85 75    1440        STA CURLIN    FOR LINE #
DD43- BD 10 01 1450        LDA STACK+16,X
DD46- 85 76    1460        STA CURLIN+1
DD48- BD 12 01 1470        LDA STACK+18,X   AND SET TXTPTR TO JUST
DD4B- 85 B8    1480        STA TXTPTR       AFTER FOR STATEMENT
DD4D- BD 11 01 1490        LDA STACK+17,X
DD50- 85 B9    1500        STA TXTPTR+1
DD52- 4C D2 D7 1510 .1     JMP NEWSTT
DD55- 8A       1520 .2     TXA          POP OFF FOR-FRAME, LOOP IS DONE
DD56- 69 11    1530        ADC #17      CARRY IS SET, SO ADDS 18
DD58- AA       1540        TAX
DD59- 9A       1550        TXS
DD5A- 20 B7 00 1560        JSR CHRGOT   CHAR AFTER VARIABLE
DD5D- C9 2C    1570        CMP #','     ANOTHER VARIABLE IN NEXT?
DD5F- D0 F1    1580        BNE .1       NO, GO TO NEXT STATEMENT
DD61- 20 B1 00 1590        JSR CHRGET   YES, PRIME FOR NEXT VARIABLE
DD64- 20 FF DC 1600        JSR NEXT.1   (DOES NOT RETURN)
               1610 *--------------------------------
               1620 *      EVALUATE EXPRESSION, MAKE SURE IT IS NUMERIC
               1630 *--------------------------------
DD67- 20 7B DD 1640 FRMNUM JSR FRMEVL
               1650 *--------------------------------
               1660 *      MAKE SURE (FAC) IS NUMERIC
               1670 *--------------------------------
DD6A- 18       1680 CHKNUM CLC
DD6B- 24       1690        .HS 24       DUMMY FOR SKIP
               1700 *--------------------------------
               1710 *      MAKE SURE (FAC) IS STRING
               1720 *--------------------------------
DD6C- 38       1730 CHKSTR SEC
               1740 *--------------------------------
               1750 *      MAKE SURE (FAC) IS CORRECT TYPE
               1760 *      IF C=0, TYPE MUST BE NUMERIC
               1770 *      IF C=1, TYPE MUST BE STRING
               1780 *--------------------------------
DD6D- 24 11    1790 CHKVAL BIT VALTYP   $00 IF NUMERIC, $FF IF STRING
DD6F- 30 03    1800        BMI .2       TYPE IS STRING
DD71- B0 03    1810        BCS .3       NOT STRING, BUT WE NEED STRING
DD73- 60       1820 .1     RTS          TYPE IS CORRECT
DD74- B0 FD    1830 .2     BCS .1       IS STRING AND WE WANTED STRING
DD76- A2 A3    1840 .3     LDX #ERR.BADTYPE  TYPE MISMATCH
DD78- 4C 12 D4 1850 JERROR JMP ERROR