home *** CD-ROM | disk | FTP | other *** search
/ Dream 44 / Amiga_Dream_44.iso / Amiga / programmation / AStripI.lha / astripi / AStripI.doc next >
Text File  |  1997-09-02  |  9KB  |  292 lines

  1.  
  2.  
  3.  
  4.                           AStripI v2.0
  5.  
  6.                           (05.09.1997)
  7.  
  8.                          by Cliff Earl
  9.  
  10.                       (cee@voyager.co.nz)
  11.  
  12.                      ⌐ 1997 Antix Software
  13.  
  14.  
  15.  
  16. CONTENTS:
  17.  
  18.   0. READ THIS!!!
  19.   1. ABOUT THE PROGRAM
  20.   2. HOW IT WORKS
  21.   3. NOTES
  22.   4. ABOUT THE SOURCE
  23.  
  24.  
  25.  
  26. 0. READ THIS!!!
  27.  
  28.   Before  you go off running AStripI on your includes you should
  29. read   this   document   right   through   and  understand  what
  30. consequences there are of being ignorant of what AStripI will do
  31. to  them!!   I  take  no responsability for any damage caused to
  32. your includes or your system!!!
  33.  
  34.   This  program is Copyright ⌐ 1996-1997 by Antix Software.  You
  35. are  not allowed to make a profit by selling this program and/or
  36. it's associated files.  It may be distributed for free only.
  37.  
  38.   People  wishing  to  include this program on a CoverDisk or CD
  39. then they should send me a free copy of the CD or Magazine which
  40. contains this program.
  41.  
  42.   If  you  have  suggestions,  comments,  flames, gifts, or just
  43. wanna chat about ASM programming then contact me..
  44.  
  45. EMail:    cee@voyager.co.nz
  46.  
  47. Snail:    Cliff Earl,
  48.     P.O Box 159,
  49.     Otaki,
  50.     New Zealand.
  51.  
  52. Phone:    +64 6 364 5667
  53.  
  54.  
  55.  
  56. 1. ABOUT THE PROGRAM:
  57.  
  58.   Yep,  I  finally  have  started to program the OS quite a lot.
  59. The  problem I have is that the C= includes are dead slow to use
  60. on my ECS A2000 68000.  AStripI's the answer :^)
  61.  
  62.   What AStripI does is optimize assembly language include files.
  63. As  another side benefit, AStripI reduces the size ofthe include
  64. files  a  whole  lot.   Oh  yes,  AStripI  is  ONLY for assembly
  65. includes!!
  66.  
  67. Enjoy,
  68.       Cliff Earl.
  69.  
  70.  
  71.  
  72. 2. HOW IT WORKS:
  73.  
  74.   In  version 1.0 AStripI had to be run seperatly on every file.
  75. This was great if you only wanted to strip a single include file
  76. but not very efficient when stripping multiple files.
  77.  
  78.   As  of  version 2.0 AStripI goes through all files and subdirs
  79. in  the specified directory and does it's magic on each of them.
  80. AStripI  will not overwrite your original include files, instead
  81. it  will  write it's own include file back to the same directory
  82. as  the  original one.  it will prepend "a_" at the start of the
  83. name,  so  the  file "execbase.i" would be written to a new file
  84. called  "a_execbase.i".   All the references inside the new file
  85. will be to other a_includes and not the original ones.
  86.  
  87.  
  88.   To  run AStripI just type it's name from CLI or Shell.  In the
  89. case  where  you  supply  no options then it will be the same as
  90. typing "AStripI -d INCLUDE: -r 100 -w 120".
  91.  
  92. The options...
  93.  
  94.   The  -q  option  is  used to suppress output by AStripI.  It's
  95. sometimes nice to see what a program is doing eh?
  96.  
  97.   The  -d  option  is  used  to  specify the directory where the
  98. include  files  you  want  stripped  are  present.   Defaults to
  99. INCLUDE:  if not present.
  100.  
  101.   The  -r option is used to specify the read buffer size.  Every
  102. file  that gets loaded will get loaded into this buffer.  If the
  103. file  is bigger than the buffer you will be notified (unless you
  104. have  specified -q).  The size is in KiloBytes.  Defaults to 100
  105. if not supplied.
  106.  
  107.   The  -w  option is used to specify the size of the strip/write
  108. buffer.   All a_include files will be generated and saved to and
  109. from  this  buffer.   If not present will default to 128.  NOTE:
  110. There is no checking if this buffer gets overrun!!  so make sure
  111. you specify at least 28kb more than your biggest include file.
  112.  
  113.  
  114.   Now  I'll show you what an uustripped file looks like and what
  115. a stripped file looks like.  Here's (example only) an unstripped
  116. include file..
  117.  
  118.  
  119.     IFND    CRAPTEST_I
  120. CRAPTEST_I    SET    1
  121. **
  122. **    $VER: craptest.i 0.01 (28.5.92)
  123. **    Includes Release 40.13
  124. **
  125. **    A test of AStripI's ability to greatly decrease the size of
  126. **    include files and make them HEAPS faster...
  127. **
  128. **    (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  129. **        All Rights Reserved
  130. **
  131.  
  132.     IFND EXEC_NODES_I
  133.     INCLUDE "exec/nodes.i"
  134.     ENDC    ; EXEC_NODES_I
  135.  
  136. *---------------------------------------------------------------------
  137.  
  138. *
  139. * Full featured list header
  140. *
  141.    STRUCTURE    LH,0
  142.     APTR    LH_HEAD
  143.     APTR    LH_TAIL
  144.     APTR    LH_TAILPRED
  145.     UBYTE    LH_TYPE
  146.     UBYTE    LH_pad
  147.     LABEL    LH_SIZE ;word aligned
  148.  
  149. *
  150. * Minimal List Header - no type checking (best for most applications)
  151. *
  152.    STRUCTURE    MLH,0
  153.     APTR    MLH_HEAD
  154.     APTR    MLH_TAIL
  155.     APTR    MLH_TAILPRED
  156.     LABEL    MLH_SIZE ;longword aligned
  157.  
  158. *---------------------------------------------------------------------
  159.  
  160. ;Prepare a list header for use
  161. NEWLIST     MACRO   ; list
  162.         MOVE.L  \1,LH_TAILPRED(\1)
  163.         ADDQ.L  #4,\1    ;Get address of LH_TAIL
  164.         CLR.L   (\1)    ;Clear LH_TAIL
  165.         MOVE.L  \1,-(\1)    ;Address of LH_TAIL to LH_HEAD
  166.         ENDM
  167.  
  168.     BITDEF    CACR,EnableI,0        ;Enable instruction cache
  169.     BITDEF    CACR,FreezeI,1        ;Freeze instruction cache
  170.     BITDEF    CACR,ClearI,3        ;Clear instruction cache
  171.     BITDEF    CACR,IBE,4        ;Instruction burst enable
  172.  
  173.     ENDC    ; CRAPTEST_I
  174.  
  175.  
  176.   You  might  notice  that  the normal include files are bloated
  177. with  comments  and usually contain extraneous space chars, most
  178. likely  because  the  C= guys were all "C" programmers.  Did you
  179. know  that  all  those  words like STRUCT, BITDEF, APTR, etc are
  180. actually  all  MACRO's?   This  is  what  makes  your  poor  old
  181. assembler choke so much, especially on a 68000 Amiga.  Now let's
  182. see the file that AStripI would make out of this...
  183.  
  184.  
  185.                 IFND    CRAPTEST_I
  186. CRAPTEST_I
  187.                 IFND    EXEC_NODES_I
  188.                 INCLUDE    "exec/a_nodes.i"
  189.                 ENDC
  190.                 RSRESET
  191. LH_HEAD                rs.l    1
  192. LH_TAIL                rs.l    1
  193. LH_TAILPRED            rs.l    1
  194. LH_TYPE                rs.b    1
  195. LH_pad                rs.b    1
  196. LH_SIZE                rs.b    0
  197.                 RSRESET
  198. MLH_HEAD            rs.l    1
  199. MLH_TAIL            rs.l    1
  200. MLH_TAILPRED            rs.l    1
  201. MLH_SIZE            rs.b    0
  202. CACRB_EnableI            =    0
  203. CACRF_EnableI            =    1<<0
  204. CACRB_FreezeI            =    1
  205. CACRF_FreezeI            =    1<<1
  206. CACRB_ClearI            =    3
  207. CACRF_ClearI            =    1<<3
  208. CACRB_IBE            =    4
  209. CACRF_IBE            =    1<<4
  210.                 ENDC
  211.  
  212.  
  213.   See how much smaller our new file is?  It's only about a third
  214. of  the original's size.  The file could be made even smaller by
  215. not padding the lines out to 32 chars with tabs.
  216.  
  217.   Now  would  be  a  good time to mention that if your assembler
  218. does  not  support  rs.b,  rs.w, and rs.l then you should delete
  219. AStripI  right  away,  it's  not  for  you..
  220.  
  221.   Ok.   You  might  be  wondering  where the NEWLIST macro went?
  222. Well  AStripI  does  not  like  those macros so it deletes them.
  223. Some  people  might be aghast that the lovely C= macros are cast
  224. into  the  void but since the C= macros don't get used in any of
  225. the  generated  code  they just get trashed.  If you want to run
  226. AStripI  on  your  own custom include files you better make sure
  227. you  aren't going to need the macro's if they contain any.  As a
  228. practise  you  should  keep  your macros in their own files like
  229. "dos.macros",  or "exec.macros".  So remember..  ALL MACROS WILL
  230. BE REMOVED!!!!
  231.  
  232.   So  you should be able to deduce from the example above if you
  233. want to use AStripI on your includes.
  234.  
  235.  
  236.   - AStripI  will  skip  any files that do  not end with .i.  So
  237.     AStripI  would  strip  the  file "mycoolinclude.i" but would
  238.     ignore the file "mycoolsource.s".
  239.  
  240.   - AStripI  will  skip  any  file  starting  with the  longword
  241.     $f9faf9fa.  That's the identifier of an ASM-One source file.
  242.     so all those files will be safe :^)
  243.  
  244.   - AStripI  will  skip  any  file  that begins with the 4  byte
  245.     character  string  ";ASM".   This  is an easy way for you to
  246.     protect any macro files you might have.
  247.  
  248.   Please  note  that I only use the term protect very loosely as
  249. AstripI does not actually overwrite any files that it strips.
  250.  
  251.  
  252.  
  253. 3. NOTES:
  254.  
  255. Ok some quick notes now as they roll out of my head...
  256.  
  257.   - Tested on the 3.1 includes and it works fine..
  258.  
  259.   - AStripI runs from CLI or SHELL ONLY!!!
  260.  
  261.   - the best way to use AStripI is to unarchive  the original C=
  262.     includes  into  RAM:   or a TEMP:  if you have only a little
  263.     ram.   Then  run  AStripI  on the includes there.  Remember,
  264.     AStripI  will  not modify the original include file but will
  265.     make another new one prepended with "a_".
  266.  
  267.   - Can corrupt your dos/dos_lib.i file.  That include uses some
  268.     corny  "LIBENT" macro to do it's _LVO's.  It's the  only one
  269.     to  my  knowledge  that does this and IMHO it should die :^)
  270.     All lvo's should live in the lvo dir anyway.
  271.  
  272.  
  273.  
  274. 4. ABOUT THE SOURCE:
  275.  
  276.   The full source to AStripI is included in the archive.  For it
  277. to  work you will need to copy the files from the include drawer
  278. into your own include drawer.
  279.  
  280.   The  source  will  assemble  in  ASM-One  and is not tested in
  281. DevPac or any other assembler.
  282.  
  283.   The  source  is  NOT  commented  and  is  a  bit messy but any
  284. programmer worth his salt should easily be able to get a hold of
  285. what's  going on and be able to modify the program with relative
  286. ease.
  287.  
  288.   As  mentioned,  the  source is messy.  This was only done as a
  289. quick hack.  If you improve the source you should let me know.
  290.  
  291. end.
  292.