DECLARE SUB Help () DECLARE FUNCTION ExistFile! (f$) DECLARE FUNCTION Str2DBL! (t$) DECLARE SUB Convert (D#, Nb#) DEFDBL A-Z s$ = COMMAND$ IF s$ = "" OR ExistFile(s$) <> -1 THEN Help: END OPEN s$ FOR BINARY AS #1 OPEN "OUT.T64" FOR OUTPUT AS #2 DIM TwoBytes AS STRING * 2 n1 = 2 n2 = 3 PRINT "Creating OUT.T64 from " + UCASE$(s$) + ". Est. Size of OUT.T64:"; (LOF(1) * (n2 / n1) + LEN(s$)) + INT(LOF(1) / 78) * 2 PRINT "OUT.T64: BEGIN" PRINT #2, s$ PRINT s$ 'FOR q = 1 TO LOF(1) STEP n1 DO UNTIL q = LOF(1) + 1 q = LOC(1) + 1 GET #1, q, TwoBytes Decimal = Str2DBL(TwoBytes) n$ = "" DO WHILE Decimal > 0 CALL Convert(Decimal, 64) Decimal = Decimal \ 64 LOOP n$ = STRING$((n2) - LEN(n$), "0") + n$ ttl = ttl + LEN(n$) IF LEN(Stord$) >= 77 THEN PRINT Stord$: PRINT #2, Stord$: Stord$ = "" ELSE Stord$ = Stord$ + n$ LOOP 'NEXT q PRINT #2, Stord$ PRINT Stord$ CLOSE 1, 2 PRINT "OUT.T64: EOF" PRINT "Size of OUT.T64:"; OPEN "OUT.T64" FOR RANDOM AS #2 PRINT LOF(2) CLOSE 1, 2, 3, 4, 5, 6, 7, 8, 9 SUB Convert (D, Nb) STATIC SHARED n$ ' Take the remainder to find the value of the current ' digit. R = D MOD Nb ' If the digit is less than ten, return a digit (0...9). ' Otherwise, return a letter (A...Z). IF R < 10 THEN Digit$ = CHR$(R + 48) ELSE Digit$ = CHR$(R + 55) n$ = RIGHT$(Digit$, 1) + n$ END SUB DEFSNG A-Z FUNCTION ExistFile (f$) IF f$ = "" THEN ExistFile = 1: EXIT FUNCTION X = FREEFILE OPEN f$ FOR RANDOM AS #X IF LOF(X) = 0 THEN CLOSE X: KILL f$: ExistFile = 1 ELSE CLOSE X: ExistFile = -1 END FUNCTION SUB Help PRINT "Base64 - By DDE SoftWare, Inc." PRINT "Syntax: BASE64 {binary file}" PRINT "" PRINT "binary file - A binary file to be converted to ASCII" END SUB FUNCTION Str2DBL (t$) FOR q = 1 TO LEN(t$) ff$ = RTRIM$(LTRIM$(STR$(ASC(MID$(t$, q, 1))))) m$ = m$ + STRING$(3 - LEN(ff$), "0") + ff$ NEXT q Str2DBL = VAL(m$) END FUNCTION