home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
archives
/
uniflex.tar.gz
/
uniflex.tar
/
ufuboo.bas
< prev
next >
Wrap
BASIC Source File
|
1993-08-23
|
2KB
|
55 lines
10 rem This program is used to unpack the UniFLEX kermit BOO files.
20 width 0
30 n$ = chr$(0)
40 z = asc("0")
50 t = asc("~")-z
60 k$ = "ufksup.boo"
70 open old k$ as 1
80 input #1,f$ :rem Get the file name
90 open new f$ as 2
100 gosub 180
110 k$ = "ufkrmt.boo"
120 open old k$ as 1
130 input #1,f$ :rem Get the file name
140 open new f$ as 2
150 gosub 180
160 print "Processing completed."
170 exit
180 print k$;" ==> ";f$
190 on error goto 500
200 input #1,x$ :rem Get a line.
210 y$ = "" :rem Clear the output buffer.
220 goto 250
230 print #2,y$; :rem Print output buffer to file.
240 goto 200 :rem Get another line.
250 if len(x$) < 2 goto 230 :rem Is the input buffer empty?
260 a = asc(x$) - z
270 if a = t then goto 400 :rem Null repeat character?
280 if len(x$) < 3 goto 230 :rem Is the input buffer empty?
290 q$ = mid$(x$,2,3) :rem Get the quadruplet to decode.
300 x$ = mid$(x$,5)
310 b = asc(q$)-z
320 q$ = mid$(q$,2)
330 c = asc(q$)-z
340 q$ = mid$(q$,2)
350 d = asc(q$)-z
360 y$ = y$ + chr$(((a * 4) + (b / 16)) and 255) :rem Decode the quad.
370 y$ = y$ + chr$(((b * 16) + (c / 4)) and 255)
380 y$ = y$ + chr$(((c * 64) + d) and 255)
390 goto 250 :rem Get another quad.
400 x$ = mid$(x$,2) :rem Expand the nulls.
410 r = asc(x$) - z :rem Get the number of nulls.
420 x$ = mid$(x$,2)
430 for i = 1 to r :rem Loop, adding nulls to string.
440 y$ = y$ + n$
450 next i
460 print #2,y$; :rem Output the nulls to the file.
470 y$ = "" :rem Clear the output buffer.
480 goto 250
490 return
500 if err <> 8 then goto 530
510 close 1,2
520 resume 490
530 print "Error: ",err
540 stop