goapple2/source/applesoft/S.DCF9

86 lines
3.1 KiB
Plaintext
Raw Normal View History

2014-05-10 00:59:16 +00:00
1010 *--------------------------------
1020 * "NEXT" STATEMENT
1030 *--------------------------------
1040 NEXT BNE NEXT.1 VARIABLE AFTER "NEXT"
1050 LDY #0 FLAG BY SETTING FORPNT+1 = 0
1060 BEQ NEXT.2 ...ALWAYS
1070 *--------------------------------
1080 NEXT.1 JSR PTRGET GET PNTR TO VARIABLE IN (Y,A)
1090 NEXT.2 STA FORPNT
1100 STY FORPNT+1
1110 JSR GTFORPNT FIND FOR-FRAME FOR THIS VARIABLE
1120 BEQ NEXT.3 FOUND IT
1130 LDX #ERR.NOFOR NOT THERE, ABORT
1140 GERR BEQ JERROR ...ALWAYS
1150 NEXT.3 TXS SET STACK PTR TO POINT TO THIS FRAME,
1160 INX WHICH TRIMS OFF ANY INNER LOOPS
1170 INX
1180 INX
1190 INX
1200 TXA LOW BYTE OF ADRS OF STEP VALUE
1210 INX
1220 INX
1230 INX
1240 INX
1250 INX
1260 INX
1270 STX DEST LOW BYTE ADRS OF FOR VAR VALUE
1280 LDY /STACK (Y,A) IS ADDRESS OF STEP VALUE
1290 JSR LOAD.FAC.FROM.YA STEP TO FAC
1300 TSX
1310 LDA STACK+9,X
1320 STA FAC.SIGN
1330 LDA FORPNT
1340 LDY FORPNT+1
1350 JSR FADD ADD TO FOR VALUE
1360 JSR SETFOR PUT NEW VALUE BACK
1370 LDY /STACK (Y,A) IS ADDRESS OF END VALUE
1380 JSR FCOMP2 COMPARE TO END VALUE
1390 TSX
1400 SEC
1410 SBC STACK+9,X SIGN OF STEP
1420 BEQ .2 BRANCH IF FOR COMPLETE
1430 LDA STACK+15,X OTHERWISE SET UP
1440 STA CURLIN FOR LINE #
1450 LDA STACK+16,X
1460 STA CURLIN+1
1470 LDA STACK+18,X AND SET TXTPTR TO JUST
1480 STA TXTPTR AFTER FOR STATEMENT
1490 LDA STACK+17,X
1500 STA TXTPTR+1
1510 .1 JMP NEWSTT
1520 .2 TXA POP OFF FOR-FRAME, LOOP IS DONE
1530 ADC #17 CARRY IS SET, SO ADDS 18
1540 TAX
1550 TXS
1560 JSR CHRGOT CHAR AFTER VARIABLE
1570 CMP #',' ANOTHER VARIABLE IN NEXT?
1580 BNE .1 NO, GO TO NEXT STATEMENT
1590 JSR CHRGET YES, PRIME FOR NEXT VARIABLE
1600 JSR NEXT.1 (DOES NOT RETURN)
1610 *--------------------------------
1620 * EVALUATE EXPRESSION, MAKE SURE IT IS NUMERIC
1630 *--------------------------------
1640 FRMNUM JSR FRMEVL
1650 *--------------------------------
1660 * MAKE SURE (FAC) IS NUMERIC
1670 *--------------------------------
1680 CHKNUM CLC
1690 .HS 24 DUMMY FOR SKIP
1700 *--------------------------------
1710 * MAKE SURE (FAC) IS STRING
1720 *--------------------------------
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 *--------------------------------
1790 CHKVAL BIT VALTYP $00 IF NUMERIC, $FF IF STRING
1800 BMI .2 TYPE IS STRING
1810 BCS .3 NOT STRING, BUT WE NEED STRING
1820 .1 RTS TYPE IS CORRECT
1830 .2 BCS .1 IS STRING AND WE WANTED STRING
1840 .3 LDX #ERR.BADTYPE TYPE MISMATCH
1850 JERROR JMP ERROR