home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 4: Demo 1 / almathera_demo1.bin / sourcecode / dexion / deccrunch+load.s < prev    next >
Text File  |  1995-03-17  |  2KB  |  152 lines

  1. ; decruncher v1.1
  2.  
  3.  
  4. read  = $5a320
  5. lowwr = $40000
  6. execbase = 4
  7. openlib  = -408 
  8. open     = -30
  9.  
  10. start:
  11. move.l execbase,a6
  12. lea dosname,a1
  13. moveq #0,d0
  14. jsr openlib(a6)
  15. move.l d0,dosbase
  16. beq error
  17. move.l dosbase,a6
  18. move.l #filename,d1
  19. move #1005,d2
  20. jsr -30(a6)
  21. move.l d0,conhandle
  22. beq error
  23. move.l conhandle,d1
  24. move.l #$50000,d2
  25. move.l #$a320,d3
  26. jsr -42(a6)
  27. move.l d0,lange
  28. beq error
  29. jmp star
  30. error: 
  31. moveq #8,d0
  32. rts
  33. dosname:
  34. dc.b  "dos.library",0,0
  35. even
  36. dosbase:
  37. blk.l 1
  38. conhandle:
  39. dc.l     $00000000
  40. even
  41. filename:
  42. dc.b    "sapper.dat1",0,0
  43. even
  44. lange:
  45. dc.l    $00000000
  46.  
  47. star:
  48. jsr decr
  49. s:
  50. jsr $40000
  51. rts
  52.  
  53. decr:
  54. lea read,a0
  55. lea lowwr,a1        
  56. move.l -(a0),a2        
  57. add.l a1,a2        
  58. move.l -(a0),d5        
  59. move.l -(a0),d0        
  60. eor.l d0,d5        
  61. notfinished:
  62. lsr.l #1,d0
  63. bne.S notempty1
  64. bsr getnextlwd
  65. notempty1:
  66. bcs.S bigone        
  67. moveq #8,d1    
  68. moveq #1,d3    
  69. lsr.l #1,d0
  70. bne.S notempty2
  71. bsr getnextlwd
  72. notempty2:
  73. bcs.S dodupl    
  74. moveq #3,d1    
  75. clr.w d4    
  76. dojmp:        
  77. bsr rdd1bits    
  78. move.w d2,d3    
  79. add.w d4,d3    
  80. getd3chr:
  81. moveq #7,d1    
  82. get8bits:
  83. lsr.l #1,d0
  84. bne.S notempty3
  85. bsr getnextlwd
  86. notempty3:
  87. roxl.l #1,d2
  88. dbf d1,get8bits    
  89. move.b d2,-(a2)
  90. dbf d3,getd3chr    
  91. bra nextcmd
  92. bigjmp:
  93. moveq #8,d1    
  94. moveq #8,d4    
  95. bra dojmp
  96. bigone:
  97. moveq #2,d1    
  98. bsr rdd1bits
  99. cmp.b #2,d2    
  100. blt.S midjumps    
  101. cmp.b #3,d2    
  102. beq.S bigjmp    
  103. moveq #8,d1    
  104. bsr rdd1bits    
  105. move.w d2,d3    
  106. move.w #12,d1    
  107. bra dodupl    
  108. midjumps:
  109. move.w #9,d1    
  110. add.w d2,d1
  111. addq #2,d2
  112. move.w d2,d3    
  113. dodupl:
  114. bsr rdd1bits    
  115. copyd3bytes:
  116. subq #1,a2
  117. move.b (a2,d2.w),(a2)
  118. dbf d3,copyd3bytes
  119. nextcmd:
  120. cmp.l a2,a1
  121. blt.L notfinished
  122. tst.l d5
  123. bne.S damage
  124. rts ; illegal
  125. damage:
  126. move.w #$ffffffff,d0
  127. damloop:
  128. move.w d0,$dff180
  129. subi.l #1,d0
  130. bne.S damloop
  131. rts ; illegal
  132. getnextlwd:
  133. move.l -(a0),d0
  134. eor.l d0,d5
  135. move.w #$10,ccr
  136. roxr.l #1,d0
  137. rts
  138. rdd1bits:    
  139. subq.w #1,d1
  140. clr.w d2
  141. getbits:
  142. lsr.l #1,d0
  143. bne.S notempty
  144. move.l -(a0),d0
  145. eor.l d0,d5
  146. move.w #$10,ccr
  147. roxr.l #1,d0
  148. notempty:
  149. roxl.l #1,d2
  150. dbf d1,getbits
  151. rts
  152.