Listing of file='BASECO.BAS;01' on disk='vmedia/selective_utilities-sector.ccvf'
10 REM ***** NUMERIC BASE CONVERSION ***** 15 REM 30 PLOT 12 50 CLEAR 1000 100 CC$= "0123456789ABCDEF" 200 PLOT 6,3:PRINT :INPUT "BASE(D,H,O,B)=";NB$ 205 PLOT 6,2 210 IF NB$= "D"THEN GOTO 2000 220 IF NB$= "H"THEN GOTO 3000 230 IF NB$= "O"THEN GOTO 4000 240 IF NB$= "B"THEN GOTO 5000 250 GOTO 200 260 REM 2000 REM *** DECIMAL *** 2005 NB= 10 2010 PRINT :INPUT "DECIMAL NUMBER=";D$ 2020 IF D$= ""THEN GOTO 200 2030 IF LEN (D$)> 5THEN GOTO 2010 2040 SD$= D$ 2050 GOSUB 6000 2060 IF SD$= ""THEN GOTO 2010 2070 GOSUB 7000:REM CALCULATE STRING 2080 GOSUB 8000:REM PRINT STRINGS 2090 GOTO 2010 2095 REM 3000 REM *** HEXADECIMAL *** 3005 NB= 16 3010 PRINT :INPUT "HEXADECIMAL NUMBER=";H$ 3020 IF H$= ""THEN GOTO 200 3030 IF LEN (H$)> 4THEN GOTO 2010 3040 SD$= H$ 3050 GOSUB 6000 3060 IF SD$= ""THEN GOTO 3010 3070 GOSUB 7000:REM CALCULATE STRINGS 3080 GOSUB 8000:REM PRINT STRINGS 3090 GOTO 3010 3095 REM 4000 REM *** OCTAL *** 4005 NB= 8 4010 PRINT :INPUT "OCTAL NUMBER=";O$ 4020 IF O$= ""THEN GOTO 200 4030 IF LEN (O$)> 6THEN GOTO 4010 4040 SD$= O$ 4050 GOSUB 6000 4060 IF SD$= ""THEN GOTO 4010 4070 GOSUB 7000:REM CALCULATE STRINGS 4080 GOSUB 8000:REM PRINT STRINGS 4090 GOTO 4010 4095 REM 5000 REM *** BINARY *** 5005 NB= 2 5010 PRINT :INPUT "BINARY NUMBER=";B$ 5020 IF B$= ""THEN GOTO 200 5030 IF LEN (B$)> 16THEN GOTO 5010 5040 SD$= B$ 5050 GOSUB 6000 5060 IF SD$= ""THEN GOTO 5010 5070 GOSUB 7000:REM CANCULATE STRINGS 5080 GOSUB 8000:REM PRINT STRINGS 5090 GOSUB 5010 5095 REM 6000 REM +****CONVERT FROM A"STRING TO A POSITIVE INTERGER *** 6020 SL= LEN (SD$) 6025 X= 0 6030 FOR I= 0TO SL- 1 6040 SC$= MID$ (SD$,SL- I,1) 6050 FOR J= 1TO 16 6060 IF SC$= MID$ (CC$,J,1)AND J< = NBTHEN GOTO 6100 6070 NEXT J 6080 PRINT :PRINT "*** INVALID CHARACTER '";SC$;"' ***" 6083 PRINT 6085 SD$= "":REM FLAG ERROR 6090 RETURN 6095 REM 6100 X= X+ ((J- 1)* (NB^ I)) 6110 NEXT I 6115 X= INT (X+ .5):REM CONVERT TO INTERGER 6120 RETURN 6130 REM 7000 REM ** CALCULATING STRING FOR DIFFERENT BASES ** 7010 BB= 10:XX= X:GOSUB 9000 7020 DD$= NS$ 7030 BB= 16:XX= X:GOSUB 9000 7040 HH$= NS$ 7050 BB= 8:XX= X:GOSUB 9000 7060 OO$= NS$ 7070 BB= 2:XX= X:GOSUB 9000 7080 BB$= NS$ 7090 RETURN 7095 REM 8000 REM ** PRINT THE CONVERSION ** 8010 PRINT "DEC=";DD$,"HEX=";HH$,"OCT=";OO$,"BIN=";BB$ 8020 RETURN 8030 REM 9000 REM ** CONVERT TO DESIRED BASE ** 9010 NS$= "" 9020 XQ= INT (XX/ BB):XR= XX- (BB* XQ) 9030 XX= XQ 9040 NS$= MID$ (CC$,XR+ 1,1)+ NS$ 9050 IF XX< > 0THEN GOTO 9020 9060 RETURN 9070 REM