BBS: Inland Empire Archive Date: 04-02-93 (23:02) Number: 336 From: VICTOR YIU Refer#: NONE To: ALL Recvd: NO Subj: PostIt! 6.0 13/16 Conf: (2) Quik_Bas
'>>> Start of page 13.
END FUNCTION
SUB PrepareFile
F$ = UCASE$(DestFile$ + Num2Str$(CurrentPage) + DestExten$)
COLOR 7: PRINT
PRINT "Now writing: "; F$; " ";
Row = CSRLIN: Col = POS(0)
'use 8k output buffer for a little speed
OPEN F$ FOR OUTPUT AS #2 LEN = 8192
IF SmallScript THEN
PRINT #2, "~PostIt! 6.0~"; RealSource$; "~"; "Script starts"
Prefix$ = ""
ELSE
'Print the first 3 lines of the decoder.
' Shaved several bytes... -VY
PRINT #2, "CLS:?STRING$(50,178):DEFINT A-Z 'Created by PostIt!"+_
" 6.0"
PRINT #2, "FOR A=0 TO 6:P(A)=2^A:NEXT:OPEN "; Qt$; "B"; Qt$;_
",1,"; Qt$; RealSource$
PRINT #2, "T$="; Qt$; "abcdefghijklmnopqrstuvwxyz"; Qt$;_
":T$=T$+UCASE$(T$)+"; Qt$; "0123456789#$"
Prefix$ = "G" + Qt$
Work$ = Prefix$
END IF
END SUB
SUB PrintDecoder
IF SmallScript THEN
PrintLine "~" + Num2Str$(FileLength) + "~" +_
Num2Str$(CheckSum) + "~" + "End"
ELSE
'Main decoder originally reduced from 8 lines to 6 lines by Jim Giordano
'Thanks Jim!
'Slight modifications to the 6 line decoder by Rich Geldreich
'More modifications to the decoder to implement compressed code,
' increased to ~7.2 lines by Victor Yiu
'Modified again to increase speed, but at the slight expense of
' size (3/9/93) -VY
PrintLine "N=" + Num2Str$(FileLength) + ":K=255:IF LEN(C$)<>" +_
Num2Str$(BytesOut) + " THEN ?" + Qt$ + "Bad script!" + Qt$ +_
":END"
PrintLine "FOR A=1 TO N:LOCATE 1:?STRING$(50/N*A,177):IF L=0"+_
" THEN GOSUB G:L=6"
PrintLine "W=T\P(6-L):GOSUB G:W=W OR T*P(L):L=L-2:B$=CHR$(W AND"+_
" K):PUT 1,,B$:NEXT"
PrintLine "?:IF C=" + Num2Str$(CheckSum) + " THEN ?" + Qt$ +_
"Ok" + Qt$ + ":END ELSE ?" + Qt$ + "Bad checksum!" + Qt$ +_
":END"
PrintLine "G:I=I+1:T=INSTR(T$,MID$(C$,I,1))-1:C=(C+T)*2:C=C"+_
"\256+(C AND 255):RETURN"
PrintLine "SUB G(A$):SHARED C$:FOR Q=2 TO"+_
" 9:DO:S=INSTR(A$,CHR$(Q+38))"
PrintLine "IF S THEN A$=LEFT$(A$,S-1)+STRING$(Q,97)+MID$(A$,S+1)"
PrintLine "LOOP WHILE S:NEXT:C$=C$+A$:END SUB"
END IF
CLOSE
END SUB
'Outputs one line to the output file, and opens another output file
'if the page length is exceeded.
SUB PrintLine (A$)
IF NewFileFlag THEN
LOCATE Row, Col
PRINT " "
NewFileFlag = False
CurrentPage = CurrentPage + 1 '<-- switched these 2 lines
'>>> Continued on page 14
--- Blue Wave/RA v2.12 [NR]
* Origin: Hard Disc Cafe | Houston Texas | (713) 589-2690 | (1:106/30.0)

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