Compucolor.org – Virtual Media

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

100 OUT 8,255:OUT 8,247
110 GOTO 2820
120 CLEAR 2000:DIM A$(8)
130 AU= 0
140 BA= 0
150 DV(1)= 10:DV(2)= 100:DV(3)= 1000:DV(4)= 10000:DV(5)= 100000:DV(6)= 1000000
160 PLOT 6,2,12,27,24,15
170 GOSUB 210
180 GOTO 1110
190 PLOT 6,2,15
200 END
210 REM  HK
220 PLOT 15,6,6,3,15,31
230 PRINT "COPYRIGHT 1979 BY DONALD R MILLER"
232 PLOT 15,6,4,3,20,30
234 PRINT "ENTER @ FOR AUDIT TRAIL"
240 X= 21
250 PLOT 3,X,0
260 PRINT "                      "
270 PLOT 3,X,1
280 PRINT "    COMPUCOLOR  II    "
290 PLOT 3,X,2
300 PRINT "                      "
310 PLOT 3,X,3
320 PRINT "                      "
330 PLOT 3,X+ 2,2:PRINT "OFF"
340 PLOT 3,X+ 2,3:PRINT " Q "
350 PLOT 3,X,4
360 PRINT "                      "
370 PLOT 3,X,5
380 PRINT "  MC   MR   M-   M+   "
390 PLOT 3,X,6
400 PRINT "                      "
410 PLOT 3,X,7
420 PRINT "                      "
430 PLOT 3,X,8
440 PRINT "                      "
450 PLOT 3,X,9
460 PRINT "       CS    %   DIV  "
470 PLOT 3,X,10
480 PRINT "                      "
490 PLOT 3,X,11
500 PRINT "                      "
510 PLOT 3,X,12
520 PRINT "                      "
530 PLOT 3,X,13
540 PRINT "                      "
550 PLOT 3,X,14
560 PRINT "                      "
570 PLOT 3,X,15
580 PRINT "                      "
590 PLOT 3,X,16
600 PRINT "                      "
610 PLOT 3,X,17
620 PRINT "                      "
630 PLOT 3,X,18
640 PRINT "                      "
650 PLOT 3,X,19
660 PRINT "                      "
670 PLOT 3,X,20
680 PRINT "                      "
690 PLOT 3,X,21
700 PRINT "                   ;  "
710 PLOT 3,X,22
720 PRINT "                      "
730 PLOT 3,X,23
740 PRINT "                      "
750 PLOT 3,X,24
760 PRINT "                      "
770 PLOT 3,X,25
780 PRINT "  CE              =   "
790 PLOT 3,X,26
800 PRINT "                      "
810 PLOT 3,X,27
820 PRINT "                      "
830 PLOT 3,X,28
840 PRINT "                 CC2  "
850 PLOT 3,X,29
860 PRINT "                      "
870 PLOT 3,X,30
880 GOSUB 890:GOTO 920
890 PLOT 6,36
900 PLOT 2,2* X,8,242,2* X,127,2* X+ 42,127,2* X+ 42,8,2* X,8,255
910 RETURN
920 PLOT 14
930 PLOT 3,X+ 3,7
940 PRINT "Z    R    N    A"
950 PLOT 3,X+ 3,11
960 PRINT "C    S    P    /"
970 PLOT 3,X+ 3,15
980 PRINT "7    8    9    X"
990 PLOT 3,X+ 3,19
1000 PRINT "4    5    6    -"
1010 PLOT 3,X+ 3,23
1020 PRINT "1    2    3    +"
1030 PLOT 3,X+ 3,27
1040 PRINT "E    0    .   RET"
1050 PLOT 6,1
1060 PLOT 3,X+ 13,3,14
1070 PRINT "0."
1080 PLOT 6,2
1090 XX= X
1100 RETURN
1110 REM  CALCULATE
1120 X= BA:Y= 0
1130 PLOT 3,64,0
1140 OUT 8,255
1150 Q= CALL (25)
1160 OUT 8,247
1170 IF Q= - 1THEN 1220
1180 IF AU= 0THEN 1200
1190 PLOT 6,5,15,3,X,Y
1200 GOSUB 1270
1210 GOTO 1130
1220 X1= X:X= XX:PLOT 6,9:GOSUB 900
1230 FOR L1= 0TO 999:NEXT L1
1240 GOSUB 890
1250 PLOT 6,2,15,3,0,31,11
1260 X= X1:GOTO 1130
1270 REM  CONVERT INPUT
1280 SW= 0
1300 IF Q< 58AND Q> 47THEN 1500
1310 IF Q= 43OR Q= 59THEN Q$= "+":SR$= "+":SW= 1:S6= 1:GOTO 1910
1320 IF Q= 46THEN 1480
1330 IF Q= 13OR Q= 61THEN Q$= "=":SW= 1:SN= 1:GOTO 1910
1340 IF Q= 47THEN Q$= "DV":SR$= "DV":SW= 1:S3= 1:GOTO 1910
1350 IF Q= 88OR Q= 42THEN Q$= "X":SR$= "X":SW= 1:GOTO 1910
1360 IF Q= 45THEN Q$= "-":SR$= "-":SW= 1:S5= 1:GOTO 1910
1370 IF Q= 69THEN Q$= "CE":SW= 1:GOTO 1910
1380 IF Q= 67THEN Q$= "C":SW= 1:AC= 0:GOTO 1910
1390 IF Q= 83THEN Q$= "CS":SW= 1:GOTO 1910
1400 IF Q= 80OR Q= 37THEN Q$= "%":SW= 1:GOTO 1910
1410 IF Q= 81THEN Q$= "Q":GOTO 1910
1420 IF Q= 90THEN Q$= "MC":SW= 1:MM= 0:GOTO 1910
1430 IF Q= 82THEN Q$= "MR":SW= 1:AC= MM:GOTO 1910
1440 IF Q= 78THEN Q$= "M-":SW= 1:MM= MM- AC:GOTO 1910
1450 IF Q= 65THEN Q$= "M+":SW= 1:MM= MM+ AC:GOTO 1910
1460 IF Q= 64THEN AU= 1:RETURN
1470 RETURN
1480 IF S8= 1THEN 1470
1490 S8= 1:Q$= ".":GOTO 1730
1500 Q$= CHR$ (Q)
1510 IF SN= 1THEN SN= 0:PA= 0:SR= 0:SR$= " ":DC= 0
1520 T1= 1
1530 X= X+ 1
1540 CC= CC+ 1
1550 IF S9= 1THEN RETURN
1560 IF CC> 5THEN S9= 1
1570 N= VAL (Q$)
1580 IF AU= 0THEN 1600
1590 PRINT Q$
1600 IF S8= 1THEN 1620
1610 IF CC= 1AND N= 0THEN CC= 0:RETURN
1620 IF CC= 1THEN FOR L1= 1TO 6:N(L1)= 0:NEXT L1
1630 FOR L1= CCTO 2STEP - 1
1640 N(L1)= N(L1- 1)
1650 NEXT L1
1660 N(1)= N
1700 GOSUB 2520
1710 GOSUB 3190
1720 GOTO 2290
1730 DC= 6- CC
1740 IF AU= 0THEN 2290
1750 X= X+ 1:PRINT "."
1760 GOTO 2160
1770 GOSUB 1850:GOTO 2160
1780 AA= MM:BF= DC:CF= CC:GOSUB 3070
1790 GOSUB 1840:CC= CE
1800 AC= MM:DC= BC
1810 GOSUB 2620
1820 DC= BF:CC= CF
1830 GOTO 2160
1840 REM
1850 FOR L1= 1TO 6:N(L1)= 0:NEXT L1
1860 PLOT 6,1,14,3,XX+ 7,3
1870 PRINT "      0.":DC= 0
1880 RETURN
1890 IF Q$= "DV"OR Q$= "X"OR Q$= "-"OR Q$= "+"THEN PA= 0
1900 GOTO 1920
1910 CC= 0:S9= 0:S8= 0:IF SN= 1THEN 1890
1920 IF Q$< > "="THEN SN= 0:DC= 0
1930 IF Q$= "DV"OR Q$= "X"OR Q$= "-"OR Q$= "+"THEN 3080
1940 IF Q$= "%"THEN 1960
1950 IF Q$< > "="THEN SR= 0
1960 IF T1= 1THEN T1= 0:GOSUB 3050
1970 IF AU= 0THEN 1990
1980 PLOT 6,6,15,3,BA,Y:PRINT Q$:GOSUB 2170
1990 IF Q$< > "="THEN 2090
2000 IF SR$= "+"THEN AC= SR+ AC:IF S6= 1THEN S6= 0:SR= AC- SR
2010 IF SR$= "-"THEN 2050
2020 IF SR$= "DV"THEN 2070
2030 IF SR$= "X"THEN AC= SR* AC
2040 GOSUB 3050:GOTO 2390
2050 IF S5= 1THEN S5= 0:SU= AC:AC= SR- AC:SR= SU:GOTO 2040
2060 AC= AC- SR:GOTO 2040
2070 IF S3< > 1THEN 2080
2072 S3= 0
2074 IF AC= 0THEN 2040
2076 SU= AC:AC= SR/ AC:SR= SU
2078 GOTO 2040
2080 AC= AC/ SR:GOTO 2040
2090 IF SW= 1THEN GOSUB 3050
2100 IF Q$= "C"THEN PA= 0:GOTO 1770
2110 IF Q$= "CE"THEN 1770
2120 IF Q$= "MC"THEN 2160
2130 IF Q$= "MR"THEN PA= 0:GOTO 1780
2140 IF Q$= "CS"THEN 2380
2150 IF Q$= "%"THEN 2250
2160 GOSUB 2170:GOTO 2290
2170 IF Y< 30THEN 2240
2180 IF X= 0THEN X= 10:GOSUB 2280:GOTO 2220
2190 IF X= 10THEN X= 44:GOSUB 2280:GOTO 2220
2200 IF X= 44THEN X= 54:GOSUB 2280:GOTO 2220
2210 IF X= 54THEN X= 0:GOSUB 2280
2220 Y= 0
2230 BA= X
2240 RETURN
2250 AC= AC/ 100* SR:AA= AC
2260 BF= DC:CF= CC:GOSUB 3070
2270 GOTO 2390
2280 PLOT 6,2,15:FOR L1= 0TO 29:PLOT 3,X,L1:PRINT "          ":NEXT L1:RETURN
2290 IF Q$= "Q"THEN 2450
2300 REM
2370 RETURN
2380 AC= - 1* AC
2390 PA= 0
2400 AA= AC:BF= DC:CF= CC:GOSUB 3070
2410 GOSUB 1840
2420 CC= CE:DC= BC:GOSUB 2620
2430 DC= BF:CC= CF
2440 GOTO 2160
2450 REM
2460 PLOT 14,3,XX+ 7,3
2470 PRINT "        "
2480 PLOT 6,2,27,11,15
2490 OUT 8,255
2500 LOAD "MENU":RUN
2510 END
2520 REM
2530 IF DC< > 0THEN 2560
2540 AC= (N(6)* 100000)+ (N(5)* 10000)+ (N(4)* 1000)+ (N(3)* 100)+ (N(2)* 10)+ (N(1))
2550 RETURN
2560 BC= DC:DC= DC- (6- CC)
2570 IF DC> 6OR DC< 1THEN DC= BC:GOTO 2540
2580 AC= N(6)* (100000/ DV(DC))+ N(5)* (10000/ DV(DC))+ N(4)* (1000/ DV(DC))+ N(3)* (100/ DV(DC))
2590 AC= AC+ N(2)* (10/ DV(DC))+ N(1)* (1/ DV(DC))
2600 DC= BC
2610 RETURN
2620 REM
2630 PLOT 14,6,1,3,XX+ 6,3
2640 PRINT "        .      "
2650 PLOT 6,1
2660 AD= 0:IF DC< > 0THEN AD= 1
2670 IF AC= 0THEN PLOT 3,XX+ 7,3:PRINT "      0.":GOTO 2720
2680 IF DC= - 9THEN PLOT 3,XX+ 7,3:PRINT AA:CC= 8:DC= 0:GOTO 2720
2690 IF CC= 0THEN 2720
2700 PLOT 3,XX+ 14- CC,3
2710 PRINT RIGHT$ ((STR$ (AC)),CC+ AD)
2720 IF Q< 58AND Q> 47THEN 2800
2730 IF AU= 0THEN 2790
2740 Y= Y- 1:IF Y< 0THEN Y= 0
2750 IF AU= 0THEN 2790
2760 PLOT 15,6,1,3,BA+ 2,Y
2770 Y= Y+ 1
2780 PRINT RIGHT$ ((STR$ (AC)),CC+ AD)
2790 GOSUB 2170
2800 REM
2810 RETURN
2820 REM  KEYBOARD
2830 DATA 245,229,197,1,206,40,205,36,0,202,-1,-1,11
2840 DATA 121,176,194,-1,-1,29,194,-1,-1,17,255,255,195
2850 DATA -1,-1,95,175,87,175,50,255,129,193,225,241,201
2860 TM= 256* PEEK (32941)+ PEEK (32940)
2870 IF TM> 65503THEN 2930
2880 RESTORE 2830
2890 FOR I= 1TO 39:READ A
2900 IF A> = 0AND A< > PEEK (TM+ I)THEN I= 39:A= 999
2910 NEXT I
2920 IF A< 256THEN 3020
2930 TM= TM- 39:RESTORE 2830
2940 FOR I= 1TO 39:READ A:POKE TM+ I,A- (A< 0):NEXT I
2950 Z= TM+ 29:AD= TM+ 11:GOSUB 3000
2960 Z= TM+ 7:AD= TM+ 17:GOSUB 3000
2970 Z= TM+ 4:AD= TM+ 21:GOSUB 3000
2980 Z= TM+ 32:AD= TM+ 27:GOSUB 3000
2990 GOTO 3010
3000 ZZ= INT (Z/ 256):POKE AD,Z- 256* ZZ:POKE AD+ 1,ZZ:RETURN
3010 Z= TM:AD= 32940:GOSUB 3000
3020 Z= TM+ 1:AD= 33283:GOSUB 3000
3030 POKE 33282,195
3040 GOTO 120
3050 REM
3060 Y= Y+ 1:X= BA:GOSUB 2170:RETURN
3070 GOTO 3380
3080 IF PA= 0THEN PA= 1:GOTO 3180
3090 IF Q$= "+"THEN AC= SR+ AC
3100 IF Q$= "-"THEN AC= SR- AC
3110 IF Q$= "X"THEN AC= SR* AC
3120 IF Q$= "DIV"THEN AC= SR/ AC
3130 GOSUB 3050
3140 SR= AC
3150 IF AU= 0THEN 2400
3160 PLOT 15,6,6,3,BA,Y:PRINT Q$
3170 GOSUB 3050:GOTO 2400
3180 SR= AC:GOTO 1960
3190 REM  KEYBOARD NUMERIC ENTRY
3200 IF AC= 0AND DC= 0THEN A$= "      0.":GOTO 3300
3210 A$(1)= " ":A$(2)= " ":A$(3)= " ":A$(4)= " ":A$(5)= " ":A$(6)= " ":A$(7)= " ":A$(8)= " "
3220 IF DC= 0THEN 3330
3230 A$(CC+ DC- 5)= "."
3240 FOR L1= 1TO CC
3250 IF A$(L1)= "."THEN SV= 1:GOTO 3270
3260 IF SV= 0THEN A$(L1)= RIGHT$ ((STR$ (N(L1))),1):GOTO 3280
3270 A$(L1+ 1)= RIGHT$ ((STR$ (N(L1))),1)
3280 NEXT L1
3290 A$= A$(8):FOR L2= 7TO 1STEP - 1:A$= A$+ A$(L2):NEXT L2
3300 PLOT 6,1,14,3,XX+ 7,3
3310 PRINT A$
3320 SV= 0:RETURN
3330 FOR L1= 1TO CC
3340 A$(L1+ 1)= RIGHT$ ((STR$ (N(L1))),1)
3350 NEXT L1
3360 A$(1)= "."
3370 GOTO 3290
3380 REM
3390 BC= 0:CE= 0
3400 IF AA= 0THEN 3490
3410 BB$= STR$ (AA)
3420 FOR L1= LEN (BB$)TO 1STEP - 1
3430 CC$= MID$ (BB$,L1,1)
3440 IF L1> LEN (CC$)AND L1< > 8THEN U1= 1
3450 IF CC$> "/"AND CC$< ":"THEN CE= CE+ 1:GOTO 3480
3460 IF CC$= "."THEN BC= 8- L1:GOTO 3480
3470 IF CC$= "E"THEN BC= - 9:CE= - 9:GOTO 3490
3480 NEXT L1
3490 IF U1= 1THEN U1= 0:CE= CE+ 1
3500 IF CE= 0THEN CE= 6
3510 RETURN
3520 END