home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / b / bascrunch / !Crunch / !Help next >
Encoding:
Text File  |  1996-10-30  |  8.5 KB  |  144 lines

  1. Help file for the BASS Cruncher application (version 1.21).
  2. -----------------------------------------------------------
  3.  
  4. This program is FREEWARE: it may be freely copied and used as long as all the files are unaltered and the application is not sold for profit etc. Putting it on a public file server is okay. You're also allowed to use your crunched files and the Decrunch module where you want, even in commercials... Of course I cannot be held responsible for any data loss... Use of the Decrunch module in commercial products is allowed at the conditions that 1) You don't claim the module is your work, and 2) You don't sell the module for itself, so only the contents of your work can justify the price...
  5.  
  6. *Important*: This is NOT an archiver! The files created are crunched and stay crunched for ever, at least for executables!
  7.  
  8. This application is the multitaking version of an old tiny executable made by me to compress executables just as Acorn's Squeeze does, but usually more efficiently when mixed data is involved. The latest non multitasking very non user friendly version was 'CrunchC030'. By the way, the very first version was a conversion from the CBM64...
  9.  
  10. Now the interface and the algorithms have been completly reworked in order to be easy to use and fast. Those who used the older version will notice the difference in compression speed.
  11.  
  12. The application works fully multitasking with the interface looking like RISC OS 3 filer operations windows...
  13.  
  14. As a bonus, clicking ADJUST on the Cruncher icon will bring a RM merger window. It allows to build an executable that'll install a given number of modules in RMA when run. Of course you can later compress it with Cruncher to gain disk space.
  15.  
  16. However, it is probable that this program will not be of full interest to real users, but would rather be enjoyed by real programmers.
  17.  
  18. Features
  19. --------
  20. - Launch the !Help application for more info.
  21. - Should work on all versions of RISC OS and all ARM processors, although it has been tested only on RISC OS 3.11, 3.5 and 3.7 (StrongARM).
  22. - Should work on any configuration, like floppy-only (like me!) or 1Meg-only.
  23. - Can handle a selection of files dragged to its iconbar icon. Files to crunch are simply queued until the current crunch job is finished. This method is more efficient than crunching all the files in parallel, both in the point of view of file access (seek time) and memory usage (have you noticed how multiple filer operations are slow and memory hungry on RISC OS 3?)
  24. - You can alter a parameter in the !Run file to set the maximum memory claimable by Cruncher: more memory speeds up the algorithm a LITTLE bit and could be an advantage when filing is on floppy. You can also set it to the minimum since in that case the application will only grab the minimum memory it really needs.
  25. - When dragged to !Crunch, Absolute, load/exec, BASIC, Module and Sprite files are crunched and converted to Absolute type.
  26. - Depending on your choice at crunch time, crunched files can later either be run or uncrunched using the SWI's provided by the Decrunch module to be found in this application directory.
  27. - Restrictions: when crunching sprites, only a screen dump of the right width and no wastage and no mask will be handled correctly. Tip: if a crunched screen gets the colours wrong then: 1) *ScreenLoad the original, 2) *ScreenSave to something, and 3) Crunched that something. It should work.
  28. - Reliability: it's possible for a file containing no compressable data at its start to not decrunch properly, although I've not seen such until now. So always check it runs as it should!
  29.  
  30. Some tricks from control window
  31. -------------------------------
  32. - The exec address can be entered relative to the load address by prefixing with a '+'.
  33. - When crunching a data file, the output is forced to data type. In that case the exec address field provides the default load address of the data.
  34. - When crunching files other than data, giving an 'Other' load address of zero produces a data file. In that case an 'Other' or the filetype default exec address also sets the reload address of data.
  35.  
  36. Technical details
  37. -----------------
  38. - The decompression code uses only at most 604 bytes at the decompressed data
  39.   top. It doesn't need any extra workspace.
  40. - All is written in pure ARM code.
  41. - When running the decompression routine is in SVC mode with interrupts
  42.   unaltered. R13's registers are not used and not corrupted. On exit processor
  43.   mode and interrupts and R13 are unaltered, the rest is corrupted.
  44.  
  45. About efficiency: usually more efficient than Squeeze or any LZW algorithm when mixed code is involved, I mean something like demo or application code. LZW can be a little bit better on pictures and Squeeze a little bit better on ARM-code-only data. In fact I noticed recently that my algorithm is a kind of LZ77 compression scheme!
  46.  
  47. Decompression speed: it IS FAST. I think I can't make it faster since all registers are fully used... It's not as fast as Squeeze since it's byte oriented; Squeeze is word oriented so it can use LDM/STM but the drawback is 'lack' of compression efficiency.
  48.  
  49. Decrunch module SWI's
  50. ---------------------
  51.  
  52. --- Decrunch_Decrunch (SWI &C0AC0) ---
  53.  
  54. Decrunch crunched data
  55.  
  56. Entry: R0= % b4 b3 b2 b1 b0 (flags, other bits must be 0)
  57.            b4= force destination address
  58.            b3= use hourglass
  59.            b2= decrunch data from memory
  60.            b1= use a file handle instead of a filename pointer
  61.            b0= assume magic string not present
  62.        R1: case b2 b1
  63.                  0  0 : R1= source filename pointer
  64.                  0  1 : R1= source file handle
  65.                  1  0 : R1= pointer to source data in memory
  66.                  1  1 : Undefined behaviour
  67.        R2: case b4= 1 : R2= destination address in memory
  68.                 b4= 0 : R2= irrelevant
  69.  
  70. Exit:  if V set then R0= pointer to RISC OS error block
  71.                      other registers preserved
  72.                      file pointer unchanged (if using file handle)
  73.        else
  74.        R0 preserved
  75.        R1= case b2 b1
  76.                  0  0 : R1 preserved
  77.                  0  1 : R1 preserved
  78.                         file pointer advanced for further use
  79.                  1  0 : R1 points to the end of source data for further use
  80.        R2= load address found in the source data
  81.        R3= length of uncrunched data
  82.  
  83.        All else is preserved
  84.  
  85. Processor mode: the decompressor works in SVC mode so you can decrunch to protected memory.
  86.  
  87. --- Decrunch_Get (SWI &C0AC1) ---
  88.  
  89. Get information about crunched data.
  90.  
  91. Entry: R0= % b3 b2 b1 b0 (flags, other bits must be 0)
  92.            b3= use hourglass
  93.            b2= decrunch data from memory
  94.            b1= use a file handle instead of a filename pointer
  95.            b0= assume magic string not present
  96.        R1: case b2 b1
  97.                  0  0 : R1= source filename pointer
  98.                  0  1 : R1= source file handle
  99.                  1  0 : R1= pointer to source data in memory
  100.                  1  1 : Undefined behaviour
  101.  
  102. Exit:  if V set then R0= pointer to RISC OS error block
  103.                      other registers preserved
  104.                      file pointer unchanged (if using file handle)
  105.        else
  106.        R0, R1 preserved
  107.        R2= load address found in the source data
  108.        R3= length of uncrunched data
  109.  
  110.        File pointer unchanged (if using file handle)
  111.  
  112.        All else is preserved
  113.  
  114. The latter SWI is fast because the data does not need to be uncrunched to get information about uncrunched data.
  115.  
  116. Beside RISC OS errors, both SWI's can also return a special Decrunch error indicating that the source data format is not recognized:
  117.  
  118.    Error number &C0AC0: Data not crunched
  119.  
  120.  
  121. --- Notes ---
  122.  
  123. Decrunching from memory:
  124.     The source data must not overlap with the space where the uncrunched data is put.
  125.  
  126. Skipping the magic string:
  127.     At the start of each data file produced by !Crunch there is an 8-byte magic string so that Decrunch can check whether it can cope with the file. You can bypass that check when you use "unmagical" files (i.e. with the first 8 bytes removed) by setting bit 0 of the flags.
  128.     However, using files with no magic string does not allow Decrunch to check for newer versions of the format and compression scheme, and so these files won't be compatible with such newer decrunchers.
  129.  
  130. Memory:
  131.     The decruncher does not requires any extra memory when decrunching.
  132.  
  133.  
  134.  
  135.  
  136. That's it for now... I hope (and I've already heard) that you enjoy !Crunch and hello to other cool hackers! (and not to lame crackers)
  137.  
  138. --
  139. The latest version of !Crunch can be found at:
  140.                 http://gate-fun.cediti.be/~bju/myprogs.html
  141.  
  142. My email address: bju@cediti.be
  143.  
  144. Bernard Jungen for BASS, February 1994/June 1995/November 1996.