home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
COMMODOR
/
DISKALC.PRG
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2000-06-30
|
7KB
|
268 lines
1 REM**********************************
2 REM CONVERTED TO WORK WITH DISK DRIVE BY :
3 REM SEAN ROONEY. MISSISSAUGA, ONT. CANADA. DEC27,1983.
4 REM**********************************
5 REM QUIT OPTION ON MAIN MENU ADDED:
6 REM JANUARY1,1984. BY SEAN ROONEY
8 POKE53280,0:POKE53281,0
9 DIMV(15,60),X$(50),V$(15,60):CR$="[147]":CT$="[159] ******* CALCULATING *******[154]"
10 PRINT"[142][147][159]**D I S K A L C-64** ":C%=1:R%=1
20 PRINT"[154] V[154]IEW COLUMNS
30 [153]" ECONTNTER DATA
40 PRINT" D[154]O CALCULATIONS
50 [153]" ZCONTERO MATRIX
60 PRINT" G[154]ET DATA FROM DISK
70 [153]" SCONTAVE DATA ON DISK
80 PRINT" M[154]EMORY CHECK
85 [153]" PCONTRINT DATA ON PRINTER"
90 [153]" QCONTUIT THE PROGRAM"
95 [153]"OPENWHAT IS YOUR CHOICE ?":Y[178]0
96 [161]AN$:[139]AN$[178]""[167]96
97 [129]X[178]1[164]9:[139]AN$[178][202]("VEDZGSMPQ",X,1)[167]Y[178]X
98 [130]:[145]Y[141]230,1000,2020,120,702,802,940,12010,12239:[137]10
120 [153]CR$:[129]X[178]1[164]15
130 [129]Y[178]1[164]50
140 V(X,Y)[178]0
150 [130]Y
160 [130]X
165 [142]
190 [133]"LOADENTER COLUMN (1 TO 13):";C%
200 [139]C%[179]1[176]C%[177]13[167][153]"LOAD";:[137]190
210 [153]:[133]"ENTER ROW (1 TO 31):";R%
220 [139]R%[179]1[176]R%[177]31[167]210
230 [153]"LOAD";:[141]500
240 [153]"";
250 [129]Y[178]R%[164]R%[170]19
260 [153][163]9);
270 [129]X[178]C%[164]C%[170]2
280 X$[178][196](V(X,Y))
290 [153][166]10[171][195](X$));X$;
300 [130]
310 [153][199](13);
320 [130]
325 [153]" ";
330 [153]"UCONTP DCONTOWN LCONTEFT RCONTIGHT JCONTUMP MCONTENU";
340 [161]C$:[139]C$[178]""[167]340
360 [139]C$[178]"U"[167]R%[178]R%[171]10:[153][199](13);"";:[137]220
380 [139]C$[178]"D"[167]R%[178]R%[170]10:[153][199](13);"";:[137]220
400 [139]C$[178]"L"[167]C%[178]C%[171]2:[137]470
420 [139]C$[178]"R"[167]C%[178]C%[170]2:[137]470
440 [139]C$[178]"J"[167]190
450 [139]C$[178]"M"[167]10
460 [137]340
470 [139]C%[179]1[176]C%[177]13[167][153][199](13);:[137]190
480 [137]230
500 [153][163]9);
510 [129]I[178]1[164]3
520 [153]"CONT COLUMNWAIT";
530 [130]
540 [153][199](13);[163]9);
550 [129]I[178]C%[164]C%[170]2
560 S%[178]7:[139]I[179]10[167]S%[178]8
570 [153][166]S%);"";[196](I);"WAIT";
580 [130]
590 [153][199](13);
600 [129]I[178]R%[164]R%[170]19
610 S$[178]"":[139]I[179]10[167]S$[178]" "
620 [153][163]2);"CONTROW"S$[196](I);"WAITOPEN"
630 [130]
640 [142]
702 [133]"LOADWHAT IS NAME OF FILE YOU WANT";FL$
710 [153]"LOADLOOKING FOR ";FL$
720 [159]1,8,0,(FL$)
725 [153]"FOUND ";FL$;" .....LOADING"
730 [129]X[178]1[164]12
740 [129]Y[178]1[164]49
750 [132]1,V(X,Y)
760 [130]Y
770 [130]X
780 [206]#1:[153]"OK.....GOT DATA"
790 [129]I[178]1[164]1000:[130]I
795 [142]
802 [133]"LOADWHAT NAME FOR THIS FILE";FL$
840 [159]1,8,1,(FL$)
850 [129]X[178]1[164]12
860 [129]Y[178]1[164]49
870 [152]1,V(X,Y)
880 [130]Y
890 [130]X
900 [130]#1:[153]"OK.....DATA ON DISK"
910 [129]I[178]1[164]1000:[130]I
920 [142]
940 [153]" "[184](A)"BYTES FREE
950 FORI=1TO1000:NEXTI
960 RETURN
1000 PRINT"[147]":PRINT
1010 INPUT"WHICH COLUMN (1-12)";K$
1020 CL=VAL(K$):IFCL<1ORCL>12THEN1000
1030 IFCL=13ORCL=14ORCL=15THENPRINT"RESERVED FOR TOTALS":GOTO1010
1040 INPUT"HOW MANY ROWS (1-50)";K$
1050 K=VAL(K$):IFK>50ORK<1THEN1040
1060 PRINT:PRINT"ROW","CURRENT","COLUMN";CL
1070 FORY=1TOK
1080 PRINT:PRINTY,V(CL,Y),:INPUT"[157][157][157][157][157][157][157][157][157][157][157]";V:V(CL,Y)=V
1090 NEXTY
1100 PRINT"C[154] FOR ANOTHER COLUMN M[154] FOR MENU
1110 [161]D$:[139]D$[178]""[167]1110
1120 [139]D$[178]"C"[167]1000
1130 [142]
2020 [153]"LOADOPENYOU MAY CHOOSE ANY OF THE FOLLOWING"
2030 [153]" 1CONT SUM DOWN COLUMNS
2040 PRINT" 2[154] SUM ACROSS ROWS
2050 [153]" 3CONT REPRODUCE ANY COLUMN
2060 PRINT" 4[154] ADD-MULT-DIV-SUB AT ANY POINT
2070 [153]" 5CONT AVERAGE ACROSS ROWS (DO 2WAIT FIRST)
2080 PRINT" 6[154] MAKE ROW % OF BASE ROW
2090 [153]" 7CONT MAKE COLUMN % OF BASE COLUMN
2100 PRINT" 8[154] SUM INDIVIDUAL COLUMNS
2110 [153]" 9CONT SERIES OF CALCULATIONS
2120 PRINT" M[154] RETURN TO MENU
2121 [153]"OPEN TAB(TAB(TAB(TAB(TAB(TAB( TAB(TAB( TAB(TAB(TAB(TAB(
3500 PRINT"WHICH ONE ?";
3510 WAIT198,7:GETAN$:IFAN$=""THEN3510
3515 IFAN$="M"THENRETURN
3520 ONVAL(AN$)GOSUB4001,5010,6010,7010,8010,9010,10010,11010,11510
3530 GOTO2020
4001 PRINT"[147]DO YOU WISH TO DESIGNATE THE ROWS TO BE SUMMED?"
4002 GETA$:IFA$=""THEN4002
4003 IFA$="N"THENS1=1:S2=49:GOTO4005
4004 INPUT"FIRST ROW";S1:INPUT"LAST ROW";S2:IFS1>S2ORS1<0ORS2>49THEN4001
4005 PRINTCR$;CT$:PRINT"SUM WILL BE STORED IN ROW"S2+1
4010 FORX=1TO14
4020 V(X,S2+1)=0
4030 NEXTX
4040 FORX=1TO14
4050 FORY=S1TOS2
4060 V(X,S2+1)=V(X,S2+1)+V(X,Y)
4070 NEXTY
4080 NEXTX
4090 RETURN
5010 PRINTCR$;CT$:PRINT"SUM WILL BE STORED IN COLUMN 13
5020 [129]Y[178]1[164]48
5030 V(13,Y)[178]0
5040 [130]Y
5050 [129]Y[178]1[164]48
5060 [129]X[178]1[164]12
5070 V(13,Y)[178]V(13,Y)[170]V(X,Y)
5080 [130]X
5090 [130]Y
5100 [142]
6010 [133]"LOADDUPLICATE WHICH COLUMN";CX
6015 [133]"PUT IT IN WHICH COLUMN";X
6030 [129]Y[178]1[164]50
6040 V(X,Y)[178]V(CX,Y)
6050 [130]Y
6060 [142]
7010 Y[178]0
7020 [153]"LOADAWAITDD MWAITULTIPLY SWAITUBTRACT DWAITIVIDE
7030 GETA$:IFA$=""THEN7030
7040 FORX=1TO4:IFA$=MID$("AMSD",X,1)THENY=X
7050 NEXT:ONYGOTO7070,7130,7190,7250:GOTO7030
7070 INPUT"[147]AMOUNT TO ADD";AD
7080 INPUT"WHAT COL #";X
7090 INPUT"WHAT ROW #";Y
7100 V(X,Y)=V(X,Y)+AD
7110 GOTO7999
7130 INPUT"[147]AMOUNT TO MULTIPLY BY";ML
7140 INPUT"WHAT COL #";X
7150 INPUT"WHAT ROW #";Y
7160 V(X,Y)=V(X,Y)*ML
7170 GOTO7999
7190 INPUT"[147]AMOUNT TO SUBTRACT";SB
7200 INPUT"WHAT COL #";X
7210 INPUT"WHAT ROW #";Y
7220 V(X,Y)=V(X,Y)-SB
7230 GOTO7999
7250 INPUT"[147]AMOUNT TO DIVIDE BY";DV
7260 INPUT"WHAT COL #";X
7270 INPUT"WHAT ROW #";Y
7280 V(X,Y)=V(X,Y)/DV
7290 V(X,Y)=INT(V(X,Y)*1000+.5)/1000
7300 GOTO7999
7999 RETURN
8010 INPUT"[147]HOW MANY ITEMS IN EACH ROW";AVE
8020 PRINTCR$;CT$:PRINT"AVERAGE WILL BE STORED IN COLUMN 14
8030 [129]Y[178]1[164]50
8035 [139]V(13,Y)[178]0[167]8050
8040 V(14,Y)[178]V(13,Y)[173]AVE:V(14,Y)[178][181](V(14,Y)[172]1000[170].5)[173]1000
8050 [130]Y
8060 [142]
9010 [133]"LOADWHICH IS BASE ROW";BR
9020 [133]"WHICH IS ROW FOR PERCENTAGES";Y:[139]BR[178]Y[167][142]
9030 [129]X[178]1[164]13
9055 [139]V(X,BR)[178]0[167]9075
9060 V(X,Y)[178]V(X,Y)[173]V(X,BR):V(X,Y)[178][181](V(X,Y)[172]10000[170].5)[173]100
9075 [130]X
9080 [142]
10010 [133]"LOADWHICH IS BASE COLUMN";CX
10020 [133]"WHICH IS COLUMN FOR PERCENTAGES";X:[139]X[178]CX[167][142]
10030 [129]Y[178]1[164]50
10055 [139]V(CX,Y)[178]0[167]10075
10060 V(X,Y)[178]V(X,Y)[173]V(CX,Y):V(X,Y)[178][181](V(X,Y)[172]10000[170].5)[173]100
10075 [130]Y
10080 [142]
11010 [153]"LOADWHICH COLUMN DO YOU WANT TO SUM";
11020 [133]CA:[139]CA[179]1[176]CA[177]15[167]11020
11030 [153]"WWAITHOLE COLUMN OR PWAITART OF COLUMN?"
11040 [161]YN$:[139]YN$[179][177]"P"[175]YN$[179][177]"W"[167]11040
11050 [139]YN$[178]"P"[167][141]11210:[137]11065
11060 S1[178]1:S2[178]49
11065 V(CA,S2[170]1)[178]0
11070 [129]Y[178]S1[164]S2
11080 V(CA,S2[170]1)[178]V(CA,S2[170]1)[170]V(CA,Y)
11090 [130]Y
11100 [142]
11210 [133]"ROW OF FIRST ITEM IN THE SUM";S1
11215 [133]"ROW OF LAST ITEM IN THE SUM";S2:[139]S1[177]S2[176]S1[179]0[176]S2[177]49[167]11210
11220 [142]
11510 [153]:[153]"ONONONONONONHOW MANY CALCULATIONS (1-8)?"
11515 [129]I[178]1[164]5:[153]" ":[130]
11520 [161]NM$:[139]NM$[178]""[167]11520
11525 [139][197](NM$)[179]0[176][197](NM$)[177]8[167]11520
11530 NM[178][197](NM$):[139]NM[178]0[167][142]
11540 [153]"ONONONONONONENTER OPERATIONS IN THE ORDER YOU WANT THEM TO BE PERFORMED."
11550 [129]I[178]1[164]NM
11560 [153]"ENTER OPERATION #"I"CMD CMDCMDCMDCMDCMDCMDCMDCMD";
11570 [161]A$:OP(I)[178][197](A$):[139]OP(I)[179]1[176]OP(I)[177]8[167]11570
11575 [153]OP(I)
11580 [130]I
11590 [129]I[178]1[164]NM
11600 [145]OP(I)[141]4001,5010,6010,7010,8010,9010,10010,11010
11610 [130]I
11620 [142]
12010 [153]"LOADMAKE SURE PRINTER IS ON.":[153]"...HIT ANY KEY WHEN READY."
12020 [161]A$:[139]A$[178]""[167]12020
12030 [153]"DO YOU WANT TO DESIGNATE THE ROWS TO BE PRINTED?"
12040 [161]A$:[139]A$[178]""[167]12040
12050 [139]A$[178]"N"[167]S1[178]1:S2[178]50:[137]12070
12060 [133]"FIRST ROW TO BE PRINTED";S1:[133]"LAST ROW TO BE PRINTED";S2
12070 SP$[178]" "
12080 [159]4,4
12100 [152]4," COLUMNS ";:[129]I[178]1[164]5:[152]4,I;" ";:[130]
12110 [152]4
12120 [129]Y[178]S1[164]S2
12130 [152]4,[200]("ROW"[170][196](Y)[170]SP$,10);
12135 [129]I[178]1[164]5:[152]4,[201](SP$[170][196](V(I,Y)),14);:[130]I:[152]4
12140 [130]Y:[152]4:[152]4
12150 [152]4," COLUMNS ";:[129]I[178]6[164]10:[152]4,I;" ";:[130]
12155 [152]4
12160 [129]Y[178]S1[164]S2
12170 [152]4,[200]("ROW"[170][196](Y)[170]SP$,10);
12175 [129]I[178]6[164]10:[152]4,[201](SP$[170][196](V(I,Y)),14);:[130]I:[152]4
12180 [130]Y:[152]4:[152]4
12190 [152]4," COLUMNS ";:[129]I[178]11[164]15:[152]4,I;" ";:[130]
12195 [152]4
12200 [129]Y[178]S1[164]S2
12210 [152]4,[200]("ROW"[170][196](Y)[170]SP$,10);
12215 [129]I[178]11[164]15:[152]4,[201](SP$[170][196](V(I,Y)),14);:[130]I:[152]4
12220 [130]Y
12230 [152]4:[142]
12239 [158]58692
12240 [133]"ARE YOU SURE? Y/NWAIT";ZA$
12245 [139]ZA$[178]"N"[167] [137]10
12246 [139]ZA$[178]"Y"[167] [137]12250[178]
12250 [133]" NOW YOU'RE COMPLETELY SURE? Y/NWAIT";ZB$
12255 [139] ZB$[178]"Y"[167] [137]13000
12260 [139] ZB$[178]"N"[167] [137]10
13000 [153]"WELL GOOD-BY THEN,":[158]64738