text
stringlengths
0
99.6k
FOR each byte in the file.
GET the byte.
Compress the byte using selected method.
NEXT byte
CLOSE the input file.
IF crunching file then send end of file marker.
IF crunching in one pass then also send original
length and checksum. (both of which are not
known until now)
DONE compressing file. Padd the compressed length to an
even multiple of 254 bytes and exit subroutine.
ARC VERSION 2.20 PAGE - 46
EXTRACT ARCHIVE
Archive is open for read, so:
WHILE NOT end of file
GET header for this entry.
IF no header, or error in header THEN abort.
IF length of this block is < 254 THEN abort.
(this will ignore any XMODEM padding)
IF name in header matches any parameter 2-9 THEN
CALL extract file subroutine
ELSE
get number of blocks to skip from header
and skip that many blocks.
ENDIF
IF header checksum=new checksum THEN
PRINT "ok."
ELSE
PRINT "checksum error."
ENDIF
ENDWHILE
DONE extracting archive.
EXTRACT FILE...Subroutine for EXTRACT ARCHIVE
IF switch 1 is X THEN open file for write
GET file's original length from archive header
SET new checksum to zero
WHILE original length > 0 DO
DEcompress a byte
ADJUST new checksum
IF switch 1 is X THEN write byte to output file
IF switch 1 is P THEN
IF switch 2 is P THEN convert ascii to petscii
IF switch 2 is A THEN convert petscii to ascii
IF switch 3 is P THEN
output to printer
ELSE
output to screen
ENDIF
ENDIF
DECrement original length
END WHILE
IF file open for write THEN close it
RETURN from subroutine
ARC VERSION 2.20 PAGE - 47
FIX XMODEM PADDING
Archive is open for read, so we know it exists.
Close the archive.
GET track,sector where archive starts from the
directory.
GET track,sector
IF track link <> 0 THEN
GET track,sector=link
ELSE
We're at the last block of the file so:
IF sector link = 255 THEN
PRINT "archive is ok."
ELSE