Subversion Repositories Kolibri OS

Rev

Rev 109 | Blame | Last modification | View Log | Download | RSS feed

  1. @RCHER FOR MENUET v1.0        July 14, 2005
  2.  Written in pure assembler by Ivushkin Andrey aka Willow
  3.  
  4. Deflate unpacker
  5.  
  6. Vivat assembler et MENUETOS!
  7. I tender thanks to everyone who spends his time in feasible effortsfor that
  8. little OS evolution. Now in my own rating the Mario79's distro named Kolibri4
  9. takes 1th place. It is always pleasant to use modern software. Go on!
  10.  
  11. @RCHER is intended to view & unpack data compressed by Deflate method
  12. (including both static and dynamic Huffman). This method (although it isn't the
  13. best already) is used by such file formats as ZIP (modern versions: PKZIP for
  14. MS-DOS can create archives using other, less effective compression methods,
  15. which @RCHER doesn't support), GZIP, JAR, OpenOffice files, SFX ZIP executables
  16. and some others. I couldn't prevent myself to include support of PNG images
  17. (they use the similar compression) and TAR and TAR+GZIP archives.
  18.  
  19. When the program is started, a little button carrying a @ symbol appears in the
  20. left top corner of screen. Clicking this button opens a SYSXTREE dialog to
  21. select a file being unpacked. Doubleclick closes the application. @RCHER
  22. outputs its information messages to Debug Board. If an archive contains more
  23. than  one file, the 1st is by default unpacked into /HD/1/OUT.TXT (you may
  24. change the DUMPFILE constant in @RCHER.ASM) and is opened  through TINYPAD
  25. or - if it's a PNG image - in the built-in viewer.
  26.  
  27. These are unpacking flags that may exist in a commandline before an archive
  28. filename:
  29.  
  30.   s - do not close the program after unpacking;
  31.   n - decompress the K-th archive file, where K is the following dword in
  32.       commandline;
  33.   N - decompress the K-th archive file, where K is ASCII number from the
  34.       following 6 bytes of commandline;
  35.   R - "raw" Deflate data, without descriptors and headers;
  36.   q - begin file parsing from offset of K, where K is following dword in
  37.       commandline;
  38.   Q - begin file parsing from offset of K, where K is ASCII number from the
  39.       following 6 bytes of commandline.
  40.  
  41. Commandline example:
  42.  
  43. cmd_string:
  44.    db  'sN000037q'
  45.    dd  1465
  46.    db  '/hd/1/png.zip',0
  47.  
  48. It means to open the 34th (counting from 0) file of archive /hd/1/png.zip
  49. and do not terminate. Archive will be parsed starting at offset 1465.
  50.  
  51.  
  52. To-Do list:
  53.  
  54. 1. Support for interlaced PNG, alpha-channels, gamma-correction, background,
  55.    Significant bits and a lot of cool parts of that format.
  56. 2. Output of archive content through IPC or into a built-in window like SYSTREE
  57.    (as we are going to decide with the respected colleagues).
  58. 3. Searching of archive files by name and wildcards!
  59. 4. Unpacking into a file specified.
  60. 5. Means on saving memory space (now @RCHER gorges 8 Mb!): moving RAM areas,
  61.    blocked file output. To do the last thing it is necessary to test carefully
  62.    the reliability of harddisk I/O, directory creation and file deletion. These
  63.    kernel capabilities aren't still documented.
  64. 6. Archive contents integration into SYSXTREE & MFAR filemanagers. We have to
  65.    unify the calling format (like a structure in the sysfunc 58).
  66. 7. Add comments to source.
  67. 8. Correct bugs to be found
  68.  
  69. Special thanks to:
  70.  
  71.   Explanation of algorythm of Deflate format decoder with decoding samples
  72.      (evm.narod.ru)
  73.   RFC 1951 DEFLATE Compressed Data Format Specification version 1.3
  74.   ZIP File Format Specification version 4.5 by PKWARE Inc.
  75.   "An Explanation of the Deflate Algorithm" by Antaeus Feldspar
  76.   RFC 1952 GZIP file format specification version 4.3
  77.   TAR Format. Information from File Format List 2.0 by Max Maischein.
  78.   RFC 1950 ZLIB Compressed Data Format Specification version 3.3
  79.   PNG (Portable Network Graphics) Specification version 1.0
  80.   Michael Dipperstein's Huffman Code Page
  81.  
  82. I expect your remarks and suggestions on the @RCHER's topic, "Coding" section
  83. at meos.sysbin.com forum.
  84.  
  85. See you later!
  86.  
  87.  
  88. ****************************************
  89. ****************************************
  90.  
  91. @RCHER „‹Ÿ MENUET v1.0       14 ¨î«ï 2005 £.
  92.   ¯¨á ­  ­  ç¨á⮬  áᥬ¡«¥à¥ ˆ¢ã誨­ë¬ €­¤à¥¥¬ (Willow)
  93.  
  94. Deflate à á¯ ª®¢é¨ª
  95.  
  96. Vivat assembler et MenuetOS!
  97. ‚ëà ¦ î ¨áªà¥­­îî ¡« £®¤ à­®áâì ¢á¥¬ ⥬, ªâ® ­¥ ¦ «¥ï ᢮¥£® ¢à¥¬¥­¨,
  98. ¤¥« ¥â ¯®á¨«ì­ë© ¢ª« ¤ ¢ à §¢¨â¨¥ í⮩ ¬ «¥­ìª®© Ž‘. ‘¥©ç á ¢ ¬®¥¬ ᮡá⢥­­®¬
  99. ३⨭£¥ 1-¥ ¬¥áâ® § ­¨¬ ¥â ¤¨áâਡã⨢ Mario79 Kolibri4. ‚ᥣ¤  ¯à¨ïâ­®
  100. ¯®«ì§®¢ âìáï ᮢ६¥­­ë¬ Ž. ’ ª ¤¥à¦ âì!
  101.  
  102. @RCHER ¯à¥¤­ §­ ç¥­ ¤«ï ¯à®á¬®âà  ¨ à á¯ ª®¢ª¨ ¤ ­­ëå, ᦠâëå á ¯®¬®éìî ¬¥â®¤ 
  103. Deflate (¢ª«îç ï áâ â¨ç¥áª¨© ¨ ¤¨­ ¬¨ç¥áª¨© • ä䬠­). „ ­­ë¬ ¬¥â®¤®¬ (å®âï ®­
  104. 㦥 ­¥ ¯à¥â¥­¤ã¥â ­  §¢ ­¨¥ ­ ¨«ãç襣®) ¯®«ì§ãîâáï ä®à¬ âë ä ©«®¢ ZIP
  105. (ᮢ६¥­­ë¥ ¢¥àᨨ: PKZIP ¤«ï MS-DOS ¬®¦¥â ᮧ¤ ¢ âì  à娢ë á ¤à㣨¬¨, ¬¥­¥¥
  106. íä䥪⨢­ë¬¨ ¬¥â®¤ ¬¨ ᦠâ¨ï, ª®â®àë¥ @RCHER ­¥ ¯®¤¤¥à¦¨¢ ¥â), GZIP, JAR,
  107. ä ©«ë OpenOffice, SFX-ZIP ¯à¨«®¦¥­¨ï ¨ àï¤ ¤à㣨å. Ÿ ­¥ ¬®£ 㤥ঠâìáï ¨ ­¥
  108. ᤥ« âì ¯®¤¤¥à¦ªã ¨§®¡à ¦¥­¨© ¢ ä®à¬ â¥ PNG (¨á¯®«ì§ãîé¨å தá⢥­­ë© ¬¥â®¤
  109. ᦠâ¨ï) ¨  à娢®¢ TAR ¨ TAR+GZIP.
  110.  
  111. à¨ § ¯ã᪥ ¯à®£à ¬¬ë ¢ «¥¢®¬ ¢¥àå­¥¬ 㣫ã íªà ­  ¯®ï¢«ï¥âáï ¬ «¥­ìª ï ª­®¯ª 
  112. á® §­ çª®¬ @. à¨ ­ ¦ â¨¨ ­  ­¥¥ ®âªà뢠¥âáï ®ª­® ¢ë¡®à  ä ©«  (SYSXTREE) ¤«ï
  113. à á¯ ª®¢ª¨. „¢®©­®© 饫箪 § ªà뢠¥â ¯à¨«®¦¥­¨¥. ˆ­ä®à¬ æ¨®­­ë¥ á®®¡é¥­¨ï
  114. @RCHER ¢ë¢®¤¨â ­  ¤®áªã ®â« ¤ª¨. …᫨  à娢 ᮤ¥à¦¨â ­¥áª®«ìª® ä ©«®¢, ¯®
  115. 㬮«ç ­¨î ¯¥à¢ë© ¨§ ­¨å à á¯ ª®¢ë¢ ¥âáï ­  /HD/1/OUT.TXT (¯®¬¥­ï©â¥ ¯à¨
  116. ­¥®¡å®¤¨¬®á⨠ª®­áâ ­âã DUMPFILE ¢ @RCHER.ASM) ¨ ®âªà뢠¥âáï  ç¥à¥§ TINYPAD
  117. ¨«¨ - ¢ á«ãç ¥ ª à⨭ª¨ PNG - ¢ ®ª­¥ ¢áâ஥­­®£® ¯à®á¬®âà騪 .
  118.  
  119. ‚ ª®¬ ­¤­®© áâப¥ ¯¥à¥¤ ¨¬¥­¥¬  à娢  ¬®£ãâ ¢ ¯à®¨§¢®«ì­®¬ ¯®à浪¥ 㪠§ë¢ âìáï
  120. ä« £¨ à á¯ ª®¢ª¨:
  121.  
  122.   s - ­¥ § ªà뢠âì ¯à®£à ¬¬ã ¯®á«¥ à á¯ ª®¢ª¨;
  123.   n - à á¯ ª®¢ âì K-© ä ©«  à娢 , £¤¥ K - á«¥¤ãî騩 dword ¢ ª®¬ ­¤­®© áâப¥;
  124.   N - à á¯ ª®¢ âì K-© ä ©«  à娢 , £¤¥ K - ASCII ç¨á«® ¨§ á«¥¤ãîé¨å 6 ¡ ©â
  125.       ª®¬ ­¤­®© áâப¨;
  126.   R - "áëàë¥" Deflate-¤ ­­ë¥, ¡¥§ ®¯¨á â¥«¥© ¨ § £®«®¢ª®¢;
  127.   q - ¯à®á¬®âà ä ©«  ­ ç âì ᮠᬥ饭¨ï K, £¤¥ K - á«¥¤ãî騩 dword ¢ ª®¬ ­¤­®©
  128.       áâப¥;
  129.   Q - ¯à®á¬®âà ä ©«  ­ ç âì ᮠᬥ饭¨ï K, £¤¥ K - ASCII ç¨á«® ¨§ á«¥¤ãîé¨å 6
  130.       ¡ ©â ª®¬ ­¤­®© áâப¨.
  131.  
  132. à¨¬¥à ª®¬ ­¤­®© áâப¨:
  133.  
  134. cmd_string:
  135.    db  'sN000037q'
  136.    dd  1465
  137.    db  '/hd/1/png.zip',0
  138.    
  139. â® ®§­ ç ¥â, çâ® á«¥¤ã¥â ®âªàëâì 34-© (áç¨â ï ®â 0) ä ©«  à娢  /hd/1/png.zip
  140. ¨ ­¥ § ¢¥àè âì à ¡®âã. à®á¬®âà  à娢  ­ ç­¥âáï ᮠᬥ饭¨ï 1465.
  141.  
  142.  
  143. —â® ¥é¥ ­ã¦­® ᤥ« âì:
  144.  
  145. 1. ®¤¤¥à¦ª  ç¥à¥ááâà®ç­ëå (interlaced) PNG,   â ª¦¥  «ìä -ª ­ «®¢, £ ¬¬ë,
  146.    ä®­ , Significant bits ¨ ªãç¨ ¤àã£¨å ¯à¨¬®ç¥ª í⮣® ä®à¬ â .
  147. 2. ‚뢮¤ ᮤ¥à¦¨¬®£®  à娢®¢ ç¥à¥§ IPC ¨«¨ ¢® ¢áâ஥­­®¬ ®ª­¥ ­ ¯®¤®¡¨¥ SYSTREE
  148.    (íâ® ª ª à¥è¨¬ á 㢠¦ ¥¬ë¬¨ ª®««¥£ ¬¨).
  149. 3. ®¨áª ä ©«®¢ ¢  à娢¥ ¯® ¨¬¥­¨ ¨ ¤ ¦¥ ¬ áª¥!
  150. 4.  á¯ ª®¢ª  ¢ 㪠§ ­­ë© ä ©«.
  151. 5. Œ¥à®¯à¨ïâ¨ï ¯® íª®­®¬¨¨ ¯ ¬ï⨠(ᥩç á @RCHER ¦à¥â 8 Œ¡!): ¯¥à¥¬¥é¥­¨¥
  152.    ãç á⪮¢ ¯ ¬ïâ¨, ¡«®ç­ë© ¢ë¢®¤ ¢ ä ©«. „«ï ¯®á«¥¤­¥£® ­¥®¡å®¤¨¬® âé â¥«ì­®
  153.    ¯à®â¥áâ¨à®¢ âì ­ ¤¥¦­®áâì ¢®®¤ -¢ë¢®¤  ­  †„, ᮧ¤ ­¨ï ª â «®£®¢ ¨ 㤠«¥­¨ï
  154.    ä ©«®¢. ®ª  í⨠¢®§¬®¦­®á⨠ï¤à  ­¥ ¤®ªã¬¥­â¨à®¢ ­ë.
  155. 6. ˆ­â¥£à æ¨ï  à娢­ëå ª â «®£®¢ ¢ ä ©«®¢ë¥ ¬¥­¥¤¦¥àë SYSXTREE, MFAR.
  156.    ®âॡã¥âáï ã­¨ä¨æ¨à®¢ âì ä®à¬ â ¢ë§®¢  (­ ¯®¤®¡¨¥ áâàãªâãàë ¢ 58 ä㭪樨).
  157. 7. Žâª®¬¬¥­â¨à®¢ âì ª®¤.
  158. 8. ˆá¯à ¢¨âì ¡ £¨, ª®â®àë¥, ­¥á®¬­¥­­®, ­ ©¤ãâáï ;-)
  159.  
  160. Žá®¡ë¥ ¡« £®¤ à­®áâ¨:
  161.  
  162.   Ž¯¨á ­¨¥  «£®à¨â¬  ¤¥ª®¤¥à  ä®à¬ â  Deflate ­  ¯à¨¬¥à å ¤¥ª®¤¨à®¢ ­¨ï
  163.      (evm.narod.ru)
  164.   RFC 1951 DEFLATE Compressed Data Format Specification version 1.3
  165.   ZIP File Format Specification version 4.5 by PKWARE Inc.
  166.   "An Explanation of the Deflate Algorithm" by Antaeus Feldspar
  167.   RFC 1952 GZIP file format specification version 4.3
  168.   TAR Format. Information from File Format List 2.0 by Max Maischein.
  169.   RFC 1950 ZLIB Compressed Data Format Specification version 3.3
  170.   PNG (Portable Network Graphics) Specification version 1.0
  171.   Michael Dipperstein's Huffman Code Page
  172.  
  173. †¤ã ¢ è¨å § ¬¥ç ­¨© ¨ ¯à¥¤«®¦¥­¨© ­  ®¤­®¨¬¥­­®© ¢¥âª¥ à §¤¥«  "Š®¤¨­£" ä®à㬠
  174. meos.sysbin.com
  175.  
  176. „® ­®¢ëå ¢áâà¥ç!
  177.