All Basic Code (ABC) archives contains hundreds of basic programs. Some
of these .bas programs contain a complete .zip file stored as text
strings. The .bas program then uses these strings to create the .ZIP file.
Unfortunately some ASC codes can't be stored as a string so there is a
clever sub-routine that handles this problem. All of the ABC packets
call this decoder "SUB U" and here it is (cleaned up a bit for clarity):
SUB U (A$)
FOR A = 1 TO LEN(A$)
C = ASC(MID$(A$, A)) - 37
IF C < 0 THEN C = 91 + C * 32
IF K < 4 THEN K = C + 243 ELSE PRINT #ZipFile, CHR$(C + (K MOD 3) *
86);
K = K \ 3
B& = B& + 1
S = (S + C) AND 255
NEXT
END SUB
And here are a few sample strings that it processes:
CALL U "%up()%9%%%I-%zORGG:P=SB/(.%%[/%%%-%%%%in%xpSgRfx&%;<>T[j5w=9ZxZ"
CALL U "_s>bl_[t'4&Gt%9/eh)W922qkteUUO*w)g\J?pId:<ZsX#rks=A6H%BkLi)GFHS"
My question is, does anyone have the sub-routine to do this in reverse?
What I'm actually working on are LFN routines that I hope to put into my
QB45 library. Right now my PROBAS and CRESCENT lib file routines only
handle 8.3 file names. In digging through the ABC packets I came across
some interesting call Absolute routines that I don't understand but that
I'm hoping to adapt. But the code is unnecessarily long and I want to
condense it. Here's an example:
asm$ = asm$ + CHR$(&H55)
asm$ = asm$ + CHR$(&H89) + CHR$(&HE5)
asm$ = asm$ + CHR$(&H57)
asm$ = asm$ + CHR$(&H6)
asm$ = asm$ + CHR$(&H56)
asm$ = asm$ + CHR$(&H1E)
asm$ = asm$ + CHR$(&H8B) + CHR$(&H5E) + CHR$(&H6)
asm$ = asm$ + CHR$(&H8B) + CHR$(&H3F)
asm$ = asm$ + CHR$(&H8B) + CHR$(&H5E) + CHR$(&H8)
asm$ = asm$ + CHR$(&H8E) + CHR$(&H7)
asm$ = asm$ + CHR$(&H8B) + CHR$(&H5E) + CHR$(&HA)
asm$ = asm$ + CHR$(&H8B) + CHR$(&H17)
asm$ = asm$ + CHR$(&H8B) + CHR$(&H5E) + CHR$(&HE)
asm$ = asm$ + CHR$(&H8A) + CHR$(&H2F)
asm$ = asm$ + CHR$(&H8B) + CHR$(&H5E) + CHR$(&H10)
asm$ = asm$ + CHR$(&H8A) + CHR$(&HF)
...... and on, and on...
I would like to do the ABC trick and store this more efficiently. Sorry
for the excessive length of this post! Appreciate all your help.