BBS: Inland Empire Archive Date: 04-10-93 (08:23) Number: 332 From: RICH GELDREICH Refer#: NONE To: VICTOR YIU Recvd: NO Subj: Prototype 2/3 Conf: (2) Quik_Bas
'>>> Start of page 2.
DO
IF BytesLeft < 4096 THEN
InputBuffer$ = SPACE$(BytesLeft)
BytesRead = BytesLeft
END IF
GET #1, , InputBuffer$
EncodeBlock
BytesLeft = BytesLeft - BytesRead
LOOP WHILE BytesLeft
EncodeEnd
CLOSE 1, 2
LOCATE , 1
PRINT "Finished!"
END
SUB EncodeBlock
FOR a = 1 TO BytesRead
k = ASC(MID$(InputBuffer$, a, 1))
RunningCRC = (RunningCRC + k) AND 255
BitBuffer = BitBuffer OR k * Power2(BitsInBuffer)
BitsInBuffer = BitsInBuffer + 8
DO WHILE BitsInBuffer >= 6
MID$(OutputLine$, OutputPos) = MID$(GoodChars$, 1 +_
(BitBuffer AND 63), 1)
OutputPos = OutputPos + 1
IF OutputPos = 66 THEN
PRINT #2, OutputLine$
OutputPos = 3
LinesWritten = LinesWritten + 1
IF (LinesWritten AND 15) = 0 THEN
LOCATE , 1: PRINT LinesWritten;
END IF
END IF
BitBuffer = BitBuffer \ 64
BitsInBuffer = BitsInBuffer - 6
LOOP
NEXT
END SUB
SUB EncodeEnd
IF BitsInBuffer <> 0 THEN
MID$(OutputLine$, OutputPos) = MID$(GoodChars$, 1 +_
(BitBuffer AND 63), 1)
OutputPos = OutputPos + 1
END IF
IF OutputPos <> 3 THEN
PRINT #2, LEFT$(OutputLine$, OutputPos - 1)
LinesWritten = LinesWritten + 1
END IF
Q$ = CHR$(34)
L1$ = "IF K<>" + MID$(STR$(RunningCRC), 2) + " THEN ?" + Q$ +_
"Bad CRC!" + Q$ + ":CLOSE:KILL F$ ELSE ?"
L1$ = L1$ + Q$ + "Success!" + Q$ + ":SYSTEM"
L2$ = "SUB G(A$):FOR A=1 TO LEN(RTRIM$(A$)):R=R+T(I,ASC(MID$("+_
"A$,A,1)))"
L3$ = "I=I+6:IF I>7 THEN ?#1,CHR$(R AND Q);:K=(K+R)AND"+_
" Q:R=R\256:I=I-8"
'>>> Continued on page 3
--- MsgToss 2.0b
* Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET