home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / compress / packers / stonecracker / stc.doc < prev    next >
Text File  |  1995-02-27  |  28KB  |  779 lines

  1. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2.  
  3.                                 Contents
  4.  
  5.  
  6.  
  7. 1 General info
  8. 1.1 Disclaimer
  9. 1.2 Copyright & Distribution
  10. 1.3 Introduction to StoneCracker
  11. 1.4 Requirements
  12. 1.5 Contents of the package
  13. 1.6 The future
  14.  
  15. 2 GUI Settings
  16. 2.1 Filetypes
  17.     2.1.1 Executable programs
  18.     2.1.2 Data files
  19.     2.1.3 Absolute programs
  20. 2.2 Decrunchers
  21.     2.2.1 E-Decrunchers for Executables
  22.           2.2.1.1 Build In
  23.           2.2.1.2 Library
  24.     2.2.2 A-Decrunchers for Absolutes
  25.           2.2.2.1 Normal
  26.           2.2.2.2 Plain
  27.           2.2.2.3 Professional
  28.     2.2.3 Absolute decruncher defs
  29.           2.2.3.1 Load address
  30.           2.2.3.2 Jump address
  31.           2.2.3.3 Decr address - decruncher address
  32.           2.2.3.4 USP address - user stackpointer address
  33.           2.2.3.5 SSP address - system stackpointer address
  34.           2.2.3.6 SR - status register
  35. 2.3 Packmode
  36. 2.4 Seclen - security length
  37. 2.5 DataID
  38. 2.6 Dest dir - destination directory
  39. 2.7 Save prefs - save preferences
  40.  
  41. 3 Using GUI
  42. 3.1 Information gadgets
  43.     3.1.1 File name
  44.     3.1.2 File length
  45.     3.1.3 Processed length
  46.     3.1.4 Crunched length
  47. 3.2 Output window
  48. 3.3 Load file
  49. 3.4 Save file
  50. 3.5 Delete file
  51. 3.6 Iconify
  52. 3.7 Quit
  53. 3.8 Shortcuts
  54.  
  55. 4 Using commandline
  56. 4.1 What I can do from commandline?
  57. 4.2 List of options
  58.     4.2.1 Filetypes -fe, -fel, -fa, -fap, -fak
  59.     4.2.2 Packmode -p0, -p1, -p2, -p3, -p4
  60.     4.2.3 Absolute decruncher defs
  61.           4.2.3.1 Load address -L
  62.           4.2.3.2 Jump address -J
  63.           4.2.3.3 Decr address - decruncher address -D
  64.           4.2.3.4 USP address - user stackpointer address -U
  65.           4.2.3.5 SSP address - system stackpointer address -S
  66.           4.2.3.6 SR - status register -R
  67.     4.2.4 Other options
  68.           4.2.4.1 Overwriting file -o0, -o1
  69.           4.2.4.2 DataID -i
  70.           4.2.4.3 Online info -d, ?
  71. 4.3 Multifile crunching
  72.  
  73. 5 Advanced info
  74. 5.1 Tips for using StoneCracker
  75. 5.2 Decrunch info header & decrunching
  76. 5.3 Hunk preprocessor
  77. 5.4 Includes & autodocs for stc.library
  78.  
  79.  
  80.              Don't get confused b'cos of my bad Engleesh!!
  81.     
  82.  
  83. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  84.                                 Document
  85.  
  86.  
  87.  
  88. 1 General info
  89.  
  90. 1.1     Disclaimer
  91.  
  92.         The author cannot be held liable for the suitability or accuracy
  93.         of this manual  and/or the program(s) it describes. Any damage
  94.         directly or indirectly caused by the use or misuse of this manual
  95.         and/or the program it describes is the sole responsibility of the
  96.         user her/him self.
  97.  
  98.  
  99.  
  100. 1.2     Copyright & Distribution
  101.  
  102.         StoneCracker v4.10.2 professional - written in C
  103.         (c) 1991-93 Jouni 'Mr.Spiv' Korhonen of StoneWare SoftWorks
  104.  
  105.         Stc.library v3.303 - written entirely in assembly
  106.         (c) 1993 jouni 'Mr.Spiv' Korhonen of StoneWare SoftWorks
  107.                & Marcus 'Cozine' Ottosson (optimized decrunchers!)
  108.  
  109.                         Jouni Korhonen
  110.                         Hiihtomajantie
  111.                         11120 Riihimaki
  112.                         Finland
  113.  
  114.                         Email: jikorhon@cc.helsinki.fi
  115.  
  116.  
  117.         Reqtools.library  (c) Nico François
  118.  
  119.         GadToolsBox  (c) 1992-93 Jaba Development
  120.  
  121.         StoneCracker (just Stc for now on) (c) StoneWare SoftWorks. All
  122.         rights reserved. This program is Public Domain as long as you
  123.         don't make any money with it.
  124.  
  125.         If you are interested in using this program in your commercial
  126.         products just contact me (use Email for faster reply).
  127.  
  128.         If you like this cruncher very much send some money, so I could
  129.         purchase a real accelerator or A1200.. 8^}
  130.  
  131.  
  132.  
  133. 1.3     Introduction to StoneCracker
  134.  
  135.         What Stc actually is? Stc is an executable/data/absolute file
  136.         cruncher, not an archiver. Powerpacker, Imploder and the others
  137.         do the same job as Stc but not so efficiently. Stc was designed
  138.         to fulfil my own needs and includes those features I think useful.
  139.  
  140.         Algorithm used in Stc is called S404. Some LZ variant I think but
  141.         entirely developed by me and you can notice it (slow & bad
  142.         efficiency). The name is actually a verion number, where S means
  143.         StoneCracker and 404 means v4.04. S404 uses 66Kb for a look ahead
  144.         buffer and 24Kb for a hash table to speedup crunching.
  145.  
  146.         Although S404 can't compete with well written LZH, lh5, etc
  147.         algorithms it still does the best result when compared to other
  148.         single file crunchers (Powerpacker, Imploder, Spike, Crm, etc).
  149.         It's faster and more efficient. Next version S405 already exists!
  150.         And it crunches slightly better (1Kb better per 150Kb).
  151.  
  152.         There are two versions of stc.library: stc.library for 68000/010
  153.         CPUs and stc020.library for 68020++ CPUs. If your Amiga has 68020++
  154.         Stc tries first open stc020.library instead of stc.library. The
  155.         difference between these libraries are that stc020.library uses
  156.         new addressing modes and takes the advantage of odd addresses. No
  157.         significant speed increasement though but faster anyway.
  158.  
  159.         You can use Stc either from commandline or GUI.
  160.  
  161.         From commandline multifile crunching with asterix '*' is possible
  162.         and from GUI with multiselect thru filerequester.
  163.  
  164.         Stc detects all S403 & S404 crunched files automatically and can
  165.         decrunch them.
  166.  
  167.         Cache support with all decrunchers. VBR check with kill OS
  168.         decruncher.
  169.  
  170.         Fast decrunchers! Thanks Marcus!
  171.  
  172.         I used A2000c 000/28MHz (poor man's accelerator) + kick2.04 + 5Mb
  173.         ram + 140Mb HD. I had 3Mb but I ran out of memory when compiling
  174.         the main C program 8^}  (Køøl.. And the program size is just 31908
  175.         bytes..)
  176.  
  177.  
  178.  
  179. 1.4     Requirements
  180.  
  181.         Stc works ok on stock A500. 512Kb will do but atleast 1Mb and
  182.         fast memory are more comfortable. There's no separate NTSC mode.
  183.         The custom screen is always opened to fit into NTSC (sorry PAL
  184.         users).
  185.  
  186.         Tested in KickStarts 1.3, 2.04 and 3.0.
  187.  
  188.         If you are using KickStart 1.3 remeber to use 1.3 version of
  189.         reqtools.library and gadtools13.library.
  190.  
  191.  
  192.  
  193. 1.5     Contents of the package
  194.  
  195.         This package should include following files:
  196.  
  197.          · stc                      31908 bytes ; main program
  198.          · stc.info                             ; an icon
  199.  
  200.          · libs/stc.library          5936 bytes ; any kick
  201.          · libs/stc020.library       5888 bytes ; any kick, 68020++
  202.          · libs/reqtools.library                ; kick2.0++
  203.          · libs13/reqtools.library              ; kick1.3++
  204.          · libs13/gadtools13.library            ; kick1.3++
  205.  
  206.          · docs/stc.doc                         ; this file
  207.  
  208.          · sources/optidec.s                    ; optimised S404 decruncher
  209.          · sources/cache.s                      ; set caches properly
  210.  
  211.  
  212. 1.6     The future
  213.  
  214.         For crying out loud there is no future with Stc. I have dropped
  215.         this project b'cos it's quite frustrating to develope your own
  216.         algorithm without any knowledge of already existing and better
  217.         algorithms. Also I think I should study some tree techniques to
  218.         improve the speed.
  219.  
  220.         If I ever release a new version of Stc, it will surely be based
  221.         on some already existing algorithm. (I found some interesting
  222.         sources from several ftp sites ;^)
  223.  
  224.         Of course minor bugfixes are possible...
  225.  
  226.  
  227.  
  228. 2 GUI Settings
  229.  
  230. 2.1     Filetypes
  231.  
  232. 2.1.1   Executable programs
  233.  
  234.         Executable programs are normal program files that you can run
  235.         from CLI or WorkBench. When you load any file, Stc first does
  236.         a filetype check for that file. If hunk_header is found from
  237.         the file Stc goes on with loading and hunk processing.
  238.         If there aren't hunk_header, filetype is internally changed to
  239.         data and Stc goes on with loading and crunching.
  240.  
  241.         Hunk processing means that the standard hunk structure of the
  242.         file is converted to Stc's own shorter form. Note! If your
  243.         program includes any debug, symbol, name or external hunks they
  244.         are deleted.
  245.  
  246.         At the moment Stc's hunk processor can handle following hunk
  247.         types: hunk_header, hunk_code, hunk_data, hunk_bss, hunk_reloc32,
  248.         hunk_symbol, hunk_debug, hunk_external, hunk_name and hunk_end.
  249.         Other hunk types will cause an error.
  250.  
  251.         For more info about Stc's hunk processor read 5.3.
  252.  
  253. 2.1.2   Data files
  254.  
  255.         When filetype data is selected, Stc doesn't care about the
  256.         contents of the file. Also no decruncher is attached to the
  257.         crunched file. Standard fileheader is attached to the file.
  258.         For more info read 5.2.
  259.  
  260. 2.1.3   Absolute programs
  261.  
  262.         Absolute programs are sign of *really* *bad* programming habbit on
  263.         Amiga. You better know what you are doing! Loaded file is handled
  264.         as a data file and a decruncher is attached to the crunched file.
  265.         The decruncher makes it possible to execute your absolute program
  266.         and after loading decrunch it into certain memory location.
  267.         Stc supports caches & VBR with absolute decrunchers.
  268.  
  269.  
  270.  
  271. 2.2     Decrunchers
  272.  
  273. 2.2.1   E-Decrunchers for executables
  274.  
  275. 2.2.1.1 Build in decruncher attaches a decruncher and a relocator to the
  276.         crunched file. Then it's possible to run crunched program as it
  277.         wasn't crunched. After decrunching the relocator allocates all
  278.         needed memory blocks for the program and the moves & relocates
  279.         the program run there.
  280.  
  281.         Before running decrunched & relocated program, both instruction and
  282.         data caches are flushed and the memory for crunched data is
  283.         freed. Build in decruncher works with all kickstarts.
  284.  
  285. 2.2.1.2 Library decruncher does everything that build in decruncher does
  286.         but needs to find stc.library from your system (libs drawer). The
  287.         advantage of the library decruncher is that it's much shorter
  288.         (just the opening code for stc.library and one function call)
  289.         and b'cos the routines in the library are highly optimized,
  290.         whole decrunching & relocating process takes much less time.
  291.  
  292. 2.2.2   A-Decrunchers for absolutes
  293.  
  294. 2.2.2.1 Normal decruncher is quite simple. It just decrunches your program
  295.         into certain memory location and runs it. The decruncher needs
  296.         only load address (see 2.2.3.1) and jump address (see 2.2.3.2).
  297.  
  298.         After decrunching both instruction and data caches are flushed.
  299.         Note! Exec function ClearCacheU() is used for that. So if you have
  300.         taken over the OS... BanG may happen!
  301.  
  302. 2.2.2.2 Plain decruncher is actually not a decruncher b'cos you can't run
  303.         it from CLI or WorkBench. Plain decruncher doesn't include any
  304.         hunks stuff (not runable..) or cachecode. Otherwise it works just
  305.         like normal decruncher.
  306.  
  307. 2.2.2.3 Professional decruncher is useful when you need to take over the OS
  308.         or decrunch your (long) program into very low memory. Following
  309.         things are done before decrunching:
  310.                 - CPU to supervisor (Exec function SuperVisor() )
  311.                 - All interrupts off ($7fff to IntEna)
  312.                 - All DMAs off ($7fff to DmaCon)
  313.                 - All internal drives are turned off
  314.                 - If 68010++ exists VBR is set to 0
  315.                 - USP is relocated (see 2.2.3.4)
  316.                 - SSP is relocated (see 2.2.3.5)
  317.                 - Decruncher code is moved (see 2.2.3.3)
  318.                 - If 68020++ exists caches are flushed (no OS anymore)
  319.         And after decrunching:
  320.                 - If 68020++ exists caches are flushed (no OS anymore)
  321.                 - Status register is modified (see 2.2.3.6)
  322.  
  323.         If decrunched program would overwrite even parts of the crunched
  324.         data then cruncher data is move in memory so that decrunching is
  325.         possible without lockups.
  326.  
  327. 2.2.3   Absolute decruncher defs
  328.  
  329. 2.2.3.1 Load address (in hexadecimales) is the memory location you want
  330.         your program to be decrunched.
  331.  
  332. 2.2.3.2 Jump address (in hexadecimals) is the start (run here) address of
  333.         your program.
  334.  
  335. 2.2.3.3 Decruncher address (in hexadecimals) is the memory location you
  336.         want to place the decruncher code. Used only with professional
  337.         decruncher (see 2.2.2.3).
  338.  
  339.         Don't place inside your stack memory or program memory. The code
  340.         is 284 (=$11c) bytes long.
  341.  
  342. 2.2.3.4 USP = user stackpointer address (in hexadecimals) is the top
  343.         memory location for your user stack. Used only wirh professional
  344.         decruncher.
  345.  
  346. 2.2.3.5 SSP = system stackpointer address (in hexadecimals) is the top
  347.         memory location for your system stack. SSP is used by the pro
  348.         decruncher, interrupts, traps etc. whenever the supervisor bit is
  349.         set in the status register (see 2.2.3.6). Used only with
  350.         professional decruncher.
  351.  
  352. 2.2.3.6 SR = status register is loaded with this value after decrunching.
  353.         Used only with professional decruncher.
  354.  
  355.  
  356.  
  357. 2.3     Packmode
  358.  
  359.         There are five packmodes available. The number 16K, 8K, etc means
  360.         the maximum distance S404 crunchroutine tries to find equal
  361.         strings. The higher the packmode value is the better the crunch
  362.         result is. Though with small files lower packmode value may give
  363.         better result than the highest value (testing.. testing..).
  364.  
  365.         The packmode doesn't affect to memory usage during crunching or
  366.         decrunching but the lower the packmode is the faster the cruncher
  367.         is.
  368.  
  369.  
  370.  
  371. 2.4     Seclen - security length
  372.  
  373.         This value has quite important role. Better way to say security
  374.         length is overlap distance. If source (crunched) and destination
  375.         (uncrunched) data overlap, the destination must be atleast
  376.         'security length' bytes in higher memory than the source. It will
  377.         quarantee 100% safe decrunching.
  378.  
  379.         Also if crunching fails at the begining of the file, increasing
  380.         the security length may solve the problem.
  381.  
  382.  
  383.  
  384. 2.5     DataID
  385.  
  386.         DataID is a string that is automatically added into every crunched
  387.         data file. For example is dataID is 'argh' then '.argh' is added
  388.         into crunched data files. If there isn't dataID nothing is added.
  389.  
  390.  
  391.  
  392. 2.6     Dest dir - Destination directory
  393.  
  394.         Destination directory is only used when you select multiple files
  395.         from the filerequester. Crunched & decrunched files are
  396.         automatically saved to destination directory. Empty destination
  397.         directory is equal to the directory you selected the files.
  398.  
  399.  
  400.  
  401. 2.7     Save prefs - save preferences
  402.  
  403.         Save preferences save the currect state of GUI gadgets and dataID
  404.         string into S: (s drawer) as stc.cfg.
  405.  
  406.         Stc.cfg is automatically loaded when GUI is used.
  407.  
  408.  
  409.  
  410. 3 Using GUI
  411.  
  412.         GUI aka Graphical User Interface. The GUI was originally developed
  413.         with Gadtoolsbox and after slight modifications it also works with
  414.         kick1.3 (uses gadtools13.library then).
  415.  
  416.         Here's a short list of different gadgets and what you can do with
  417.         them.
  418.  
  419. 3.1     Information gadgets
  420.  
  421. 3.1.1   File name shows the name of the loaded file (in buffer). If this
  422.         text gadget is empty there's no file in buffer.
  423.  
  424. 3.1.2   File length is the size in bytes of the file in the buffer.
  425.  
  426. 3.1.3   Processed length shows the file length after precossing hunks.
  427.         For data and absolute files processed length is the same as the
  428.         file length.
  429.  
  430. 3.1.4   Crunched length
  431.  
  432.         File length after crunching. The length also includes 16 bytes of
  433.         decrunch info header (see 5.2). 
  434.  
  435.  
  436.  
  437. 3.2     Output window
  438.  
  439.         The output window (console) on the right side of the screen is
  440.         mostly used to output some system messages. Some error messages
  441.         include '(de:???)' where 'de' means 'dos error'.
  442.  
  443.  
  444.  
  445. 3.3     Load file
  446.  
  447.         When you press this gadget a filerequester shows up and you can
  448.         select one or more files to crunch or decrunch.
  449.  
  450.         If you selected multiple files they are automatically saved to
  451.         destination directory. Also decrunching multiple files is
  452.         possible.
  453.  
  454.  
  455.  
  456. 3.4     Save file
  457.  
  458.         When you press this gadget a (save)filerequester shows up and you
  459.         can select or write a save file name and path.
  460.  
  461.         Note that if you selected multiple files only the last crunched &
  462.         decrunched file remains in buffer. The other ones are saved
  463.         automatically to the destination directory (see 2.6).
  464.  
  465.  
  466.  
  467. 3.5     Delete file
  468.  
  469.         When you press this gadget a filerequester shows up and you can
  470.         select one or more files to delete.
  471.  
  472.  
  473.  
  474. 3.6     Iconify
  475.  
  476.         Iconify will free all buffers, close some libraries, close window
  477.         and screens and free used resources.
  478.  
  479.         A little window is opened and when you press right mousebutton
  480.         over it Stc will restart.
  481.  
  482.  
  483.  
  484. 3.7     Quit
  485.  
  486.         Exit this marvellous program.
  487.  
  488.  
  489.  
  490. 3.8     Shortcuts
  491.  
  492.         Almost every gadget can also be used thru keyboard. Shortcut keys
  493.         are marked with underscore.
  494.  
  495.  
  496.  
  497. 4 Using commandline
  498.  
  499. 4.1     What I can do from commandline?
  500.  
  501.         Stc can do everything from commandline that from GUI except for
  502.         decrunching. Actually you have more possibilities b'cos you
  503.         don't have to always select from predefined values.
  504.  
  505.         It's possible to crunch multiple files at one time. Multifile
  506.         crunching is a bit limited though. Read 4.3 for more info.
  507.  
  508.         You can abort crunching any time with CTRL-C!
  509.  
  510.         The structure of commandline is as follows:
  511.  
  512.         stc [-<options>] [sourcefile(s)] [destdir]
  513.          ^        ^       ^               ^
  514.          |        |       |               |
  515.          |        |       |               +-----> Destination directory is
  516.          |        |       |                       not needed if you want
  517.          |        |       +--> Files to load.     save crunched files into
  518.          |        |            Asterix '*' may    same directory you loaded
  519.          |        |            be used.           files from.
  520.          |        |
  521.          |        +--> These are case sensitive. None is compulsory.
  522.          |
  523.          +--> Program name
  524.  
  525.         Note! There can be only one sourcefile name at the time!
  526.         And if there's no destdir, sourcedir is used as a destdir.
  527.  
  528.  
  529.  
  530. 4.2     List of options
  531.  
  532.     Note! All options are case sensitive and may be placed
  533.         everywhere in commandline.
  534.  
  535. 4.2.1   Filetypes
  536.  
  537.         -fe  (default) sets filetype executable and decruncher will be
  538.              build in.
  539.         -fel sets filetype executable and decruncher will be library.
  540.         -fd  sets filetype data.
  541.         -fa  sets filetype absolute and decruncher will be normal. Only
  542.              load address (see 2.2.3.1 & 4.2.3) and jump address (see
  543.              2.2.3.2 & 4.2.3) are needed.
  544.         -fap sets filetype absolute and decruncher is plain. Only load
  545.              address (see 2.2.3.1 & 4.2.3) and jump address (see 2.2.3.2 &
  546.              4.2.3) are needed.
  547.         -fak sets filetype absolute and decruncher will be professional.
  548.              All absolute decruncher defs are needed (see 2.2.3 & 4.2.3).
  549.  
  550. 4.2.2   Packmode
  551.  
  552.         -p0  (default) sets packmode 16K (14 bits). (see 2.3)
  553.         -p1  sets packmode 8K (13 bits). (see 2.3)
  554.         -p2  sets packmode 4K (12 bits). (see 2.3)
  555.         -p3  sets packmode 2K (11 bits). (see 2.3)
  556.         -p4  sets packmode 1K (10 bits). (see 2.3)
  557.  
  558. 4.2.3   Absolute decruncher defs
  559.  
  560. 4.2.3.1 Load address
  561.  
  562.         With -L option you define the decrunch memory location for your
  563.         program. E.g -L3f002 will decrunch your program starting from
  564.         address $3f002. Given value is always haxadecimal. (see 2.2.3.1)
  565.  
  566. 4.2.3.2 Jump address
  567.  
  568.         With -J option you define the start address of your program that
  569.         the decruncher calls after decrunching. E.g -J40000 jump into
  570.         address $40000 after decrunching. (see 2.2.3.2)
  571.  
  572.         Note! If you don't define jump address, Stc assumes it's the same
  573.         as load address.
  574.  
  575. 4.2.3.3 Decr address - decruncher address
  576.  
  577.         This option affects only to the professinal decruncher!
  578.  
  579.         With -D option you define the location of the decruncher code.
  580.         E.g -D100 moves decruncher to address $100.
  581.         (see 2.2.3.3)
  582.  
  583.         Decruncher address defaults to $100.
  584.  
  585. 4.2.3.4 USP address - user stackpointer address
  586.  
  587.         This option affect only to the professional decruncher!
  588.  
  589.     With -U option you define the location of user stackpointer. E.g
  590.         -U20000 moves the top of USP to address $20000. The stack is
  591.         reloaded with defined value before decrunching. The decruncher
  592.         uses SSP - system stackpointer so it doesn't matter even if the
  593.         decruncher code is over the stack area.
  594.         (see 2.2.3.4)
  595.  
  596. 4.2.3.5 SSP address - system stackpointer address
  597.  
  598.         This option affect only to the professional decruncher!
  599.  
  600.     With -S option you define the location of system stackpointer.
  601.         E.g -S20000 moves the top of SSP to address $20000. The stack is
  602.         reloaded with defined value before decrunching. The decruncher
  603.         uses SSP during decrunching!
  604.     (see 2.2.3.5)
  605.  
  606. 4.2.3.6 SR - status register
  607.  
  608.         This option affect only to the professional decruncher!
  609.  
  610.         With -R option you define the state of status register. E.g
  611.         -R2010 forces CPU to supervisor mode and sets C flag.
  612.  
  613.         Note! Reloading is done just before jumping into your program!
  614.  
  615.  
  616.  
  617. 4.2.4   Other options
  618.  
  619. 4.2.4.1 Overwriting file
  620.  
  621.     With option -o1 (default) Stc always checks the destination
  622.         directory if there is a file with a same name as your file.
  623.         If there is you are asked whether to overwrite it or not.
  624.  
  625.         -o0 option overwrites without any warning. Very useful if
  626.         you are crunching multiple files.
  627.  
  628. 4.2.4.2 DataID
  629.  
  630.         With -i option you can define the dataID string that is added
  631.         to every crunched data file's name. Default string is 'stc'.
  632.         Maximum string length is seven chars.
  633.  
  634.         E.g -ijouni adds '.jouni' to crunched data files. If you want
  635.         to save data files without any ID string use -i alone.
  636.  
  637. 4.2.4.3 Online info
  638.  
  639.         There are two short help texts included into Stc. With ? you
  640.         get a quick reference of all commandline options and witd -d
  641.         option you get a list of internal defults and an example how
  642.         to use commandline.
  643.  
  644.  
  645.  
  646. 4.3     Multifile crunching
  647.  
  648.         You can crunch multiple files in one shot. It's quite limited
  649.         though. If the source filename includes asterix '*' Stc tries to
  650.         replace the asterix '*' with any string, character or nothing.
  651.         Note! There can be only one source filename at the time.
  652.  
  653.         The destination directory defaults to source directory. So you
  654.         don't have to define any destination directory. If you define a
  655.         destination directory Stc tries to find it and if the directory
  656.         isn't found Stc asks you to generate one.
  657.  
  658.  
  659.  
  660. 5 Advanced info
  661.  
  662. 5.1     Tips for using StoneCracker
  663.  
  664.         · If you press enter in GUI load address string gadget will be
  665.           activated.
  666.  
  667.         · Loaded file remains in buffer until you load a new one and start
  668.           loading it. (GUI)
  669.  
  670.         · 'Abort crunching' gadget cancels all files if you had selected
  671.           multiple files to crunch. (GUI)
  672.  
  673.  
  674.  
  675. 5.2     Decrunch info header & decrunching
  676.  
  677.         Every file crunched with Stc4.02a or Stc4.10.2 has following header
  678.         (16 bytes) at the beginning of the crunched data:
  679.  
  680.             "S404" or "S403"    ; cruncher version - string
  681.             Security length     ; overlap size - longword
  682.             Original length     ; decrunched length - longword
  683.             Crunched length     ; crunched length - longword
  684.                .                ; crunched data starts
  685.                .
  686.                .
  687.  
  688.         Security length is always 16 + something.
  689.  
  690.         There are also two control words at the end of crunched data. For
  691.         historical reasons it's quite wierd. I'll explain it with a 
  692.         following picture:
  693.  
  694.         <<- Lower memory                           Higher memory ->>
  695.  
  696.                   +------------ Crunched length ------------+
  697.                   |                                         |
  698.         InfoHeader|......................LastWord|BitCounter|MaxBits
  699.                             ^                 ^       ^         ^
  700.                             |                 |       |         |
  701.             Crunched data --+                 |       |         |
  702.                                               |       |         |
  703.                          Last crunched word --+       |         |
  704.                                                       |         |
  705.            How many used bits there are in LastWord --+         |
  706.                                                                 |
  707.                          Efficiency (packmode - only in S404) --+
  708.  
  709.         If both crunched data and destination memory overlap there must
  710.         be atleast 'Security length' distance between the start of the
  711.         crunched data and the start of the destination memory:
  712.  
  713.         <<- Lower memory                               Higher memory ->>
  714.  
  715.                   <<<-------------- Decrunching direction --------------
  716.  
  717.         InfoHeader|......................LastWord|BitCounter|MaxBits
  718.         ^
  719.         |             |<------------ Destination memory starts here ....
  720.         |             |
  721.         +-- SecLen ---+
  722.         |
  723.         +---------------> Crunched data starts here..
  724.  
  725.  
  726.  
  727. 5.3     Hunk preprocessor
  728.  
  729.         Every executable file is first preprocessed before crunching.
  730.         Processed files are always shorter than originals. Preprocessor
  731.         does the following for hunks:
  732.  
  733.           · All debug hunks generated by compiler are deleted (no way to
  734.             get them back!).
  735.           · There are no Hunk_ends
  736.           · Hunk header info at the beginning of the file is modified to
  737.             a shorter form:
  738.                   1 longword = (total number of hunks)-1 (=n)
  739.                 n+1 longwords = hunksizes & memory type (as normally)
  740.           · Hunk_code is converted to %01xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.L
  741.                                          +-------- datasize>>2 -------+
  742.           · Hunk_data is converted to %11xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.L
  743.                                          +-------- datasize>>2 -------+
  744.           · Hunk_bss is converted to %100000000000000000.W
  745.           · Hunk_reloc start with %000000000000000000.W and then
  746.             Repeat until (number of relocentries) = 0
  747.               1 word = number of relocentries (null if no relocs anymore)
  748.               1 word = relocate hunk number..
  749.               1 longword = %bbbbbbbbxxxxxxxxxxxxxxxxxxxxxxxx.L
  750.                             ^       +----- First reloc ----+
  751.                             |
  752.                             +--> Number of bytes to add to 'First reloc'
  753.                                    2       = 3 bytes per relocentry
  754.                                    4 or 6  = 2 bytes per relocentry
  755.                                    8 or 10 = 1 byte per relocentry
  756.                                    ?       = only one relocentry
  757.               followed by (number of relocentries) %bbbbbbbb reloc-
  758.               entries..
  759.           · End of processed hunks is %1111111111111111.W
  760.  
  761.  
  762.  
  763. 5.4     Includes & autodocs for stc.library
  764.  
  765.         There are proper include files for standard assemblers (atleast
  766.         DevPac and AsmOne understand them) and SAS/C.
  767.  
  768.         I haven't written any good autodocs. This document was already
  769.         enough. But if you are really interested in how to use
  770.         stc.library just post me and I'll send you the includes and
  771.         short autodocs.
  772.  
  773.         Btw.. include files for stc.library are a messish pile of shit!
  774.  
  775.  
  776.  
  777. MOVEQ #0,d0
  778. RTS                     ; succesful exit
  779.