Talk About Network

Google





Software > Basic Dos > Storing any Byt...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 670 of 700
Post > Topic >>

Storing any Byte as a String

by sara li <nomail@[EMAIL PROTECTED] > Jul 28, 2008 at 01:40 PM

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.
 




 5 Posts in Topic:
Storing any Byte as a String
sara li <nomail@[EMAIL  2008-07-28 13:40:04 
Re: Storing any Byte as a String
Derek <derekrss@[EMAIL  2008-07-28 22:03:53 
Re: Storing any Byte as a String
Derek <derekrss@[EMAIL  2008-07-28 22:04:09 
Re: Storing any Byte as a String
sara li <nomail@[EMAIL  2008-07-29 02:34:08 
Re: Storing any Byte as a String
Derek <derekrss@[EMAIL  2008-07-29 19:27:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 20:32:50 PST 2009.