pst-ttup.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. | TIGCC Program Starter - ttunpack decompression support
  2. | Copyright (C) 2004-2005 Samuel Stearley, Kevin Kofler
  3. |
  4. | THE LICENSE:
  5. |
  6. | wxWindows Library Licence, Version 3.1
  7. | ======================================
  8. |
  9. | Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al
  10. |
  11. | Everyone is permitted to copy and distribute verbatim copies
  12. | of this licence document, but changing it is not allowed.
  13. |
  14. | WXWINDOWS LIBRARY LICENCE
  15. | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  16. |
  17. | This library is free software; you can redistribute it and/or modify it
  18. | under the terms of the GNU Library General Public Licence as published by
  19. | the Free Software Foundation; either version 2 of the Licence, or (at
  20. | your option) any later version.
  21. |
  22. | This library is distributed in the hope that it will be useful, but
  23. | WITHOUT ANY WARRANTY; without even the implied warranty of
  24. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
  25. | General Public Licence for more details.
  26. |
  27. | You should have received a copy of the GNU Library General Public Licence
  28. | along with this software, usually in a file named COPYING.LIB. If not,
  29. | write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  30. | Boston, MA 02111-1307 USA.
  31. |
  32. | EXCEPTION NOTICE
  33. |
  34. | 1. As a special exception, the copyright holders of this library give
  35. | permission for additional uses of the text contained in this release of
  36. | the library as licenced under the wxWindows Library Licence, applying
  37. | either version 3.1 of the Licence, or (at your option) any later version of
  38. | the Licence as published by the copyright holders of version
  39. | 3.1 of the Licence document.
  40. |
  41. | 2. The exception is that you may use, copy, link, modify and distribute
  42. | under your own terms, binary object code versions of works based
  43. | on the Library.
  44. |
  45. | 3. If you copy code from files distributed under the terms of the GNU
  46. | General Public Licence or the GNU Library General Public Licence into a
  47. | copy of this library, as this licence permits, the exception does not
  48. | apply to the code that you add in this way. To avoid misleading anyone as
  49. | to the status of such modified files, you must delete this exception
  50. | notice from such code and/or adjust the licensing conditions notice
  51. | accordingly.
  52. |
  53. | 4. If you write modifications of your own for this library, it is your
  54. | choice whether to permit this exception to apply to your modifications.
  55. | If you do not wish that, you must delete the exception notice from such
  56. | code and/or adjust the licensing conditions notice accordingly.
  57. | GET_UNCOMPRESSED_SIZE inline function
  58. | INPUT: %a3.l: pointer to compressed data
  59. | OUTPUT: %d6.l: uncompressed size
  60. | SIDE EFFECTS: throws a Data Type error if not a valid compressed program
  61. | may throw a Memory error
  62. | may advance %a3 for later decompression
  63. | DESTROYS: %d0-%d2/%a0-%a1
  64. .macro GET_UNCOMPRESSED_SIZE
  65. | Get the length of the variable.
  66. moveq.l #0,%d6
  67. move.w (%a3)+,%d6
  68. | Get a pointer to the data type of the variable.
  69. lea.l -1(%a3,%d6.l),%a0
  70. | Check if it has type "ppg".
  71. cmp.b #0xf8,(%a0)
  72. jbne invalid_archive
  73. tst.b -(%a0)
  74. jbne invalid_archive
  75. cmp.b #'g',-(%a0)
  76. jbne invalid_archive
  77. moveq.l #'p',%d0
  78. cmp.b -(%a0),%d0
  79. jbne invalid_archive
  80. cmp.b -(%a0),%d0
  81. jbne invalid_archive
  82. tst.b -(%a0)
  83. jbeq valid_archive
  84. | We don't need to check the magic number in the ttunpack header,
  85. | the decompression routine does that already.
  86. invalid_archive:
  87. .word 0xA000+210 | ER_DATATYPE
  88. valid_archive:
  89. | Get the uncompressed size.
  90. move.w (%a3),%d6
  91. rol.w #8,%d6
  92. .endm
  93. | MEM_TO_MEM_DECOMPRESS inline function
  94. | INPUT: %a3.l: pointer to compressed data
  95. | %a0.l: pointer to buffer for uncompressed data
  96. | %d6.l: uncompressed size
  97. | OUTPUT: %a4.l: pointer to uncompressed data
  98. | SIDE EFFECTS: may throw a Memory or Data Type error
  99. | DESTROYS: %d0-%d2/%a0-%a2
  100. .macro MEM_TO_MEM_DECOMPRESS
  101. move.l %a0,%a4 | satisfy output constraint
  102. jbsr ttunpack_decompress
  103. tst.w %d0
  104. jbne invalid_archive
  105. .endm
  106. .text
  107. ttunpack_decompress:
  108. .word 18663
  109. .word 7998
  110. .word 6699
  111. .word 6
  112. .word 32384
  113. .word 28680
  114. .word 21643
  115. .word 3163
  116. .word 21584
  117. .word 26140
  118. .word 23179
  119. .word 6171
  120. .word -18432
  121. .word 25108
  122. .word 3163
  123. .word 2176
  124. .word 26126
  125. .word -12245
  126. .word 3
  127. .word 17395
  128. .word 2300
  129. .word 3091
  130. .word 5
  131. .word 25874
  132. .word 19679
  133. .word 31992
  134. .word 20085
  135. .word 24886
  136. .word -16059
  137. .word 29192
  138. .word -28156
  139. .word 24894
  140. .word 4288
  141. .word 24874
  142. .word -20475
  143. .word 26354
  144. .word 24892
  145. .word 13824
  146. .word 21312
  147. .word 26438
  148. .word 24884
  149. .word 20992
  150. .word 26586
  151. .word 21760
  152. .word 4627
  153. .word 24866
  154. .word 29191
  155. .word 24852
  156. .word 17920
  157. .word 17536
  158. .word 4336
  159. .word 2303
  160. .word 20939
  161. .word -6
  162. .word 24788
  163. .word 4612
  164. .word 28672
  165. .word 24586
  166. .word -7393
  167. .word 25602
  168. .word 7193
  169. .word -9210
  170. .word -11968
  171. .word 21249
  172. .word 27378
  173. .word 17600
  174. .word 20085
  175. .word 29702
  176. .word 25066
  177. .word 21706
  178. .word -4
  179. .word 29190
  180. .word -28094
  181. .word 28673
  182. .word 24808
  183. .word 25052
  184. .word 25794
  185. .word 25048
  186. .word 25752
  187. .word 25062
  188. .word 5632
  189. .word 27148
  190. .word 25038
  191. .word 16128
  192. .word 25052
  193. .word 21248
  194. .word 7808
  195. .word 13855
  196. .word 25044
  197. .word 21762
  198. .word 27398
  199. .word 4147
  200. .word 3
  201. .word 24580
  202. .word 29186
  203. .word 25012
  204. .word 4288
  205. .word 28672
  206. .word 24738