home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Assembler / dse-src6.dms / in.adf / BOUNCHSRCS.LZH / TC.S < prev    next >
Encoding:
Text File  |  1986-12-07  |  3.5 KB  |  288 lines

  1. ; Time cruncher version AMIGA v1.0
  2.  
  3.     start = $30000
  4.     write = $40000
  5.     stop  = $32000
  6.     offset = $fff0
  7.  
  8. s:
  9.     lea     start,a0
  10.     lea     stop,a1
  11.     lea     write,a2
  12.     moveq     #1,d2
  13.     clr.l     d1
  14.  
  15. noteocrunch:
  16.     bsr.S     crunch
  17.  
  18.     beq.S     crunched
  19.     addq.l     #1,d1
  20.  
  21. crunched:
  22.     cmp.l     a0,a1
  23.     bgt.S     noteocrunch
  24.  
  25.     bsr.L     dojmp
  26.  
  27.     bsr.L     write1lwd
  28.  
  29.     lea     start,a0
  30.     lea     stop,a1
  31.     move.l     a1,d2
  32.     sub.l     a0,d2
  33.     move.l     d2,(a2)+
  34.  
  35.     clr.l     d0
  36.     clr.l     d1
  37.     clr.l     d2
  38.     clr.l     d3
  39.     clr.l     d4
  40.     clr.l     d5
  41.     lea     cnt,a3
  42.     movem.w (a3)+,d0-d5
  43.     move.l     a2,a3
  44.     sub.l     a0,a3
  45.     lea     stop,a4
  46.     sub.l     a2,a4
  47.     rts
  48.  
  49. crunch:
  50.     move.l     a0,a3
  51.     add.l     #offset,a3
  52.     cmp.l     a1,a3
  53.     ble.S     nottop
  54.     move.l     a1,a3
  55.  
  56. nottop:
  57.     moveq     #$1,d5
  58.     move.l     a0,a5
  59.     addq.l    #$1,a5
  60.  
  61. contcrunch:
  62.  
  63.     move.b     (a0),d3
  64.     move.b     $1(a0),d4
  65.  
  66. quickfind:
  67.     cmp.b     (a5)+,d3
  68.     beq.S    find2
  69.  
  70. contfind:
  71.     cmp.l    a5,a3
  72.     bgt.S    quickfind
  73.     bra.S    endquickfind
  74.  
  75. find2:    cmp.b     (a5),d4
  76.     bne.S    contfind
  77.  
  78. lenfind:
  79.     subq.l     #1,a5
  80.     move.l     a0,a4
  81.  
  82. scan:
  83.     cmpm.b    (a5)+,(a4)+
  84.     bne.S    endequ
  85.     cmp.l    a5,a3
  86.     bgt.S    scan
  87.  
  88. endequ:
  89.     move.l     a4,d3
  90.     sub.l     a0,d3
  91.     subq.l     #1,d3
  92.     cmp.l     d3,d5
  93.     bge.S     nocrunch
  94.  
  95.     move.l     a5,d4
  96.     sub.l     a0,d4
  97.     sub.l     d3,d4
  98.     subq     #1,d4
  99.  
  100.     cmp.l     #$3,d3
  101.     ble.S     small
  102.  
  103.     moveq      #$4,d6
  104.     cmp.l     #$00000100,d3
  105.     blt.S     cont1
  106.     move.l    #$ff,d3
  107.  
  108. oksafe:
  109.     bra.S     cont1
  110.  
  111. small:
  112.     move.w     d3,d6
  113.     subq.w     #$2,d6
  114.     lsl.w     #1,d6
  115.  
  116. cont1:
  117.     lea     table,a6
  118.     cmp.w     (a6,d6.w),d4
  119.     bhi.S     nocrunch
  120.     move.l     d3,d5
  121.     move.l     d4,maxsoffset
  122.     move.b     d6,tbloffset
  123.  
  124. nocrunch:
  125.     cmp.l    a5,a3
  126.     bgt.S    contcrunch
  127.  
  128. endquickfind:
  129.     cmp.l    #$1,d5
  130.     beq.L    nothingfound
  131.  
  132.     bsr.L     dojmp
  133.  
  134.     move.b     tbloffset,d6
  135.     move.l     maxsoffset,d3
  136.     moveq    #8,d0
  137.     cmp.w    #$0,d6
  138.     beq.S    smalloff
  139.     cmp.w    #$2,d6
  140.     beq.S    midoff
  141.  
  142. bigoff:
  143.     moveq    #17,d0
  144.     cmp.w    #$0fff,d3
  145.     bhi.S    woffset
  146.     cmp.w    #$0100,d3
  147.     bge.S    bigoff1
  148.     moveq    #10,d0
  149.     or.w    #$0300,d3
  150.     bra.S    woffset
  151.  
  152. bigoff1:
  153.     moveq    #14,d0
  154.     or.w    #$2000,d3
  155.     bra.S    woffset
  156.  
  157. midoff:
  158.     moveq    #15,d0
  159.     cmp.w    #$0100,d3
  160.     bge.S    woffset
  161.     moveq    #9,d0
  162.     or.w    #$0100,d3
  163.  
  164. smalloff:
  165. woffset:
  166.     bsr.L    wd0bits
  167.  
  168.     cmp.w    #$4,d5
  169.     ble.S     nolength
  170.     move.l     d5,d3
  171.     moveq    #8,d0
  172.     cmp.w    #11,d3
  173.     bge.S    wlength
  174.     moveq    #1,d0
  175.     sub.w    #7,d3
  176.     bmi.S    wlength
  177.     moveq    #2,d0
  178.  
  179. wlength:
  180.     bsr.L     wd0bits
  181.  
  182. nolength:
  183.     moveq    #2,d0
  184.     move.w    d5,d3
  185.     subq.w    #2,d3
  186.     cmp.w    #4,d5
  187.     ble.S    wcode
  188.  
  189.     moveq    #3,d0
  190.     moveq    #6,d3
  191.     cmp.w    #6,d5
  192.     ble.S    wcode
  193.  
  194.     moveq    #4,d0
  195.     moveq    #14,d3
  196.     cmp.w    #10,d5
  197.     ble.S    wcode
  198.  
  199.     moveq    #15,d3
  200.     
  201. wcode:
  202.     bsr.L     wd0bits
  203.     addi.w     #$1,40(a6,d6.w)
  204.     bchg    #1,$bfe001
  205.     add.l     d5,a0
  206.     clr.b     d0
  207.     rts
  208.  
  209. nothingfound:
  210.     move.b     (a0)+,d3
  211.     moveq     #$8,d0
  212.     bsr.L     wd0bits
  213.     moveq     #$1,d0
  214.     rts
  215.  
  216. maxsoffset:    dc.l 0
  217. tbloffset:    dc.w 0
  218.  
  219. table:
  220. offst:    dc.w $00ff,$3fff,$fff0,$0000
  221. lnoff:    dc.w $0008,$ffff,$ffff,$0000
  222. length:    dc.w $0000,$0000,$ffff,$0000
  223. cdlen:    dc.w $0002,$0002,$0001,$0000
  224. code:    dc.w $0000,$0001,$0001,$0000
  225. cnt:    dc.w $0,$0,$0,$0
  226. cntjmp: dc.w $0,$0,$0,$0
  227.  
  228.  
  229. dojmp:
  230.     move.l    d1,d3
  231.     clr.l    d1
  232.     cmp.l    #$400,d3
  233.     bge.S    bigjmp3
  234.     cmp.w    #$17,d3
  235.     bge.S    bigjmp2
  236.     cmp.w     #7,d3
  237.     bge.S     bigjmp1
  238.     addq.w    #1,cntjmp
  239.     moveq    #3,d0
  240.     bra.S    wd0bits
  241.  
  242. bigjmp1:
  243.     addq.w     #1,cntjmp+2
  244.     subi.w     #7,d3
  245.     or.w     #$e0,d3
  246.     moveq     #8,d0
  247.     bra.S     wd0bits
  248.  
  249. bigjmp2:
  250.     addq.w    #1,cntjmp+4
  251.     or.w    #$3c00,d3
  252.     moveq    #14,d0
  253.     bra.S    wd0bits
  254.  
  255. bigjmp3:
  256.     addq.w    #1,cntjmp+6
  257.     or.l    #$f0000000,d3
  258.     moveq    #32,d0
  259.  
  260. wd0bits:
  261.     subq.w     #1,d0
  262.  
  263. copybits:
  264.     lsr.l    #1,d3
  265.     roxl.l    #1,d2
  266.     bcs.S    writelwd
  267.     dbf    d0,copybits
  268.     rts
  269.  
  270. write1lwd:
  271.     clr.w     d0
  272.  
  273. writelwd:
  274.     move.l     d2,(a2)+
  275.     moveq     #1,d2
  276.     dbf     d0,copybits
  277.     rts
  278.  
  279. END
  280.  
  281. ;This cruncher is written by PHS of CCS    
  282.  
  283. ;Hakan Sundell
  284. ;C. C. S.    
  285. ;Sweden
  286.  
  287. ;This cruncher is much better than bytekiller v1.2,but slower!
  288.