home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_USER / 1990 / USERJL90.MSA / LISTINGS.ARC / RLD.BSC < prev    next >
Text File  |  1990-05-16  |  521b  |  22 lines

  1. REM Run Length Decoding - by R.A.Waddilove
  2. INPUT "File to decompact:"i$
  3. INPUT "New filename:"o$
  4. DELFILE o$    : \just a precaution
  5. PRINT:PRINT "Decoding file..."
  6. I%=OPENIN i$  : \open file to compact
  7. flag%=BGET#I% : \get run length flag
  8. O%=OPENOUT o$ : \open file to create
  9. REPEAT
  10.     byte%=BGET#I%
  11.     IF byte%=flag% THEN
  12.         byte%=BGET#I% : count%=BGET#I%
  13.         FOR J%=1 TO count%
  14.             BPUT#O%,byte% : \ run of count%, bytes%
  15.         NEXT
  16.     ELSE
  17.         BPUT#O%,byte%
  18.     ENDIF
  19. UNTIL EOF#I%
  20. CLOSE#I%:CLOSE#O% : \close files
  21. END
  22.