PRINT " 0 (decimal) -> " FNtobase(0, 16) " (base 16)" PRINT " 26 (decimal) -> " FNtobase(26, 16) " (base 16)" PRINT "383 (decimal) -> " FNtobase(383, 16) " (base 16)" PRINT " 26 (decimal) -> " FNtobase(26, 2) " (base 2)" PRINT "383 (decimal) -> " FNtobase(383, 2) " (base 2)" PRINT " 1a (base 16) -> " ;FNfrombase("1a", 16) " (decimal)" PRINT " 1A (base 16) -> " ;FNfrombase("1A", 16) " (decimal)" PRINT "17f (base 16) -> " ;FNfrombase("17f", 16) " (decimal)" PRINT "101111111 (base 2) -> " ;FNfrombase("101111111", 2) " (decimal)" END DEF FNtobase(N%, B%) LOCAL D%,A$ REPEAT D% = N% MOD B% N% DIV= B% A$ = CHR$(48 + D% - 39*(D%>9)) + A$ UNTIL N% = FALSE =A$ DEF FNfrombase(A$, B%) LOCAL N% REPEAT N% *= B% N% += ASC(A$) - 48 + 7*(ASCA$>64) + 32*(ASCA$>96) A$ = MID$(A$,2) UNTIL A$ = "" = N%