BBS: Inland Empire Archive Date: 02-27-93 (00:02) Number: 69 From: VICTOR YIU Refer#: NONE To: ALL Recvd: NO Subj: SpaceOut 1.0 ---> 3/3 Conf: (2) Quik_Bas
'Part 3 of SPACEOUT.BAS - continued from last message...
' character, while the 2nd space will be by itself...
'
' The code below is very optimized: it uses direct manipulation of
' the string through PEEK/POKE and not MID$. It is as fast as
' you can get with pure QB.
'
FUNCTION vy.Encode (Text$)
Leng = LEN(Text$)
IF Leng = 0 THEN Encode = True: EXIT FUNCTION
Temp& = SSEG(Text$) ' Same here, too!
Offset = SADD(Text$)
DEF SEG = Temp& + Offset \ 16
Offset = Offset AND 15
After = Offset
Char = PEEK(Offset) AND 127
Endd = Offset + Leng - 2
Abort = False
FOR Byte = Offset TO Endd
Nxt = PEEK(Byte + 1) AND 127
IF Nxt = 32 THEN
Char = Char OR 128
Byte = Byte + 1
Nxt = PEEK(Byte + 1) AND 127
END IF
POKE After, Char
After = After + 1
Char = Nxt
NEXT
POKE After, (Char AND 127)
DEF SEG
NewLen = After - Offset + 1
Text$ = MKI$(LEN(Text$)) + LEFT$(Text$, NewLen)
vy.Encode = True
END FUNCTION
'________O_/________________________| SNIP |______________________\_O_______
' O \ | HERE | / O
' Line wrapping and message splitted accomplished by MsgSplit 2.00,
'a Victor Yiu and Scott Wunsch creation.
That's it. Hope you like it.
Victor
... OS/2 VirusScan - Windows Found: Remove it? (Y/y)
--- Blue Wave/RA v2.10 [NR]
* Origin: Hard Disc Cafe / Houston Texas / (713) 589-2690
/ Node -*N (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