Compucolor.org – Virtual Media

Listing of file='PGM1.BAS;01' on disk='vmedia/execugraph-sector.ccvf'

12 REM  TRENDSPOTTER 15/04/81, GAB
14 REM  BY INTELLIGENT SYSTEMS CORP.
30 PLOT 6,2,12,14,3,20,10
40 PRINT "1.  REMOVE PROGRAM DISK"
50 PLOT 6,3,3,20,14
60 PRINT "2.  INSERT DATA DISK"
70 PLOT 15,6,1,3,20,20
80 PLOT 6,7,2,30,38,242,30,98,98,98,98,38,30,38,255,6,1
88 REM
110 PLOT 3,20,18:PRINT "HIT RETURN":PLOT 3,0,0:INPUT "";X$
112 POKE 33283,224:POKE 33284,255:POKE 32940,223:POKE 32941,255
114 CLEAR
116 FOR I= 1TO 22:READ A:POKE 65503+ I,A:NEXT I
118 DATA 33,0,96,17,0,112,1,0,16,26,119,35,19,13,194,233,255,5,194,233,255,201
119 GOSUB 7450
120 REM
130 CLEAR 800
140 PLOT 30,16,29
150 DIM D(5,84)
160 DIM MOS$(12)
170 DIM TI$(5),UNITS$(5),SY(5),SM(5),PD(5)
180 GOSUB 1090
190 NUM(0)= 12
200 CL= 2:PD(0)= 12:HS= 8:NB= 1:B= 0
210 MOS$(1)= "JAN":MOS$(2)= "FEB":MOS$(3)= "MAR"
220 MOS$(4)= "APR":MOS$(5)= "MAY":MOS$(6)= "JUN"
230 MOS$(7)= "JUL":MOS$(8)= "AUG":MOS$(9)= "SEP"
240 MOS$(10)= "OCT":MOS$(11)= "NOV":MOS$(12)= "DEC"
250 PC= 6
260 FILE "T",7990
270 OS= 0:NB= 1
280 SM= SM(0):SY= SY(0):PD= PD(0):SD= (0)
290 CL= 2
300 GOSUB 780
310 IF X$= "BAR"THEN B= 0:NB= 1:GOSUB 1880
320 IF X$= "LIN"THEN GOSUB 2190
330 IF X$= "SCA"THEN GOSUB 2410
340 IF X$= "ARE"THEN GOSUB 2610
350 IF MID$ (X$,2,2)= "BA"THEN B= B+ 1:GOSUB 2910
360 IF X$= "DAT"THEN 20000
370 IF X$= "CLE"THEN GOSUB 1090
380 IF X$= "NEW"THEN GOSUB 1090:GOSUB 3850:GOTO 270
390 IF X$= "DRA"THEN GOSUB 3030
400 IF X$= "HEL"THEN GOSUB 7450
410 IF X$= "COL"THEN GOSUB 4530
420 IF X$= "HIG"THEN GOSUB 3200
430 IF X$= "HOR"THEN GOSUB 3360
440 IF X$= "REM"THEN GOSUB 3100
450 IF X$= "STA"THEN GOSUB 4440
460 IF X$= "DIR"THEN PLOT 6,2,12,29,27,4:PRINT "DIR":PLOT 27,27:INPUT "HIT RETURN";Q$:GOSUB 1090
462 IF X$= "INI"THEN GOSUB 9100
465 IF X$= "FOR"THEN GOSUB 9200
466 IF X$= "DUP"THEN LOAD "DUP":RUN
470 IF X$= "LOA"THEN GOSUB 4580
480 IF NUM= 0THEN 300
490 IF X$= "SAV"THEN GOSUB 4620
500 IF X$= "LOW"THEN GOSUB 3280
510 IF X$= "TIT"THEN GOSUB 4820
520 IF X$= "UNI"THEN GOSUB 4900
530 IF X$= "TRE"THEN GOSUB 4980
540 IF X$= "SMO"THEN GOSUB 5260
550 IF X$= "MOV"THEN GOSUB 5380
560 IF X$= "ARI"THEN GOSUB 5560
570 IF X$= "DIS"THEN GOSUB 5900
580 IF X$= "INF"THEN GOSUB 6180
590 IF X$= "BAS"THEN GOSUB 6440
600 IF X$= "CON"THEN GOSUB 6590
610 IF X$= "DIF"THEN GOSUB 6840
620 IF X$= "%DI"THEN GOSUB 6840
630 IF X$= "SUM"THEN GOSUB 7010
640 IF X$= "LEA"THEN GOSUB 7190
650 IF X$= "LAG"THEN GOSUB 7270
660 IF X$= "WOR"THEN GOSUB 4740
670 IF X$= "VAL"THEN GOSUB 7350
680 IF X$= "LOG"THEN GOSUB 8060
690 IF X$= "EXP"THEN GOSUB 8130
700 IF X$= "ETR"THEN GOSUB 8200
710 IF X$= "PIC"THEN GOSUB 2960
720 IF X$= "PER"THEN GOSUB 8820
730 IF X$= "SEA"THEN GOSUB 8680
740 IF X$= "LTR"THEN GOSUB 8550
750 IF X$= "2SM"THEN GOSUB 8900
760 IF X$= "3SM"THEN GOSUB 8980
770 GOTO 300
780 X= 0
790 X$= "":A$= ""
800 PLOT 3,0,31,6,1
810 PLOT 11
820 PLOT 3,0,31
825 PLOT 15
830 PRINT "--> ";:PLOT 6,0,29
831 POKE  33278,0
833 IF  PEEK (33278)= 0 THEN  833
835 CH= PEEK (33278):IF  CH> 239 THEN  GOSUB  12000:GOTO 870
836 IF CH> 15AND CH< 24THEN CL= CH- 16:GOTO 780
837 IF CH= 13THEN 780
839 PLOT 3,4,31
840 PLOT 6,3,29:PRINT CHR$ (CH);:INPUT "";Q$:QQ$= CHR$ (CH)+ Q$
850 PLOT 3,0,31
860 IF LEN (QQ$)< 3THEN RETURN
870 FOR I= 1TO LEN (QQ$)
880 IF MID$ (QQ$,I,1)= " "THEN X= LEN (QQ$)- I
890 NEXT
900 X$= LEFT$ (QQ$,3)
910 IF X> = 1THEN A$= RIGHT$ (QQ$,X)
920 RETURN
930 REM
940 PLOT 3,0,31,6,1
950 PLOT 11,6,1
960 PLOT 3,0,31
970 RETURN
980 REM
990 Q$= LEFT$ (A$,2)
1000 IF VAL (A$)< 1OR VAL (A$)> PDOR VAL (RIGHT$ (A$,3))< > 0OR LEN (A$)> 5THEN GOSUB 930:GOTO 1030
1010 GOTO 1040
1020 Q$= "Y"
1030 INPUT "BAD DATE. RETURN";Q$:RETURN
1040 IF LEN (A$)= 4THEN MO$= LEFT$ (A$,1)
1050 IF LEN (A$)= 5THEN MO$= LEFT$ (A$,2)
1060 MO= VAL (MO$)
1070 YR= VAL (RIGHT$ (A$,2))
1080 RETURN
1090 REM
1100 PLOT 12,6,4,15
1110 PLOT 30
1120 FOR I= 1TO 7
1130 PLOT 3,6,(I- 1)* 4
1140 PRINT "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
1150 NEXT
1160 PLOT 6,7
1170 PLOT 27,10
1180 PLOT 3,5,0
1190 PRINT "bbbbbbbbbbbbbbbbbbbbbbbb"
1200 PLOT 27,24
1210 CF= 0:RK= 0:B= 0
1220 PLOT 6,0
1230 RETURN
1240 REM
1250 IF PD= 4THEN 1300
1260 IF HS= 1THEN MO$= "JFMAMJJASOND":MO$= CHR$ (23)+ MO$+ CHR$ (22)+ MO$:MO$= MO$+ MO$+ MO$+ MO$
1270 IF HS= 2THEN MO$= "J F M A M J J A S O N D ":MO$= CHR$ (23)+ MO$+ CHR$ (22)+ MO$:MO$= MO$+ MO$
1280 IF HS= 3THEN MO$= "J  F  M  A  M  J  J  A  S  O  N  D  ":MO$= CHR$ (23)+ MO$+ CHR$ (22)+ MO$:MO$= MO$+ MO$
1290 GOTO 1330
1300 IF HS= 1THEN MO$= "1234":MO$= CHR$ (23)+ MO$+ CHR$ (22)+ MO$:MO$= MO$+ MO$+ MO$:MO$= MO$+ MO$+ MO$
1310 IF HS= 2THEN MO$= "1 2 3 4 ":MO$= CHR$ (23)+ MO$+ CHR$ (22)+ MO$:MO$= MO$+ MO$+ MO$:MO$= MO$+ MO$+ MO$
1320 IF HS= 3THEN MO$= "1  2  3  4  ":MO$= CHR$ (23)+ MO$+ CHR$ (22)+ MO$:MO$= MO$+ MO$+ MO$+ MO$+ MO$
1330 MT= SM+ SD:YT= SY
1340 IF MT> PDTHEN MT= MT- PD:YT= YT+ 1:GOTO 1340
1350 MO$= CHR$ (23)+ MID$ (MO$,HS* (MT- 1)+ 2,66+ 24/ PD- HS* 2)
1360 PLOT 3,7,25
1370 PRINT MO$
1380 J= 0
1390 X= 0:YC= 7
1400 PLOT 3,7,26,11,3,7,26,6,7
1410 PRINT RIGHT$ (STR$ (YT+ 1900),4);"----"
1420 Y= (PD+ 1- MT)* HS+ 7
1430 X= Y+ J* HS* PD
1440 IF X> 60THEN 1680
1450 PLOT 3,X,26
1460 IF YC= 6THEN YC= 7:GOTO 1480
1470 IF YC= 7THEN YC= 6
1480 PLOT 6,YC
1490 PRINT RIGHT$ (STR$ (YT+ 1901+ J),4);"----"
1500 J= J+ 1
1510 GOTO 1430
1520 IF HS< 4AND PD< > 1THEN 1240
1530 YT= SY:MT= SM+ SD
1540 J= 0
1550 IF MT> PDTHEN MT= MT- PD:YT= YT+ 1:GOTO 1550
1560 IF MT= 1AND PC= 6THEN PC= 7:GOTO 1580
1570 IF MT= 1AND PC= 7THEN PC= 6
1580 M$= MOS$(MT):IF HS< 4THEN M$= LEFT$ (M$,1)
1590 IF PD= 4THEN M$= STR$ (MT)
1600 IF PD= 1THEN M$= "  "
1610 X= 7+ J* HS
1620 IF X> 61THEN 1680
1630 PLOT 6,PC
1640 PLOT 3,X,25
1650 PRINT M$
1655 X$= RIGHT$ (STR$ (YT+ 1900),4):IF HS< 5THEN X$= RIGHT$ (X$,2)
1660 IF MT= 1OR J= 0THEN PLOT 3,X,26:IF X< 60THEN PRINT X$;:IF X< 56AND PD> 1THEN PRINT "----"
1670 MT= MT+ 1:J= J+ 1:GOTO 1550
1680 REM
1690 PLOT 3,0,28
1700 PRINT "                    "
1710 PLOT 3,0,28
1720 PLOT 15,6,6
1730 PLOT 3,0,28
1740 UNITS$(0)= LEFT$ (UNITS$(0),20)
1750 PRINT UNITS$(0)
1760 RETURN
1770 REM
1780 TC= CL
1790 PLOT 6,TC,15
1800 TITLE$(0)= LEFT$ (TITLE$(0),62- LEN (UNITS$))
1810 IF CF> 4THEN CF= 4
1820 PLOT 3,LEN (UNITS$),26+ CF
1830 PRINT LEFT$ ("                                                             ",64- LEN (UNITS$))
1840 X= INT (LEN (TITLE$(0))/ 2):IF X> 33- LEN (UNITS$)THEN X= 33- LEN (UNITS$)
1850 PLOT 3,33- X,26+ CF
1860 PRINT TITLE$(0)
1870 RETURN
1880 REM
1890 IF A$= ""THEN RETURN
1900 GOSUB 3450
1910 IF NUM(0)= 0THEN RETURN
1920 IF CF= 0THEN GOSUB 4140
1930 IF X$= "BAR"AND HS= 1THEN BW= .5
1940 PLOT 6,CL,2
1950 FOR I= 1TO NUM
1960 Y0= K* 16+ 32
1970 YMAX= INT ((D(0,I)- LOW)* 16/ INC+ .5)+ 32
1980 IF YMAX= 0THEN 2120
1990 YMAX= YMAX- 1
2000 IF YMAX> 127THEN YMAX= 127
2010 IF YMAX< 32THEN YMAX= 32
2020 Y1= Y0:Y2= YMAX
2030 IF Y0> YMAXTHEN Y1= YMAX:Y2= Y0- 1
2040 FOR J= 1TO BW* 2
2050 X= (I- 1+ OS- SD)* HS* 2+ J+ 13+ B* BW* 2
2060 IF X> 127THEN J= BW* 2:I= NUM(0):GOTO 2110
2070 IF X< 14THEN 2110
2080 PLOT 246,Y1
2090 PLOT 245,X
2100 PLOT 244,Y2
2110 NEXT J
2120 NEXT I
2130 PLOT 255
2140 IF CF= 0THEN GOSUB 1520
2150 CF= CF+ 1
2160 GOSUB 1770
2170 IF MID$ (QQ$,2,2)= "BA"THEN CL= CL+ 3:IF CL> 7THEN CL= CL- 8:IF CL= 0THEN CL= 3
2180 RETURN
2190 REM
2200 IF A$= ""THEN RETURN
2210 GOSUB 3450
2220 IF NUM(0)= 0THEN RETURN
2230 IF CF= 0THEN GOSUB 4140
2240 PLOT 6,CL
2250 Z= 1
2260 FOR I= 1TO NUM
2270 X= (I- 1+ OS- SD)* HS* 2+ 14
2280 IF X> 126THEN I= NUM:GOTO 2350
2290 IF X< 14THEN NEXT I
2300 Y= INT ((D(O,I)- LOW)* 16/ INC+ .5)+ 32
2310 IF Y> 127THEN Y= 127
2320 IF Y< 32THEN Y= 32
2330 IF Z= 1THEN PLOT 2,X,Y,242:Z= 0
2340 PLOT X,Y
2350 NEXT I
2360 PLOT 255
2370 IF CF= 0THEN GOSUB 1520
2380 CF= CF+ 1
2390 GOSUB 1770
2400 RETURN
2410 REM
2420 IF A$= ""THEN RETURN
2430 GOSUB 3450
2440 IF NUM(0)= 0THEN RETURN
2450 IF CF= 0THEN GOSUB 4140
2460 PLOT 6,CL,2
2470 FOR I= 1TO NUM
2480 X= (I- 1+ OS- SD)* HS* 2+ 14
2490 IF X> 126THEN I= NUM:GOTO 2550
2500 IF X< 14THEN NEXT I
2510 Y= INT ((D(0,I)- LOW)* 16/ INC+ .5)+ 32
2520 IF Y> 127THEN Y= 127
2530 IF Y< 32THEN Y= 32
2540 PLOT X,Y
2550 NEXT I
2560 PLOT 255
2570 IF CF= 0THEN GOSUB 1520
2580 CF= CF+ 1
2590 GOSUB 1770
2600 RETURN
2610 REM
2620 IF A$= ""THEN RETURN
2630 GOSUB 3450
2640 IF NUM(0)= 0THEN RETURN
2650 IF CF= 0THEN GOSUB 4140
2660 PLOT 6,CL
2670 X= 0
2680 PLOT 2
2690 FOR J= 1TO NUM- 1
2700 IF X+ HS* 2> 127THEN J= NUM- 1:GOTO 2850
2710 FOR I= 0TO HS* 2- 1
2720 X= (J- 1+ OS- SD)* HS* 2+ 14+ I
2730 IF X< 14THEN NEXT I:NEXT J
2740 Y0= K* 16+ 32
2750 YMAX= INT ((D(0,J)+ (I/ (HS* 2))* (D(0,J+ 1)- D(0,J))- LOW)* 16/ INC+ .5)+ 31
2760 IF YMAX= 0THEN 2840
2770 IF YMAX> 127THEN YMAX= 127
2780 IF YMAX< 32THEN YMAX= 32
2790 Y1= Y0:Y2= YMAX
2800 IF Y0> YMAXTHEN Y1= YMAX:Y2= Y0- 1
2810 PLOT 246,Y1
2820 PLOT 245,X
2830 PLOT 244,Y2
2840 NEXT I
2850 NEXT J
2860 PLOT 255
2870 IF CF= 0THEN GOSUB 1520
2880 CF= CF+ 1
2890 GOSUB 1770
2900 RETURN
2910 REM
2920 NB= VAL (LEFT$ (X$,1))
2930 IF NB< 1OR NB> 9THEN RETURN
2940 IF CF= 0THEN B= 0:GOSUB 4400
2950 GOTO 1880
2960 REM
2970 IF A$= ""THEN RETURN
2980 PLOT 3,0,31,11
2985 XX= CALL (0)
2990 PLOT 27,4
3000 PRINT "SAV "+ A$+ ".DSP 7000-7FFF"
3010 PLOT 27,27
3020 RETURN
3030 REM
3040 IF A$= ""THEN RETURN
3050 PLOT 27,4
3060 PRINT "LOAD "+ A$+ ".DSP 7000"
3070 PLOT 27,27
3080 PLOT 6,0,2,1,1,255
3090 RETURN
3100 REM
3110 PLOT 6,7,3,7,RK
3120 RK= RK+ 1
3130 IF A$= ""THEN RETURN
3140 J= 1
3150 IF MID$ (QQ$,J,1)= " "THEN 3170
3160 J= J+ 1:IF J< 52THEN 3150
3170 RE$= RIGHT$ (QQ$,LEN (QQ$)- J)
3175 PLOT 15
3180 PRINT RE$
3190 RETURN
3200 REM
3210 IF A$= ""THEN RETURN
3220 IF LEFT$ (A$,1)= "A"THEN HIGH= HN
3230 X= VAL (A$)
3240 IF X< = LOWTHEN GOSUB 930:INPUT "HIGH TOO LOW";Q$:RETURN
3250 HIGH= VAL (A$)
3260 GOSUB 1090
3270 RETURN
3280 REM
3290 IF A$= ""THEN RETURN
3300 IF LEFT$ (A$,1)= "A"THEN LOW= LOW
3310 X= VAL (A$)
3320 IF X> = HIGHTHEN GOSUB 930:INPUT "LOW TOO HIGH!";Q$:RETURN
3330 LOW= VAL (A$)
3340 GOSUB 1090
3350 RETURN
3360 REM
3370 X= VAL (A$)
3380 IF X< 1OR X> 57THEN RETURN
3390 Z= NUM
3400 NUM= X
3410 GOSUB 1090
3420 GOSUB 4350
3430 NUM= Z
3440 RETURN
3450 REM
3460 IF A$= "0"THEN RETURN
3470 X= VAL (A$):IF X> 0AND X< 5AND LEN (A$)= 1THEN 3790
3480 FILE "R",1,A$,1
3490 GET 1,1,1;SM(0)
3500 GET 1,2,1;SY(0)
3510 GET 1,3,1;NUM(0)
3520 GET 1,4,1;PD(0)
3530 TITLE$(0)= "":UNITS$(0)= ""
3540 FOR I= 5TO 9:GET 1,I,1;T$[4]:TITLE$(0)= TITLE$(0)+ T$:NEXT
3550 FOR I= 10TO 14:GET 1,I,1;T$[4]:UNITS$(0)= UNITS$(0)+ T$:NEXT
3560 FOR I= 21TO 20+ NUM(0):GET 1,I,1;D(0,I- 20):NEXT
3570 FILE "C",1
3580 GOTO 3850
3590 REM
3600 FOR I= 26TO 1STEP - 1
3610 FOR J= 0TO 2
3620 D(0,I* 3- J)= D(0,I)/ 3
3630 NEXT J,I
3640 PD(0)= 12:NUM(0)= NUM(0)* 3
3645 IF NUM(0)> 78THEN NUM(0)= 78
3650 SM(0)= (SM(0)- 1)* 3+ 1
3660 RETURN
3670 REM
3680 MT= SM(0):X= 0
3690 IF MT= 1THEN 3730
3700 IF MT/ 3= INT (MT/ 3)THEN 3720
3710 MT= MT+ 1:X= X+ 1:GOTO 3700
3720 X= X+ 1
3730 FOR I= 1TO INT (NUM(0)/ 3)
3740 D(0,I)= D(0,(I- 1)* 3+ 1+ X)+ D(0,(I- 1)* 3+ 2+ X)+ D(0,(I- 1)* 3+ 3+ X)
3750 NEXT
3760 PD(0)= 4:NUM(0)= INT (NUM(0)/ 3)
3770 SM(0)= INT (SM(0)/ 3)+ 1
3780 RETURN
3790 REM
3800 FOR I= 1TO 78
3810 D(0,I)= D(X,I)
3820 NEXT
3830 TITLE$(0)= TITLE$(X):UNITS$(0)= UNITS$(X):NUM(0)= NUM(X):PD(0)= PD(X)
3840 SM(0)= SM(X):SY(0)= SY(X)
3850 IF CF= 0THEN PD= PD(0)
3860 IF PD= 12AND PD(0)= 4THEN GOSUB 3590
3870 IF PD= 1AND PD(0)= 4THEN GOSUB 8290
3880 IF PD= 4AND PD(0)= 1THEN GOSUB 8390
3890 IF PD= 1AND PD(0)= 12THEN GOSUB 8470
3900 IF PD= 12AND PD(0)= 1THEN GOSUB 8510
3910 IF PD= 4AND PD(0)= 12THEN GOSUB 3670
3920 IF CF= 0THEN SM= SM(0):SY= SY(0):NUM= NUM(0)
3930 IF CF= 0THEN GOSUB 4350
3940 OS= SM(0)- SM+ (SY(0)- SY)* PD
3950 IF LEN (TITLE$(0))= 0THEN RETURN
3960 HN= - 100000:LN= 100000
3970 NUM= NUM(0)
3980 FOR I= 1TO NUM(0)
3990 IF D(0,I)< LNTHEN LN= D(0,I)
4000 IF D(0,I)> HNTHEN HN= D(0,I)
4010 NEXT
4020 IF CF= 0THEN LOW= LN:HIGH= HN
4030 IF CF= 0AND LOW> 0THEN LOW= 0
4040 IF CF= 0AND HIGH< = 0THEN HIGH= 0
4050 IF LEN (TITLE$(0))= 0OR LEN (UNITS$(0))= 0THEN RETURN
4060 IF LEFT$ (TITLE$(0),1)= " "OR LEFT$ (UNITS$(0),1)= " "THEN RETURN
4070 I= 1
4080 IF LEFT$ (RIGHT$ (TITLE$(0),I),1)= " "THEN I= I+ 1:IF I< LEN (TITLE$(0))THEN 4080
4090 TITLE$(0)= LEFT$ (TITLE$(0),LEN (TITLE$(0))- I+ 1)
4100 I= 1
4110 IF LEFT$ (RIGHT$ (UNITS$(0),I),1)= " "THEN I= I+ 1:GOTO 4110
4120 UNITS$(0)= LEFT$ (UNITS$(0),LEN (UNITS$(0))- I+ 1):IF CF= 0THEN UNITS$= UNITS$(0)
4130 RETURN
4140 REM
4150 I= .001
4160 IF LOW> = 0THEN K= 0:MX= HIGH- LOW:MS= 6
4170 IF LOW< 0AND HIGH< = 0THEN K= 6:MX= LOW- HIGH:MS= 6
4180 IF LOW< 0AND HIGH> 0THEN K= INT ((- LOW* 5)/ (- LOW+ HIGH))+ 1:MX= LOW:MS= K:GOTO 4200
4190 GOTO 4210
4200 IF - LOW/ K< HIGH/ (6- K)THEN MX= HIGH:MS= 6- K
4210 RESTORE :DATA 1,1.5,2,2.5,3,4,5,6,7.5
4220 FOR J= 1TO 9:READ X
4230 IF MS* X* I= > ABS (MX)THEN INC= X* I:J= 9:NEXT :GOTO 4250
4240 NEXT :I= I* 10:GOTO 4210
4250 IF LOW< 0AND HIGH> = 0THEN LOW= - INC* K
4260 PLOT 6,7
4270 PLOT 3,6,(6- K)* 4
4280 PRINT "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
4290 FOR I= 1TO 7
4300 X= 5- LEN (STR$ ((I- 1)* INC+ LOW)):IF X< 0THEN X= 0
4310 PLOT 3,X,(7- I)* 4
4320 PRINT (I- 1)* INC+ LOW
4330 NEXT
4340 RETURN
4350 REM
4360 IF NUM= 0THEN RETURN
4370 HS= INT (57/ NUM)
4380 IF HS< 1THEN HS= 1
4390 IF HS< NBTHEN HS= NB
4400 BW= INT (HS/ (NB+ 1))
4410 IF HS= 1THEN BW= 1
4420 IF BW< 1THEN BW= 1
4430 RETURN
4440 REM
4450 IF A$= ""THEN RETURN
4460 IF A$= "0"THEN SD= 0:GOTO 4510
4470 GOSUB 980
4480 IF Q$= ""THEN RETURN
4490 SD= MO- SM(0)+ (YR- SY(0))* PD
4500 IF SD< 0THEN SD= 0
4510 GOSUB 1090
4520 RETURN
4530 REM
4540 IF A$= ""THEN RETURN
4550 IF ASC (A$)< 16OR ASC (A$)> 23THEN RETURN
4560 CL= ASC (A$)- 16
4570 RETURN
4580 REM
4590 IF A$= ""THEN RETURN
4600 GOSUB 3450
4610 RETURN
4620 REM
4630 IF A$= ""THEN RETURN
4640 X= VAL (A$)
4650 IF X< 1OR X> 4THEN RETURN
4660 FOR I= 1TO 78
4670 D(X,I)= D(0,I)
4680 NEXT
4690 SM(X)= SM(0):SY(X)= SY(0)
4700 TITLE$(X)= TITLE$(0)
4710 UNITS$(X)= UNITS$(0)
4720 NUM(X)= NUM(0):PD(X)= PD(0)
4730 RETURN
4740 REM
4750 IF A$= ""THEN RETURN
4760 X= VAL (A$)
4770 IF X< 1OR X> 4THEN RETURN
4780 GOSUB 930
4790 PLOT 6,5
4800 PRINT TITLE$(X);:INPUT "";Q$
4810 RETURN
4820 REM
4830 IF A$= ""THEN RETURN
4840 J= 1
4850 IF MID$ (QQ$,J,1)= " "THEN 4870
4860 J= J+ 1:IF J< = 20THEN 4850
4870 TITLE$(0)= RIGHT$ (QQ$,LEN (QQ$)- J)
4880 GOSUB 1790
4890 RETURN
4900 REM
4910 IF A$= ""THEN RETURN
4920 J= 1
4930 IF MID$ (QQ$,J,1)= " "THEN 4950
4940 J= J+ 1:IF J< = 20THEN 4930
4950 UNITS$(0)= RIGHT$ (QQ$,LEN (QQ$)- J)
4960 GOSUB 1680
4970 RETURN
4980 REM
4990 XY= 0:SX= 0:YY= 0:X2= 0
5000 IF A$= ""THEN S= 0:GOTO 5060
5010 GOSUB 980
5020 IF Q$= ""THEN RETURN
5030 S= MO- SM(0)+ (YR- SY(0))* PD
5040 IF S< 0THEN S= 0
5050 OS= OS+ S
5060 FOR J= S+ 1TO NUM
5070 XY= XY+ J* D(0,J)
5080 SX= SX+ J
5090 YY= YY+ D(0,J)
5100 X2= X2+ J* J
5110 NEXT
5120 T= (XY- SX* YY/ (NUM- S))/ (X2- SX* SX/ (NUM- S))
5130 C= (SX* XY- YY* X2)/ (SX* SX- (NUM- S)* X2)
5140 FOR J= 1TO 78
5150 D(0,J)= C+ (J+ S)* T
5160 NEXT
5170 SM(0)= SM+ OS
5180 SY(0)= SY
5190 IF SM(0)> PDTHEN SM(0)= SM(0)- PD:SY(0)= SY(0)+ 1:GOTO 5190
5200 TITLE$(0)= "TREND LINE"
5210 NUM= INT (57/ HS)+ SD
5220 IF X$< > "TRE"THEN RETURN
5230 GOSUB 2230
5240 NUM(0)= NUM
5250 RETURN
5260 REM
5270 IF A$= ""THEN RETURN
5280 X= VAL (A$)
5290 IF X< .01OR X> 1THEN RETURN
5300 D(0,0)= D(0,1)
5310 FOR J= 1TO NUM(0)
5320 D(0,J)= X* D(0,J)+ D(0,J- 1)* (1- X)
5330 NEXT
5340 IF X$< > "SMO"THEN RETURN
5350 TITLE$(0)= "SMOOTHED ("+ STR$ (X)+ ")"
5360 GOSUB 2230
5370 RETURN
5380 REM
5390 IF A$= ""THEN RETURN
5400 X= VAL (A$)
5410 IF X< 2OR X> NUM(0)THEN RETURN
5420 NUM= NUM- X+ 1
5430 SM(0)= SM(0)+ X- 1
5440 IF SM(0)> PDTHEN SM(0)= SM(0)- PD:SY(0)= SY(0)+ 1:GOTO 5440
5450 OS= OS+ X- 1
5460 FOR J= XTO NUM(0)
5470 FOR I= 1TO X- 1
5480 D(0,J- X+ 1)= D(0,J- I+ 1)+ D(0,J- X+ 1)
5490 NEXT I
5500 D(0,J- X+ 1)= D(0,J- X+ 1)/ X
5510 NEXT J
5520 NUM(0)= NUM(0)- X+ 1
5530 TITLE$(0)= STR$ (X)+ " PERIOD MOVING AVERAGE"
5540 GOSUB 2230
5550 RETURN
5560 REM
5570 IF A$= ""OR LEN (A$)< 2THEN RETURN
5580 Q$= LEFT$ (A$,1)
5590 IF Q$< > "+"AND Q$< > "-"AND Q$< > "*"AND Q$< > "/"THEN RETURN
5600 A$= RIGHT$ (A$,LEN (A$)- 1)
5610 X= 5
5620 GOSUB 4660
5630 GOSUB 3450
5635 IF NUM(0)= 0THEN RETURN
5640 S= SM(5)- SM(0)+ (SY(5)- SY(0))* PD
5650 EM= SM(0)+ NUM(0)- 1+ SY(0)* PD
5660 X= SM(5)+ NUM(5)- 1+ SY(5)* PD
5670 IF X< EMTHEN EM= X
5680 IF S> 0THEN SM(0)= SM(5):SY(0)= SY(5)
5690 NUM= EM- (SM(0)+ SY(0)* PD)+ 1
5700 IF S< 0THEN 5790
5710 FOR I= 1TO NUM
5720 IF Q$= "+"THEN D(0,I)= D(5,I)+ D(0,I+ S)
5730 IF Q$= "-"THEN D(0,I)= D(5,I)- D(0,I+ S)
5740 IF Q$= "*"THEN D(0,I)= D(5,I)* D(0,I+ S)
5750 IF Q$= "/"AND D(0,I+ S)= 0THEN D(0,I)= 0:GOTO 5770
5760 IF Q$= "/"THEN D(0,I)= D(5,I)/ D(0,I+ S)
5770 NEXT
5780 GOTO 5860
5790 FOR I= 1TO NUM
5800 IF Q$= "+"THEN D(0,I)= D(5,I- S)+ D(0,I)
5810 IF Q$= "-"THEN D(0,I)= D(5,I- S)- D(0,I)
5820 IF Q$= "*"THEN D(0,I)= D(5,I- S)* D(0,I)
5830 IF Q$= "/"AND D(0,I)= 0THEN D(0,I)= 0:GOTO 5850
5840 IF Q$= "/"THEN D(0,I)= D(5,I- S)/ D(0,I)
5850 NEXT
5860 TITLE$(0)= TITLE$(5)+ " "+ Q$+ " "+ TITLE$(0)
5870 OS= SM(0)- SM+ (SY(0)- SY)* PD
5880 NUM(0)= NUM
5890 RETURN
5900 REM
5910 IF A$= ""THEN RETURN
5920 FILE "R",1,A$,1
5930 PLOT 3,0,31,11,6,1,3,0,31
5940 INPUT "FILE EXISTS. DESTROY OLD FILE? ";Q$
5950 IF Q$< > "Y"THEN FILE "C",1:RETURN
5960 FILE "C",1
5970 PLOT 27,4:PRINT "DEL ";A$;".RND;01":PLOT 27,27
5980 FILE "N",A$,98,4,64
5990 FILE "R",1,+ A$,1
6000 PUT 1,1,1;SM
6010 PUT 1,2,1;SY
6020 PUT 1,3,1;NUM
6030 PUT 1,4,1;PD
6040 FOR I= 5TO 9
6050 Q$= MID$ (TITLE$(0),(I- 5)* 4+ 1,4)
6060 PUT 1,I,1;Q$[4]
6070 NEXT
6080 FOR I= 10TO 14
6090 Q$= MID$ (UNITS$(0),(I- 10)* 4+ 1,4)
6100 PUT 1,I,1;Q$[4]
6110 NEXT
6120 FOR I= 21TO 98
6130 PUT 1,I;D(0,I- 20)
6140 NEXT
6150 FILE "C",1
6160 GOSUB 1090
6170 RETURN
6180 REM
6190 IF A$= ""THEN RETURN
6200 Q$= A$
6210 IF LEFT$ (RIGHT$ (A$,5),1)= ","THEN I= 5:A$= RIGHT$ (A$,4):GOTO 6240
6220 IF LEFT$ (RIGHT$ (A$,6),1)= ","THEN I= 6:A$= RIGHT$ (A$,5):GOTO 6240
6230 RETURN
6240 P$= LEFT$ (Q$,LEN (Q$)- I)
6250 GOSUB 980
6260 IF Q$= ""THEN RETURN
6270 X= VAL (P$)
6280 IF X= 0THEN RETURN
6290 Y= EXP (LOG (1+ X/ 100)/ PD)
6300 S= MO- SM(0)+ (YR- SY(0))* PD
6310 IF S< 0THEN S= 0
6320 SM(0)= SM(0)+ S
6330 IF SM(0)> PDTHEN SM(0)= SM(0)- PD:SY(0)= SY(0)+ 1:GOTO 6330
6340 NUM(0)= NUM(0)- S
6350 YY= 1
6360 FOR J= 1TO NUM(0)
6370 D(0,J)= D(0,J+ S)* YY
6380 YY= YY* Y
6390 NEXT
6400 OS= OS+ S
6410 TITLE$(0)= STR$ (X)+ "% INFLATION"
6420 NUM= NUM(0)
6430 RETURN
6440 REM
6450 IF A$= ""THEN RETURN
6460 IF LEFT$ (RIGHT$ (A$,3),1)< > "/"THEN X= VAL (A$):GOTO 6520
6470 GOSUB 980
6480 IF Q$= ""THEN RETURN
6490 S= MO- SM(0)+ (YR- SY(0))* PD
6500 IF S< 0THEN S= 0
6510 X= D(0,S+ 1)
6520 FOR I= 1TO 78
6530 D(0,I)= X
6540 NEXT
6550 NUM(0)= 78
6560 NUM= INT (57/ HS- OS)
6570 TITLE$(0)= "BASELINE "+ A$
6580 RETURN
6590 REM
6600 IF LEN (A$)< 2THEN RETURN
6610 P$= LEFT$ (A$,1)
6620 IF P$< > "+"AND P$< > "-"AND P$< > "*"AND P$< > "/"THEN RETURN
6630 A$= RIGHT$ (A$,LEN (A$)- 1)
6640 I= 0
6650 I= I+ 1
6660 IF I> 6THEN RETURN
6670 IF LEFT$ (RIGHT$ (A$,I),1)< > ","THEN I= I+ 1:GOTO 6650
6680 C$= LEFT$ (A$,LEN (A$)- I)
6690 A$= RIGHT$ (A$,I- 1)
6700 GOSUB 980
6710 X= VAL (C$)
6720 IF X= 0THEN RETURN
6730 IF Q$= ""THEN RETURN
6740 S= MO- SM(0)+ (YR- SY(0))* PD:IF S< 0THEN S= 0
6750 FOR J= 1TO NUM(0)
6760 IF J< S+ 1THEN 6810
6770 IF P$= "+"THEN D(0,J)= D(0,J)+ X
6780 IF P$= "-"THEN D(0,J)= D(0,J)- X
6790 IF P$= "*"THEN D(0,J)= D(0,J)* X
6800 IF P$= "/"THEN D(0,J)= D(0,J)/ X
6810 NEXT
6820 TITLE$(0)= TITLE$(0)+ " "+ P$+ C$+ " AT "+ A$
6830 RETURN
6840 REM
6850 FOR I= 1TO NUM(0)
6860 X= D(0,I)
6870 D(0,I)= D(0,I+ 1)- D(0,I)
6880 IF X$= "%DI"AND X= 0THEN D(0,I)= 0:GOTO 6900
6890 IF X$= "%DI"THEN D(0,I)= D(0,I)* 100/ X
6900 NEXT
6910 SM(0)= SM(0)+ 1
6920 SY(0)= SY(0)
6930 IF SM(0)> PDTHEN SM(0)= SM(0)- PD:SY(0)= SY(0)+ 1
6940 OS= OS+ 1
6950 TITLE$(0)= "AMOUNT OF CHANGE"
6960 IF X$= "%DI"THEN TITLE$(0)= "% RATE OF CHANGE"
6970 NUM(0)= NUM(0)- 1
6980 NUM= NUM- 1
6990 GOSUB 3850
7000 RETURN
7010 REM
7020 IF A$= ""THEN RETURN
7030 GOSUB 980
7040 IF Q$= ""THEN RETURN
7050 S= MO- SM(0)+ (YR- SY(0))* PD
7060 IF S< 0THEN S= 0
7070 OS= OS+ S
7080 SM(0)= SM+ OS
7090 SY(0)= SY:SUM= 0
7100 IF SM(0)> PDTHEN SM(0)= SM(0)- PD:SY(0)= SY(0)+ 1:GOTO 7100
7110 NUM(0)= NUM(0)- S
7120 FOR I= 1TO NUM(0)
7130 D(0,I)= D(0,I+ S)+ SUM
7140 SUM= D(0,I)
7150 NEXT
7160 GOSUB 3850
7170 TITLE$(0)= "SUMMATION STARTING "+ A$
7180 RETURN
7190 REM
7200 X= VAL (A$)
7210 IF X< = 0THEN RETURN
7220 SM(0)= SM(0)- X
7230 OS= OS- X
7240 IF SM(0)< 1THEN SM(0)= SM(0)+ PD:SY(0)= SY(0)- 1:GOTO 7240
7250 TITLE$(0)= TITLE$(0)+ " (LEAD"+ STR$ (X)+ ")"
7260 RETURN
7270 REM
7280 X= VAL (A$)
7290 IF X< 1THEN RETURN
7300 SM(0)= SM(0)+ X
7310 IF SM(0)> PDTHEN SM(0)= SM(0)- PD:SY(0)= SY(0)+ 1:GOTO 7310
7320 OS= OS+ X
7330 TITLE$(0)= TITLE$(0)+ " (LAG"+ STR$ (X)+ ")"
7340 RETURN
7350 REM
7360 IF A$= ""THEN RETURN
7370 GOSUB 980
7380 IF Q$= ""THEN RETURN
7390 S= MO- SM(0)+ (YR- SY(0))* PD+ 1
7400 IF S< 1OR S> 78THEN RETURN
7410 PLOT 3,0,31,11,6,2,3,0,31
7420 PRINT "VALUE AT ";A$;" IS ";D(0,S);
7430 INPUT "";Q$
7440 RETURN
7450 REM
7460 PLOT 6,3,15,12
7470 PLOT 29
7480 PRINT ""
7490 PRINT "COMMAND      EXAMPLE     n COMMAND           EXAMPLE"
7500 PRINT "ggggggggggggggggggggggggg+gggggggggggggggggggggggggggggggggggg"
7510 PRINT "                         n"
7520 PRINT "AREA         ARE FILE    n "
7530 PRINT "ARITHMETIC   ARI +FILE   n "
7540 PRINT "BARGRAPH     BAR FILE    n "
7550 PRINT "#BAR         #BA FILE    n "
7560 PRINT "BASELINE     BAS 2/80    n "
7570 PRINT "CLEAR        CLE         n "
7580 PRINT "COLOR        COL (KEY)   n "
7590 PRINT "CONSTANT     CON +4,2/80 n "
7600 PRINT "DATABASE     DAT         n "
7610 PRINT "DIFFERENTIAL DIF         n"
7620 PRINT "%DIFF        %DI         n"
7630 PRINT "DIRECTORY    DIR         n "
7635 PRINT "DISK FILE    DIS FILE    n"
7640 PRINT "DRAW         DRA FILE    n"
7650 PRINT "ETREND       ETR 2/80    n "
7660 PRINT "EXPONENTIAL  EXP         n "
7670 PRINT "HELP         HELP        n "
7680 PRINT "HIGH         HIG 100     n"
7690 PRINT "HORIZONTAL   HOR 12      n"
7700 PRINT "INFLATION    INF 14,2/80 n"
7710 PRINT "LAG          LAG         n"
7720 PRINT "LEAD         LEA 3       n"
7730 PRINT "LINGRAPH     LIN FILE    n "
7740 PRINT "LOAD         LOA FILE    n"
7750 PRINT "LOG          LOG         n"
7760 PLOT 3,27,4:PRINT "LOW               LOW -100"
7770 PLOT 3,27,5:PRINT "LTREND            LTR 2/80"
7780 PLOT 3,27,6:PRINT "MOVING AVG        MOV 4"
7790 PLOT 3,27,7:PRINT "NEW               NEW"
7800 PLOT 3,27,8:PRINT "PERIOD M,Q,Y       PER Q"
7810 PLOT 3,27,9:PRINT "PICTURE           PIC NAME"
7820 PLOT 3,27,10:PRINT "REMARK WORDS      REM WORDS"
7830 PLOT 3,27,11:PRINT "SAVE WORKFILE     SAV 1"
7840 PLOT 3,27,12:PRINT "SCATTER GRAPH     SCA FILE"
7850 PLOT 3,27,13:PRINT "SEAONAL ADJ       SEA 1"
7860 PLOT 3,27,14:PRINT "SMOOTH            SMO .2"
7870 PLOT 3,27,15:PRINT "STARTING DATE     STA 2/80
7880 PLOT 3,27,16:PRINT "SUMMATION         SUM 2/80"
7890 PLOT 3,27,17:PRINT "TITLE WORDS       TIT WORDS"
7900 PLOT 3,27,18:PRINT "TREND LINE        TRE 2/80"
7910 PLOT 3,27,19:PRINT "UNITS TITLE       UNI WORDS"
7920 PLOT 3,27,20:PRINT "VALUE             VAL 2/80"
7930 PLOT 3,27,21:PRINT "WORKFILE TITLE    WOR 1"
7940 PLOT 3,35,30,6,1
7950 PRINT "HIT RETURN";
7960 INPUT "";Q$
7970 GOSUB 1090
7980 RETURN
7990 REM
8000 FILE "E",FL,ER,LI
8010 IF LI= 3480THEN PLOT 3,0,31,11,6,1,3,0,31:INPUT "NO SUCH FILE ON DISK. RETURN";Q$:GOTO 300
8020 IF LI= 5920THEN GOSUB 5980:GOTO 300
8025 IF ER= 8THEN PLOT 3,0,31,11,6,1,3,0,31:INPUT "DISK FULL. INSERT NEW DISK. RETURN";Q$:GOSUB 5920:GOTO 300
8030 IF LI= 5980THEN PLOT 3,0,31,11,6,1,3,0,31:INPUT "BAD FILE NAME. RETURN";Q$:GOTO 300
8040 PRINT FL,ER,LI:END
8050 PRINT "LINE 60030
8060 REM
8070 FOR I= 1TO NUM(0)
8080 IF D(0,I)= < 0THEN D(0,I)= 0:GOTO 8100
8090 D(0,I)= LOG (D(0,I))/ LOG (10)
8100 NEXT
8110 TITLE$(0)= "LOG OF "+ TITLE$(0)
8120 RETURN
8130 REM
8140 FOR I= 1TO NUM(0)
8150 IF D(0,I)> 36THEN PLOT 6,1,3,0,31,11,3,0,31:INPUT "NUMBERS TOO LARGE FOR EXP. RETURN.";Q$:I= 78:NEXT :RETURN
8160 D(0,I)= EXP (D(0,I)* LOG (10))
8170 NEXT
8180 TITLE$(0)= "EXP OF "+ TITLE$(0)
8190 RETURN
8200 REM
8210 GOSUB 8060
8220 GOSUB 4980
8230 NUM(0)= NUM
8240 GOSUB 8130
8250 TITLE$(0)= "EXP TREND LINE"
8260 GOSUB 2230
8270 NUM(0)= NUM
8280 RETURN
8290 REM
8300 X= 0
8310 IF SM(0)= 1THEN X= 0:GOTO 8330
8320 X= 5- SM(0)
8330 FOR I= 1TO INT (NUM(0)/ 4)
8340 D(0,I)= D(0,(I- 1)* 4+ 1+ X)+ D(0,(I- 1)* 4+ 2+ X)+ D(0,(I- 1)* 4+ 3+ X)+ D(0,(I- 1)* 4+ 4+ X)
8350 NEXT
8360 PD(0)= 1:NUM(0)= INT (NUM(0)/ 4)
8370 SM(0)= 1
8380 RETURN
8390 REM
8400 FOR I= 19TO 1STEP - 1
8410 FOR J= 0TO 3
8420 D(0,I* 4- J)= D(0,I)/ 4
8430 NEXT J,I
8440 PD(0)= 4:NUM(0)= NUM(0)* 4
8445 IF NUM(0)> 78THEN NUM(0)= 78
8450 SM(0)= 1
8460 RETURN
8470 REM
8480 GOSUB 3670
8490 GOSUB 8290
8500 RETURN
8510 REM
8520 GOSUB 8390
8530 GOSUB 3590
8540 RETURN
8550 REM
8560 FOR I= 1TO NUM(0)
8570 D(0,I)= D(0,I)* D(0,I)
8580 NEXT
8590 GOSUB 4980
8600 NUM(0)= NUM
8610 FOR I= 1TO NUM(0)
8620 IF D(0,I)< = 0THEN D(0,I)= 0:GOTO 8640
8630 D(0,I)= EXP (LOG (D(0,I))/ 2)
8640 NEXT
8650 TITLE$(0)= "LOG TREND LINE"
8660 GOSUB 2230
8670 RETURN
8680 REM
8690 IF A$= ""THEN A$= "1"
8700 X= 5:GOSUB 4660
8710 A$= "SEA"+ A$:GOSUB 3450
8720 FOR I= 1TO 6
8730 FOR J= 1TO 12
8740 D(0,J+ I* 12)= D(0,J)
8750 NEXT J,I
8760 Q$= "*"
8770 NUM(0)= 78
8780 SY(0)= SY(5)
8790 GOSUB 5640
8800 TITLE$(0)= "SEASONALLY ADJUSTED"
8810 RETURN
8820 REM
8830 IF A$= "M"THEN PD= 12:GOTO 8870
8840 IF A$= "Q"THEN PD= 4:GOTO 8870
8850 IF A$= "Y"THEN PD= 1:GOTO 8870
8860 RETURN
8870 GOSUB 1090
8880 GOSUB 3860
8890 RETURN
8900 REM
8910 X= VAL (A$):IF X< .01OR X> 1THEN RETURN
8920 GOSUB 5300
8930 X= 5:GOSUB 4660
8940 X= VAL (A$):GOSUB 5300
8950 FOR J= 1TO NUM(0):D(0,J)= 2* D(5,J)- D(0,J):NEXT
8960 TITLE$(0)= "DOUBLE EXP'L SMOOTHING"+ STR$ (X)
8970 GOSUB 2230:RETURN
8980 REM
8990 X= VAL (A$):IF X< .01OR X> 1THEN RETURN
9000 GOSUB 5300:X= 5:GOSUB 4660
9010 X= VAL (A$):GOSUB 5300
9020 FOR J= 1TO NUM(0):D(5,J)= 3* D(5,J)- D(0,J):NEXT
9030 GOSUB 5300
9040 FOR J= 1TO NUM(0):D(0,J)= D(5,J)- D(0,J):NEXT
9050 TITLE$(0)= "TRIPLE EXP'L SMOOTHING"+ STR$ (X)
9060 GOSUB 2230
9070 RETURN
9100 REM
9110 PLOT 12,6,1,14:PRINT "WARNING! ANYTHING ON DISK WILL BE WIPED OUT DURING"
9120 PRINT :PRINT "INITIALIZATION.  DO YOU WANT TO PROCEDE (Y/N)? ";:INPUT "";Q$
9130 IF MID$ (Q$,1,1)= "Y"THEN PLOT 27,4:PRINT "INI 0:DATADISK 15":PLOT 27,27
9135 GOSUB 1090
9140 RETURN
9200 REM
9210 PLOT 12,6,1,14,3,0,10:PRINT "WARNING! ANYTHING ON DISK 0 WILL BE WIPED OUT DURING"
9220 PRINT :PRINT "FORMATTING.  DO YOU WANT TO PROCEDE (Y/N)? ";:INPUT "";Q$
9221 IF MID$ (Q$,1,1)= "Y"THEN 9224
9222 GOTO 9235
9224 PLOT 6,2,12,3,0,10
9225 PRINT :PRINT "WHEN YOU ARE FINISHED FORMATTING, PRESS THE FOLLOWING KEYS:"
9226 PRINT :PRINT "1)   CPU   RESET   KEY"
9227 PRINT :PRINT "2)  (ESCAPE)  KEY"
9228 PRINT :PRINT "3)   W   KEY"
9229 PRINT :PRINT "4)  AUTO  KEY"
9230 PRINT :PRINT "I WILL LOAD THE DISK FORMATTER IN ONE MOMENT..."
9232 FOR GG= 1TO 4000:NEXT GG
9234 IF MID$ (Q$,1,1)= "Y"THEN PLOT 27,4:PRINT "FORMAT":PLOT 27,27
9235 GOSUB 1090
9240 RETURN
12000 Q$= ""
12010 IF  CH= 241THEN  Q$= "LOAD "
12020 IF CH= 242THEN Q$= "BAR "
12030 IF  CH= 243THEN Q$= "LINE "
12040 IF CH= 244THEN Q$= "SCAT "
12050 IF CH= 245THEN Q$= "HIGH "
12060 IF CH= 246THEN Q$= "LOW "
12070 IF CH= 247THEN Q$= "HOR "
12080 IF CH= 248THEN Q$= "SAVE "
12090 IF CH= 249THEN Q$= "MOV "
12100 IF CH= 250THEN Q$= "SMOOTH "
12110 IF CH= 251THEN Q$= "TREND "
12120 IF CH= 252THEN Q$= "ARITH "
12130 IF CH= 253THEN Q$= "CONST "
12140 IF CH= 254THEN Q$= "DRAW "
12145 IF  Q$< > ""THEN  12155
12148 IF CH= 240THEN Q$= "NEW"
12150 IF CH= 255THEN Q$= "DIR"
12152 PLOT  6,3,3,4,31:PRINT Q$:QQ$= Q$:RETURN
12155 PLOT 6,3
12160 PLOT 3,4,31:PRINT  Q$;:INPUT "";QQ$
12170 QQ$= Q$+ QQ$:RETURN
20000 REM
20010 REM
20020 CLEAR 500
20030 DIM D(200),C$(20)
20040 FILE "T",22770
20050 PLOT 27,24,12,6,2,14
20060 PLOT 3,20,4
20070 PRINT "DATA BASE MENU"
20080 PRINT :PRINT
20090 PLOT 6,6,15
20100 BAUD= 3
20110 POKE 33278,0
20120 PRINT ,,"1.  UPDATE FILE"
20130 PRINT :PRINT ,,"2.  CREATE A NEW FILE"
20140 PRINT :PRINT ,,"3.  EDIT OLD FILE"
20150 PRINT :PRINT ,,"4.  DELETE A FILE"
20160 PRINT :PRINT ,,"5.  HARDCOPY PRINTOUT"
20170 PRINT :PRINT ,,"6.  DIRECTORY OF FILES"
20180 PRINT :PRINT ,,"7.  CHANGE FILE NAME"
20190 PLOT 6,7
20200 PRINT :PRINT ,,"8.  GO TO DISPLAY PROGRAM"
20210 PLOT 6,3
20220 PRINT :PRINT ,,"SELECT...  ";
20230 IF PEEK (33278)= 0THEN 20230
20240 Q$= CHR$ (PEEK (33278))
20250 POKE 33278,13:PRINT :PRINT
20260 Q= VAL (Q$):IF Q= 6THEN PRINT CHR$ (12):PLOT 6,7,27,4:PRINT "DIR ":PLOT 27,27:INPUT "HIT RETURN";X$
20270 IF Q= 7THEN GOTO 22130
20280 IF Q= 8THEN 120
20290 IF Q< 1OR Q> 8THEN 20050
20300 ON QGOTO 21110,20320,21110,21660,21790
20310 GOTO 20050
20320 REM
20330 CF= 1
20340 PLOT 27,24
20350 PLOT 12,6,6,14
20360 PLOT 3,10,4
20370 PRINT "CREATE A NEW FILE":PRINT :PRINT
20380 PLOT 6,6,15
20390 PRINT ,"TITLE     (UP TO 40 CHRS)...":PRINT
20400 PRINT ,"FILE NAME (UP TO 6 CHRS)....":PRINT
20410 PRINT ,"PERIOD    (M,Q,OR Y)........":PRINT
20420 PRINT ,"STARTING DATE (MO/YR).......":PRINT
20430 PRINT ,"UNITS TITLE (UP TO 20 CHRS).":PRINT
20440 PLOT 6,7
20450 FOR I= 1TO 5
20460 PLOT 3,37,11+ (I- 1)* 2
20470 INPUT "";A$(I)
20480 NEXT
20490 PRINT :PRINT
20500 PLOT 6,3
20510 PRINT
20520 PRINT ,"OK TO PROCEED (Y/N)? ";
20530 POKE 33278,0
20540 IF PEEK (33278)= 0THEN 20540
20550 X$= CHR$ (PEEK (33278))
20560 IF LEN (A$(2))= 1AND VAL (A$(2))> 0THEN GOTO 20050
20570 IF X$< > "Y"AND X$< > CHR$ (13)THEN 20320
20580 GOSUB 20590:GOTO 20760
20590 PLOT 12,6,6,14
20600 PRINT A$(1);TAB( 22);"(";A$(5);")";TAB( 40);"";A$(2)
20610 PLOT 30
20620 PLOT 6,4,15,3,0,3
20630 PRINT ""
20640 PLOT 3,0,4
20650 PLOT 27,10
20660 PRINT "aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
20670 PLOT 3,21,4
20680 PRINT "aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
20690 PLOT 3,42,4
20700 PRINT "aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
20710 PLOT 3,63,4
20720 PRINT "aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
20730 PLOT 27,24
20740 RETURN
20750 IF A$(3)< > "Q"THEN A$(3)= "M"
20760 PD= 12:IF A$(3)= "Q"THEN PD= 4
20770 IF A$(3)= "Y"THEN PD= 1
20780 GOSUB 22020
20790 M= 0:N= 1
20800 FOR I= MTO 2
20810 FOR J= NTO 26
20820 PLOT 6,3,3,(I* 22+ 4- LEN (STR$ (SM))),J+ 5
20830 PRINT SM;"/";SY"..."
20840 PLOT 6,6,3,(I* 22+ 13),J+ 5
20850 INPUT "";D$
20860 IF D$= ""THEN ND= I* 26+ J- 1:I= 2:J= 26:GOTO 20890
20870 SM= SM+ 1:IF SM> PDTHEN SM= 1:SY= SY+ 1
20880 D(I* 26+ J)= VAL (D$)
20890 NEXT J:N= 1:NEXT I
20900 PLOT 12
20910 PLOT 6,2,3,10,4,14
20920 PRINT "FILE SUMMARY"
20930 PRINT :PRINT
20940 PLOT 15
20950 PLOT 6,7
20960 PRINT ,"FILE TITLE.........";A$(1):PRINT
20970 PRINT ,"FILE NAME..........";A$(2):PRINT
20980 PRINT ,"PERIOD.............";A$(3):PRINT
20990 PRINT ,"STARTING DATE......";A$(4):PRINT
21000 PRINT ,"NUMBER OF ENTRIES..";ND:PRINT
21010 PRINT ,"UNITS TITLE........";A$(5):PRINT
21020 PLOT 6,3
21030 PRINT :PRINT ,"OK TO SAVE ON DISK? (Y/N) ";
21040 POKE 33278,0
21050 IF PEEK (33278)= 0THEN 21050
21060 X$= CHR$ (PEEK (33278))
21070 PRINT
21080 IF X$< > "Y"AND X$< > CHR$ (13)THEN GOTO 20050
21090 IF CF= 1THEN GOSUB 22510:GOTO 20050
21100 IF Q= 1OR Q= 3THEN GOSUB 22430:GOTO 20050
21110 REM
21120 PLOT 27,24
21130 PLOT 12,6,2,14
21140 PLOT 3,25,6
21150 IF Q= 1THEN PLOT 6,4:PRINT "UPDATE FILE":GOTO 21170
21160 PRINT "FILE EDIT"
21170 PLOT 2,0,0,242,0,127,127,127,127,0,0,0,255
21180 PLOT 3,21,15
21190 PRINT "ENTER FILE NAME...";:INPUT "";X$
21200 IF X$= ""AND A$(2)= ""THEN 20050
21210 IF X$= ""THEN 21240
21220 A$(2)= X$
21230 GOSUB 22860
21240 GOSUB 20590
21250 SM= MO:SY= YR
21260 FOR I= 0TO 2
21270 FOR J= 1TO 26
21280 PLOT 6,3,3,(I* 22+ 4- LEN (STR$ (SM))),J+ 5
21290 M= I:N= J
21300 IF I* 26+ J> NDTHEN I= 2:J= 26:GOTO 21370
21310 PRINT SM;"/";SY;"..."
21320 X= D(I* 26+ J)
21330 PLOT 6,6,3,(I* 22+ 18- LEN (STR$ (X))),J+ 5
21340 PRINT X
21350 SM= SM+ 1
21360 IF SM> PDTHEN SM= 1:SY= SY+ 1
21370 NEXT J,I
21380 IF Q= 1THEN 20800
21390 PLOT 3,47,31
21400 PRINT "               "
21410 PLOT 6,6,3,47,31
21420 PRINT "DATE..";:INPUT "";DA$
21430 IF DA$= ""THEN 20900
21440 PLOT 3,47,31
21450 PRINT "               "
21460 PLOT 3,47,31
21470 PRINT "VALUE..";:INPUT "";X$
21480 IF X$= ""THEN 21390
21490 X= VAL (X$)
21500 YT= VAL (RIGHT$ (DA$,2))
21510 IF LEN (DA$)= 4THEN MT$= LEFT$ (DA$,1):GOTO 21540
21520 IF LEN (DA$)= 5THEN MT$= LEFT$ (DA$,2):GOTO 21540
21530 GOTO 21390
21540 MT= VAL (MT$):IF MT< 1OR MT> PDTHEN 21390
21550 J= MT- MO+ (YT- YR)* PD+ 1
21560 IF J> NDOR J< 1THEN 21390
21570 D(J)= X
21580 I= 0
21590 IF J> 26THEN J= J- 26:I= I+ 1:GOTO 21590
21600 PLOT 6,7
21610 PLOT 3,(I* 22+ 13),J+ 5
21620 PRINT "        "
21630 PLOT 3,(I* 22+ 18- LEN (STR$ (X))),J+ 5
21640 PRINT X
21650 GOTO 21390
21660 REM
21670 PLOT 27,24
21680 PLOT 12,6,1,14,3,26,6
21690 PLOT 2,0,0,242,0,127,127,127,127,0,0,0,255
21700 PRINT "DELETE FILE"
21710 PLOT 3,23,15,6,6
21720 PRINT "ENTER FILE NAME...";:INPUT "";X$
21730 IF X$= ""THEN GOTO 20050
21740 PLOT 27,4
21750 PRINT "DEL ";X$;".RND;01"
21760 PRINT "DEL ";X$;".DSP;01"
21770 PLOT 27,27
21780 GOTO 20050
21790 REM
21800 PLOT 27,24,12,6,5,14,3,24,6
21810 PLOT 2,0,0,242,0,127,127,127,127,0,0,0,255
21820 PRINT "HARDCOPY PRINTOUT"
21830 PLOT 3,23,15,6,6
21840 PRINT "ENTER FILE NAME...";:INPUT "";X$
21850 IF X$= ""AND A$(2)= ""THEN GOTO 20050
21860 IF X$= ""THEN 21890
21870 A$(2)= X$
21880 GOSUB 22860
21890 PLOT 27,18,BAUD:POKE 33265,14:REM  SETUP PRINTER
21900 PRINT :PRINT :PRINT :PRINT :PRINT
21910 PRINT TAB( 20);"FILE NAME...";A$(2);TAB( 40);"TITLE...";A$(1)
21920 PRINT :PRINT :PRINT
21930 SM= MO:SY= YR
21940 FOR L= 1TO ND
21950 PRINT SM;"/";SY;"...";TAB( 15);D(L)
21960 SM= SM+ 1
21970 IF SM> PDTHEN SM= 1:SY= SY+ 1
21980 NEXT
21990 POKE 33265,0
22000 PLOT 27,12
22010 GOTO 20050
22020 REM
22030 X$= LEFT$ (A$(4),2)
22040 IF VAL (X$)< 1OR VAL (X$)> PDOR VAL (RIGHT$ (A$(4),3))< > 0OR LEN (A$(4))> 5THEN GOTO 22060
22050 GOTO 22070
22060 PRINT :PRINT ,"BAD DATE. HIT  RETURN TO RESTART";:INPUT "";X$:GOTO 20050
22070 IF LEN (A$(4))= 4THEN MO$= LEFT$ (A$(4),1)
22080 IF LEN (A$(4))= 5THEN MO$= LEFT$ (A$(4),2)
22090 YR= VAL (RIGHT$ (A$(4),2))
22100 MO= VAL (MO$)
22110 SY= 1900+ YR:SM= MO
22120 RETURN
22130 REM
22140 PLOT 6,7,12,14,3,25,6
22150 PLOT 2,0,0,242,0,127,127,127,127,0,0,0,255
22160 PRINT "CHANGE FILE NAME"
22170 PLOT 3,23,15,6,6
22180 INPUT "ENTER OLD FILE NAME...";X$
22190 IF X$= ""THEN GOTO 20050
22200 PLOT 3,23,22
22210 INPUT "ENTER NEW FILE NAME...";Q$
22220 IF Q$= ""THEN 20050
22230 IF LEN (Q$)= 1AND VAL (Q$)> 0THEN 20050
22240 PLOT 27,4
22250 PRINT "REN ";X$;".RND;01 TO ";Q$;".RND;01"
22260 PLOT 27,27
22270 GOTO 20050
22280 REM
22430 REM
22440 FILE "R",1,A$(2),1
22450 FOR L= 1TO ND
22460 PUT 1,L+ 20,1;D(L)
22470 NEXT L
22480 PUT 1,3,1;ND
22490 FILE "C",1
22500 RETURN
22510 REM
22520 FILE "R",1,A$(2),1
22530 PLOT 6,1:PRINT ,,"FILE ALREADY EXISTS!":PRINT :INPUT "KILL OLD FILE? (Y/N) ";Q$
22540 IF Q$< > "Y"THEN FILE "C",1:RETURN
22550 FILE "C",1
22560 PLOT 27,4:PRINT "DEL ";A$(2)+ ".RND;01"
22570 FILE "N",A$(2),120,4,64
22580 FILE "R",1,A$(2),1
22590 PUT 1,1,1;MO
22600 PUT 1,2,1;YR
22610 PUT 1,3,1;ND
22620 PUT 1,4,1;PD
22630 FOR I= 5TO 9
22640 X$= MID$ (A$(1),(I- 5)* 4+ 1,4)
22650 PUT 1,I,1;X$[4]
22660 NEXT
22670 FOR I= 10TO 14
22680 X$= MID$ (A$(5),(I- 10)* 4+ 1,4)
22690 PUT 1,I,1;X$[4]
22700 NEXT
22710 FOR I= 21TO 120
22720 PUT 1,I;D(I- 20)
22730 NEXT
22740 FILE "C",1
22750 CF= 0
22760 RETURN
22770 REM
22780 LI= 0
22790 FILE "E",FL,ER,LI
22800 IF LI< > 22870THEN 22820
22810 PLOT 6,1:PRINT :PRINT :PRINT ,,"NO SUCH FILE ON DISK. RETURN";:INPUT "";Q$
22820 IF LI= 22520THEN GOSUB 22570:GOTO 20050
22830 IF ER= 8THEN PLOT 6,1:PRINT :PRINT ,"DISK FULL.  INSERT ANOTHER DATA DISK.  HIT RETURN";:INPUT "";Q$:GOSUB 22520:GOTO 20050
22840 IF LI= 22570THEN PLOT 6,1:PRINT :PRINT ,,"BAD FILE NAME. RETURN";:INPUT "";Q$
22850 GOTO 20050
22860 REM
22870 FILE "R",1,A$(2),1
22880 GET 1,1,1;MO
22890 GET 1,2,1;YR
22900 GET 1,3,1;ND
22910 GET 1,4,1;PD
22920 A$(1)= "":A$(5)= ""
22930 FOR I= 5TO 9
22940 GET 1,I,1;T$[4]
22950 A$(1)= A$(1)+ T$
22960 NEXT
22970 FOR I= 10TO 14
22980 GET 1,I,1;T$[4]
22990 A$(5)= A$(5)+ T$
23000 NEXT
23010 FOR I= 21TO 20+ ND
23020 GET 1,I,1;D(I- 20)
23030 NEXT
23040 FILE "C",1
23050 A$(3)= "MONTHLY"
23060 IF PD= 4THEN A$(3)= "QUARTERLY"
23070 IF PD= 1THEN A$(3)= "YEARLY"
23080 SM= MO:SY= YR
23090 I= 1
23100 IF LEFT$ (RIGHT$ (A$(1),I),1)= " "THEN I= I+ 1:IF I< LEN (A$(1))THEN GOTO 23100
23110 A$(1)= LEFT$ (A$(1),LEN (A$(1))- I+ 1)
23120 I= 1
23130 IF LEFT$ (RIGHT$ (A$(5),I),1)= " "THEN I= I+ 1:IF I< LEN (A$(5))THEN 23130
23140 A$(5)= LEFT$ (A$(5),LEN (A$(5))- I+ 1)
23150 RETURN