Compucolor.org – Virtual Media

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

5 PLOT 12,14
10 PRINT "NUMBER BASE CONVERSIONS":PRINT "NUMBERS CAN BE ENTERED AS:"
11 PRINT "   B = BINARY"
12 PRINT "   O = OCTAL"
13 PRINT "   D = DECIMAL"
14 PRINT "   H = HEX"
15 PRINT :INPUT "INPUT BASE (B,O,D,H) ? ";B$
20 QP= 1
30 IF B$= "B"GOTO 200
40 IF B$= "O"GOTO 800
50 IF B$= "D"GOTO 1000
60 IF B$= "H"GOTO 1600
70 GOTO 5
100 PRINT :PRINT "DECIMAL = ";QN
110 GOSUB 20002
120 PRINT "BINARY  =  ";QS$
130 GOSUB 20008
140 PRINT "OCTAL   =  ";QS$
150 GOSUB 20016
160 PRINT "HEX     =  ";QS$
170 PRINT :INPUT "ANOTHER NUMBER ? ";A$
180 IF A$= "Y"GOTO 5
190 END
200 INPUT "BINARY NUMBER ? ";QS$
210 GOSUB 10002
220 GOTO 100
800 INPUT "OCTAL NUMBER ? ";QS$
810 GOSUB 10008
820 GOTO 100
1000 INPUT "DECIMAL NUMBER ? ";QN
1010 GOTO 100
1600 INPUT "HEXADECIMAL NUMBER ? ";QS$
1610 GOSUB 10016
1620 GOTO 100
10000 GOTO 10008
10002 QB= 2
10004 GOTO 10020
10008 QB= 8
10010 GOTO  10020
10016 QB= 16
10020 QN= 0:QL= LEN (QS$)
10030 FOR QI= QPTO QL
10040 QC= ASC (MID$ (QS$,QI,1))- 48
10050 IF QC> 9THEN QC= QC- 7
10060 IF  QC > =  QB GOTO  10100
10070 IF QC< 0GOTO 10100
10080 QN= QN* QB+ QC
10090 NEXT QI
10100 QP= QI+ 1
10110 RETURN
20000 GOTO 20008
20002 QB= 2
20004 GOTO 20020
20008 QB= 8
20010 GOTO 20020
20016 QB= 16
20020 QS$= "":QD= QN
20030 QT= QD- INT (QD/ QB)* QB
20040 IF QT> 9THEN QT= QT+ 7
20050 QS$= CHR$ (QT+ 48)+ QS$
20060 QD= INT (QD/ QB)
20070 IF QD< > 0GOTO 20030
20080 RETURN