8-Bit Software Online Conversion

Number Converter - Listing

20DEFFNS:="CON" 30MODE7:C%=1 40FORL%=1TO2:PRINT"   50PRINT:FORL%=1TO9:PRINT" ":NEXT 60PRINTTAB(4,13)"  £££££££££££k" 70FORL%=1TO7:PRINTTAB(4)" ";TAB(34) ;" NEXT 80PRINTTAB(4);"  pppppppppz" 90OSCLI"K.0 255|M":OSCLI"FX138 0 128" 100PRINTTAB(7,14)"Enter number for con version";TAB(7,15);"Max 2147483647 &7FFF FFFF +-";TAB(7,16)" Prefix with:";T AB(7,17);" (&)Hexadecimal (B)inary"; 110PRINTTAB(7,18);" No prefix for De cimal";TAB(7,19);" (P)rintout (R)ever se";TAB(7,20);" RETURN change by 1" 120ONERROR:VDU3:SOUND1,-10,200,1:IFERR =17END 130REPEAT 140PRINTTAB(0,23)SPC40;:INPUTTAB(0,23) " "A$:H$="" 150IFA$="R"IFC%=1C%=-1:A$="" ELSE IF A $="R"C%=1:A$="" 160IFA$=""A$=STR$((VALD$)+C%) 170IFLEFT$(A$,1)="&"A$=RIGHT$(A$,LENA$ -1):H$=A$:D%=FNhex:D$=A$:D%=FNdectobin:B $=A$ 180IFLEFT$(A$,1)="B"A$=RIGHT$(A$,LENA$ -1):B$=A$:D%=FNbintodec:D$=A$:H$=STR$÷VA LA$ 190IFLEFT$(A$,1)="P"MODE0:PROCprintout :RUN 200IFH$=""PROCh 210PRINTTAB(4,5)"Decimal: ";D$;SPC1 0;TAB(4,7);"Hexadecimal:&";H$;SPC10;TAB( 4,9);"Bin:";B$;SPC(32-LENB$); 220UNTILFALSE 230DEFPROCh:D$=A$:H$=STR$÷VALA$:IFVALD $<0A$=RIGHT$(H$,7):D%=FNhex:D%=FNdectobi n:B$=A$:A$=LEFT$(H$,1):D%=FNhex:D%=FNdec tobin:B$=A$+B$ ELSE D%=FNdectobin:B$=A$ 240ENDPROC 250DEFPROCprintout:ONERROR:VDU3:RUN 260INPUT"Start in decimal "S%:INPUT"En d in decimal "E%:PRINT"Printer? Y/N ":A$ =GET$:IFA$="Y"VDU2 270PRINT"Decimal Hexadecimal Binary":F ORO%=S%TOE%:PRINTTAB(0);O%;TAB(10)"&";÷O %;:O$=STR$÷O% 280IFO%<0A$=RIGHT$(O$,4):D%=FNhex:D%=F Ndectobin:B$=A$:A$=LEFT$(O$,4):D%=FNhex: D%=FNdectobin:B$=A$+B$ ELSE A$=STR$O%:D% =FNdectobin:B$=A$ 290PRINTTAB(20)B$:NEXT 300VDU3:PRINT"PRESS A KEY":REPEATUNTIL GET:ENDPROC 310DEFFNbintodec:IFVALA$=0=D% 320R%=0 330FORL%=1TOLENA$ 340R%=R%+(VAL(MID$(A$,L%,1)))*2^(LENA$ -L%) 350NEXT:A$=STR$R% 360=R% 370DEFFNdectobin 380R%=VALA$:B%=LEN(STR$÷VALA$)*4:A$="" :IFB%>31B%=31 390FORL%=B%TO0STEP-1 400R%=R%-2^L%:IFR%<0R%=R%+2^L%:A$=A$+" 0" ELSE A$=A$+"1" 410NEXT:L%=0:REPEAT:L%=L%+1:UNTILMID$( A$,L%,1)="1"ORL%=LENA$:A$=MID$(A$,L%,LEN A$) 420=R% 430DEFFNhex 440R%=0:FORHL%=1TOLENA$:E%=ASC(MID$(A$ ,HL%)) 450IFE%>57 E%=E%-55 ELSE E%=E%-48 460R%=R%*16+E%:NEXT:A$=STR$R%:=R%