Compucolor.org – Virtual Media

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

3 PLOT 12
4 INPUT "NUMBER BASE - ";B
5 PLOT 12
10 PRINT "ENTER BASE";B;" NUMBER ?";:INPUT " ";HEX$
11 N= 0:Z= 1
18 N= 0:Z= 1
20 FOR P= LEN (HEX$)TO 1STEP - 1
30 L$= MID$ (HEX$,Z,1)
40 Z= Z+ 1
90 L= ASC (L$)- 48
100 IF L$= > "A"THEN L= ASC (L$)- 55
105 IF L> = BTHEN 150
110 N= N+ (L* B^ (P- 1))
130 NEXT
135 PRINT "                                  = ";N;" (10)"
140 PRINT :PRINT :PRINT :GOTO 10
150 PRINT :PRINT :PRINT :PRINT "BASE CONVERSION ERROR, CHECK INPUT"
155 PRINT L,B
160 FOR DELAY= 1TO 200:NEXT :GOTO 140