1430 IF P%(B,PR%(B)) THEN POKE HT,(B -C) *16: PRINT P$(B,PR%(B));:PR%(B) = PR%(B) +1:NP = 1: NEXT : GOTO 1460
1440 PR%(B) = PR%(B) +1: IF PR%(B) <41 THEN IF LEN(P$(B,PR%(B))) THEN 1430
1450 PR%(B) = 40: NEXT
1460 IF NP THEN PRINT PN$
1470 NP = 0: FOR B = C TO A: IF PR%(B) <40 THEN NP = 1
1480 NEXT : IF NP THEN 1410
1490 NEXT : PRINT PFF$: PRINT D$"PR#0": FOR B = 0 TO CTG -1:PR%(B) = 0: NEXT : GOTO 350
1500 PRINT "Here's the whole list!": PRINT : PRINT
1510 FOR C = 0 TO CTG -1 STEP CLM: PRINT PC$:A = C +CLM -1: IF A = >CTG THEN A = CTG -1
1520 FOR P = 0 TO 40:NP = 0: FOR B = C TO A: IF NOT LEN(P$(B,P)) THEN NEXT : GOTO 1540
1530 POKE HT,(B -C) *16: PRINT P$(B,P);:NP = 1: NEXT
1540 IF NP THEN PRINT PN$
1550 NEXT : NEXT : PRINT PFF$: PRINT D$"PR#0": GOTO 350
1560 REM
1570 REM " Various subroutines
1580 REM
1590 VTAB 3: PRINT "***************************************** Super Shopper by Steven Meuse ** Copyright 1985 by MicroSPARC, Inc. *****************************************": RETURN : REM "41/2/41 *'S
1600 VTAB 23: HTAB 1: CALL -958: RETURN
1610 PRINT TAB( 6)"press <RETURN> to continue...";: GET A$: RETURN
1620 B = 3 +(NP <21) *7 +20 *(P >20): HTAB B: VTAB 1 +P -(P >20) *20: IF B = 3 THEN POKE 33,19
1630 CALL -868: POKE 33,40: IF P%(C,P) THEN PRINT "*";
1640 HTAB B +2: PRINT P$(C,P): RETURN
1650 PRINT TAB( 17)"...............";: HTAB 1: POKE 34, PEEK(37): INPUT "Enter new item->";B$: TEXT : GOSUB 1710: GOSUB 1600: IF LEN(B$) >15 THEN 1650: REM "15 PERIODS
1660 IF NOT LEN(B$) THEN POP : GOTO 510
1670 GOSUB 70: PRINT "Is "B$" on your current": PRINT "shopping list? (Y/N/ESC) ";: GOSUB 80: GOSUB 1600: IF A$ = "Y" THEN B = 1: RETURN
1680 IF A$ = "N" THEN B = 0: RETURN
1690 IF ASC(A$) = 27 THEN POP : GOTO 510
1700 GOTO 1670
1710 IF NOT LEN(B$) THEN RETURN
1720 A$ = "": FOR B = 1 TO LEN(B$): IF ASC( MID$ (B$,B,1)) >31 THEN A$ = A$ + MID$ (B$,B,1)
1730 NEXT :B$ = A$: RETURN
1740 REM
1750 REM " Screen product list display
1760 REM
1770 D = 3:NP = 40: IF NOT LEN(P$(C,21)) THEN D = 10
1780 VTAB 1: POKE 35,22: HOME : POKE 35,24: HTAB (39 - LEN(P$(C,0)))/2: INVERSE : PRINT P$(C,0): NORMAL
1790 FOR A = 1 TO 20: HTAB D: IF P%(C,A) THEN PRINT "*";
1800 HTAB D +2: PRINT P$(C,A): IF NOT LEN(P$(C,A)) THEN NP = A -1:A = 20: NEXT : RETURN
1810 NEXT
1820 VTAB 2:D = 23: FOR A = 21 TO 40: HTAB D: IF P%(C,A) THEN PRINT "*";
1830 HTAB D +2: PRINT P$(C,A): IF NOT LEN(P$(C,A)) THEN NP = A -1:A = 40
1840 NEXT : RETURN
1850 REM
1860 REM " Choose a product (using moving arrow)
1870 REM
1880 GOSUB 1770
1890 VTAB 24: PRINT "Use arrow keys to select-(RET) to enter";: IF VP <2 THEN VP = 2:HP = 0
2010 IF ASC(A$) = 13 THEN P = VP -1 +((HP >1) *20): RETURN
2020 IF ASC(A$) = 21 OR ASC(A$) = 10 THEN VP = VP +1: IF VP = 22 AND HP = 1 THEN VP = 2:HP = 20
2030 IF VP +18 = NP AND HP = 20 THEN VP = 2:HP = 1
2040 IF ASC(A$) = 8 OR ASC(A$) = 11 THEN VP = VP -1: IF VP = 1 AND HP = 1 THEN HP = 20:VP = NP -19
2050 IF VP = 1 AND HP = 20 THEN VP = 21:HP = 1
2060 IF ASC(A$) > <27 THEN 1990
2070 P = VP -1 +((HP >1) *20)
2080 GOSUB 1600: POP : IF P$(C,NP) = CHR$(27) THEN P$(C,NP) = "":VP = VP -(P = NP):NP = NP -1: IF NP = 20 THEN GOSUB 1770: REM "adjust NP and VP if (A)dd changed it
2090 GOTO 510
2100 REM
2110 REM " Choose a category (using moving arrow)
2120 REM
2130 HOME : VTAB 22: PRINT TAB( 12)"Which category?"
2140 PRINT TAB( 6)"Use arrow keys for selection": PRINT TAB( 9)"Use (RETURN) to enter";: VTAB 1
2150 HP = 0:VP = 0: IF VC <1 THEN VC = 1
2160 B = 12: IF CTG >20 THEN B = 5: GOTO 2280
2170 HC = 0: FOR C = 0 TO CTG -1: HTAB B: PRINT P$(C,0): NEXT
2630 HOME : GOSUB 1590: PRINT : PRINT : PRINT "You have left all categories unused.": PRINT : PRINT "You may:": PRINT : PRINT TAB( 9)"A)dd categories": PRINT : PRINT TAB( 9)"Q)uit": GOSUB 80: IF A$ = "A" THEN 3000
2640 IF A$ = "Q" THEN 3140
2650 GOTO 2630
2660 REM
2670 REM " Change a category name
2680 REM
2690 HOME : VTAB 22: PRINT TAB( 6)"Change which category name?": GOSUB 2140
2700 HTAB 1: VTAB 22: CALL -958: PRINT : PRINT TAB( 25)"...............";: HTAB 1: POKE 34,22: INPUT "Enter new category name>";B$: TEXT : GOSUB 1710: GOSUB 1600: IF NOT LEN(B$) THEN 2430: REM "15 PERIODS
2760 GOSUB 1600: PRINT TAB( 12)"K)eep or D)elete": PRINT TAB( 6)P$(C,0)" list contents?";
2770 GOSUB 80: IF A$ < >"K" AND A$ < >"D" THEN 2770
2780 HOME : VTAB 12: PRINT TAB( 9)"Changing category name"
2790 GOSUB 3190:P$(C,0) = B$:P = 0: GOSUB 3200: IF A$ = "K" THEN 2820
2800 FOR P = 1 TO 40: IF NOT LEN(P$(C,P)) THEN NEXT : GOTO 2820
2810 P$(C,P) = "":P%(C,P) = 0: GOSUB 3200: NEXT
2820 GOSUB 3210: GOTO 2430
2830 REM
2840 REM " Add a category
2850 REM
2860 IF CTG <40 THEN 2890
2870 HOME : GOSUB 1590: VTAB 9: PRINT CHR$(7)"You have reached the 40-category limit. A new category may be added only after an existing category is deleted."
2880 VTAB 23: GOSUB 1610: GOTO 2430
2890 VTAB 12: HTAB 1: CALL -958: VTAB 16: PRINT TAB( 25)"...............";: HTAB 1: POKE 34,15: INPUT "Enter new category name>";B$: TEXT : GOSUB 1710: IF NOT LEN(B$) THEN 2430: REM "15 PERIODS
2900 IF LEN(B$) >15 THEN 2890
2910 C = CTG:P = 0: GOSUB 70:P$(C,0) = B$:P%(C,0) = 1: GOSUB 3190: GOSUB 3200: FOR P = 1 TO 40:P$(C,P) = "":P%(C,P) = 0: GOSUB 3200: NEXT :CTG = CTG +1: GOSUB 3220: GOSUB 3210: GOTO 2430
2920 REM
2930 REM " This is where we go the very first time SHOPPER is run.
2940 REM
2950 POKE 216,0: PRINT : PRINT D$"CLOSE":P = PEEK(222): IF P <5 OR P >6 THEN PRINT "ERROR #"P" IN LINE #" PEEK(218) + PEEK(219) *256: END
3230 GOSUB 3190: GOSUB 3210: PRINT D$"DELETE"F$: GOSUB 3190: GOSUB 3220: FOR C = 0 TO CTG -1: FOR P = 0 TO 40: GOSUB 3200: NEXT : NEXT : GOSUB 3210: RETURN