home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / compress / packers / turtlesmasher141 / turtledecruncher.asm < prev    next >
Assembly Source File  |  1995-02-27  |  3KB  |  146 lines

  1.       section  Timedecruncher,code
  2.  
  3.       lea   crunched,a0 
  4.       lea   decrunched,a1  
  5.       bsr   decrunch
  6.       rts
  7.  
  8. ;----------------------------------------------------
  9. crunched incbin   cruncheddata   ;put the crunched data here
  10. decrunched  dcb.b 200000,0       ;free mem for decrunched data
  11.  
  12. ;*****************************************************
  13. ;*    Turtle Smasher Data Decruncher                 *
  14. ;*   Uses Registers D0,D1,D2,D3,A0,A1,A2             *
  15. ;* a0=address for crunched data                      *
  16. ;* a1=address where the decrunched data places       *
  17. ;*                                                   *
  18. ;* Improved and Fixed for data decrunching by        *
  19. ;* Mr.Crook & Him of VOX DEI.                        *
  20. ;* This source MUST be spread with the cruncher.     *
  21. ;*****************************************************
  22. decrunch move.l   a1,a2
  23.       add.l (a0)+,a2
  24.       add.l (a0),a0
  25.       subq.l   #8,a0
  26.  
  27.       move.l   (a0),d0
  28. again    moveq #3,d1
  29.       bsr.w d46
  30.       tst.b d2
  31.       beq.b caa
  32.       cmpi.w   #7,d2
  33.       bne.b c7a
  34.       lsr.l #1,d0
  35.       bne.b c5e
  36.       bsr.w d3c
  37. c5e      bcc.b c72
  38.       moveq #10,d1
  39.       bsr.w d46
  40.       tst.w d2
  41.       bne.b c7a
  42.       moveq #18,d1   
  43.       bsr.w d46
  44.       bra.b c7a
  45. c72      moveq #4,d1
  46.       bsr.w d46
  47.       addq.w   #7,d2
  48. c7a      subq.w   #1,d2
  49. c7c      moveq #7,d1
  50. c7e      lsr.l #1,d0
  51.       beq.b c90
  52.       roxl.l   #1,d3
  53.       dbra  d1,c7e
  54.       move.b   d3,-(a2)
  55.       dbra  d2,c7c
  56.       bra.b caa
  57.  
  58. c90      move.l   -(a0),d0
  59.       move.w   d0,$00dff180   ; make screen flashing
  60.       move  #$10,ccr
  61.       roxr.l   #1,d0
  62.       roxl.l   #1,d3
  63.       dbra  d1,c7e
  64.       move.b   d3,-(a2)
  65.       dbra  d2,c7c
  66.  
  67. caa      cmp.l a2,a1
  68.       bge.w exit
  69.       moveq #$02,d1
  70.       bsr.w d46
  71.       moveq #2,d3
  72.       moveq #8,d1
  73.       tst.w d2
  74.       beq.b d26
  75.       moveq #4,d3
  76.       cmpi.w   #2,d2
  77.       beq.w d10
  78.       moveq #3,d3
  79.       cmpi.w   #1,d2
  80.       beq.w d02
  81.       moveq #2,d1
  82.       bsr.w d46
  83.       cmpi.w   #3,d2
  84.       beq.b cf8
  85.       cmpi.w   #2,d2
  86.       beq.b cec
  87.       addq.w   #5,d2
  88.       move.w   d2,d3
  89.       bra.w d10
  90. cec      moveq #2,d1
  91.       bsr.b d46
  92.       addq.w   #7,d2
  93.       move.w   d2,d3
  94.       bra.w d10
  95. cf8      moveq #8,d1
  96.       bsr.b d46
  97.       move.w   d2,d3
  98.       bra.w d10
  99. d02      moveq #8,d1
  100.       lsr.l #1,d0
  101.       bne.b d0a
  102.       bsr.b d3c
  103. d0a      bcs.b d26
  104.       moveq #14,d1
  105.       bra.b d26
  106. d10      moveq #16,d1
  107.       lsr.l #1,d0
  108.       bne.b d18
  109.       bsr.b d3c
  110. d18      bcc.b d26
  111.       moveq #8,d1
  112.       lsr.l #1,d0
  113.       bne.b d22
  114.       bsr.b d3c
  115. d22      bcs.b d26
  116.       moveq #12,d1
  117. d26      bsr.b d46
  118.       subq.w   #1,d3
  119. d2a      move.b   -1(a2,d2.l),-(a2)
  120.       dbra  d3,d2a
  121.       bra.w again
  122. ;---------------------------------------------------
  123. exit     rts   ;here we leave the decruncher
  124. ;---------------------------------------------------
  125. d3c      move.l   -(a0),d0
  126.       move  #$10,ccr
  127.       roxr.l   #1,d0
  128.       rts   
  129.  
  130. d46      clr.l d2
  131.       subq.w   #1,d1
  132. roxlloop lsr.l #1,d0
  133.       beq.b zerobit
  134.       roxl.l   #1,d2
  135.       dbra  d1,roxlloop
  136.       rts   
  137.  
  138. zerobit     move.l   -(a0),d0
  139.       move  #$10,ccr
  140.       roxr.l   #1,d0
  141.       roxl.l   #1,d2
  142.       dbra  d1,roxlloop
  143.       rts   
  144.  
  145.    end
  146.