home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Assembler / dse-src5.dms / in.adf / replay8.S < prev    next >
Encoding:
Text File  |  1990-05-07  |  9.0 KB  |  550 lines

  1.  
  2. ; Replay-routine for Soundtracker v3.0
  3.  
  4. ; Coded by Il Scuro
  5.  
  6.  
  7.  
  8. j:    bsr    mt_init
  9.     move.w    #$4000,$dff09a
  10.     move.l    $00006c,mt_oldirq
  11.     move.l    #mt_newirq,$00006c
  12.     move.w    #$c000,$dff09a
  13.  
  14. mouse:    btst    #6,$bfe001
  15.     bne.s    mouse
  16.  
  17.     move.w    #$000f,$dff096
  18.     move.w    #$4000,$dff09a
  19.     move.l    mt_oldirq,$00006c
  20.     move.w    #$c000,$dff09a
  21.     rts
  22.  
  23.  
  24. *------------------------------------------------------------------
  25. mt_init:
  26.     move.l    #instr01,mt_sample1
  27.     move.l    #instr02,mt_sample2
  28.     move.l    #instr03,mt_sample3
  29.     move.l    #instr04,mt_sample4
  30.     move.l    #instr05,mt_sample5
  31.     move.l    #instr06,mt_sample6
  32.     move.l    #instr07,mt_sample7
  33.     move.l    #instr08,mt_sample8
  34.     move.l    #instr09,mt_sample9
  35.     move.l    #instr10,mt_sample10
  36.     move.l    #instr11,mt_sample11
  37.     move.l    #instr12,mt_sample12
  38.     move.l    #instr13,mt_sample13
  39.     move.l    #instr14,mt_sample14
  40.     move.l    #instr15,mt_sample15
  41.  
  42.     move.l    #mt_sample1,a0
  43.     clr.l    d0
  44. mt_clear:
  45.     move.l    (a0,d0),a1
  46.     clr.l    (a1)
  47.     addq    #4,d0
  48.     cmp.l    #$3c,d0
  49.     bne.s    mt_clear
  50.  
  51.     move.w    #0,$dff0a8
  52.     move.w    #0,$dff0b8
  53.     move.w    #0,$dff0c8
  54.     move.w    #0,$dff0d8
  55.     eor.w    #$c000,mt_voice0+12
  56.     clr.l    mt_partnrplay
  57.     clr.l    mt_partnote
  58.     clr.l    mt_partpoint
  59.  
  60.     move.b    mt_sampleinfo+$1d6,mt_maxpart+1
  61.     move.b    mt_sampleinfo+$1d7,mt_kn1+1
  62.     rts
  63. *------------------------------------------------------------------
  64. mt_newirq:
  65.     movem.l    d0-d7/a0-a6,-(a7)
  66.     bsr    mt_music
  67.     movem.l    (a7)+,d0-d7/a0-a6
  68.     dc.w    $4ef9
  69.  
  70. mt_oldirq:
  71.     dc.l    0
  72. *------------------------------------------------------------------
  73. mt_music:
  74.     addq.l        #1,mt_counter
  75.     move.l        mt_tempo,d0
  76.     cmp.l        mt_counter,d0
  77.     bne.s        mt_notsix
  78.     clr.l        mt_counter
  79.     bra        mt_rout2
  80.  
  81. mt_notsix:
  82.     lea        mt_aud1temp,a6
  83.     tst.b        3(a6)
  84.     beq.s        mt_arp1
  85.     move.l        #$dff0a0,a5        
  86.     bsr.s        mt_arprout
  87.  
  88. mt_arp1:
  89.     lea        mt_aud2temp,a6
  90.     tst.b        3(a6)
  91.     beq.s        mt_arp2
  92.     move.l        #$dff0b0,a5
  93.     bsr.s        mt_arprout
  94.  
  95. mt_arp2:
  96.     lea        mt_aud3temp,a6
  97.     tst.b        3(a6)
  98.     beq.s        mt_arp3
  99.     move.l        #$dff0c0,a5
  100.     bsr.s        mt_arprout
  101.  
  102. mt_arp3:
  103.     lea        mt_aud4temp,a6
  104.     tst.b        3(a6)
  105.     beq.s        mt_arp4
  106.     move.l        #$dff0d0,a5
  107.     bsr.s        mt_arprout
  108.  
  109. mt_arp4:
  110.     bra        mt_stop
  111.  
  112.  
  113. mt_arprout:
  114.     tst.w    24(a6)
  115.     beq.s    mt_noslide
  116.  
  117.     clr.w    d0
  118.     move.b    25(a6),d0
  119.     lsr.b    #4,d0
  120.     tst.b    d0
  121.     beq.s    mt_voldwn2
  122.     bsr    mt_pushvol1
  123.     bra.s    mt_noslide
  124.  
  125. mt_voldwn2:
  126.     clr.w    d0
  127.     move.b    25(a6),d0
  128.     bsr    mt_pushvol2
  129.  
  130. mt_noslide:
  131.     move.b    2(a6),d0
  132.     and.b    #$0f,d0
  133.     tst.b    d0
  134.     beq.L    mt_arpegrt
  135.     cmp.b    #3,d0
  136.     beq.L    mt_arpegrt
  137.     cmp.b    #4,d0
  138.     beq.L    mt_arpegrt
  139.     cmp.b    #5,d0
  140.     beq.L    mt_arpegrt
  141.     cmp.b    #1,d0
  142.     beq.s    mt_portup
  143.     cmp.b    #6,d0
  144.     beq.s    mt_portup
  145.     cmp.b    #7,d0
  146.     beq.s    mt_portup
  147.     cmp.b    #8,d0
  148.     beq.s    mt_portup
  149.     cmp.b    #2,d0
  150.     beq.s    mt_portdwn
  151.     cmp.b    #9,d0
  152.     beq.s    mt_portdwn
  153.     cmp.b    #10,d0
  154.     beq.s    mt_portdwn
  155.     cmp.b    #11,d0
  156.     beq.s    mt_portdwn
  157.     cmp.b    #13,d0
  158.     beq.s    mt_volup
  159.     rts
  160.  
  161. mt_portup:
  162.     clr.w    d0
  163.     move.b    3(a6),d0
  164.     sub.w    d0,22(a6)
  165.     cmp.w    #$71,22(a6)
  166.     bpl.s    mt_ok1
  167.     move.w    #$71,22(a6)
  168.  
  169. mt_ok1:
  170.     move.w    22(a6),6(a5)
  171.     rts
  172.  
  173. mt_portdwn:
  174.     clr.w    d0
  175.     move.b    3(a6),d0
  176.     add.w    d0,22(a6)
  177.     cmp.w    #$358,22(a6)
  178.     bmi.s    mt_ok2
  179.     move.w    #$358,22(a6)
  180.  
  181. mt_ok2:
  182.     move.w    22(a6),6(a5)
  183.     rts
  184.  
  185. mt_volup:
  186.     clr.w    d0
  187.     move.b    3(a6),d0
  188.     lsr.b    #4,d0
  189.     tst.b    d0
  190.     beq.s    mt_voldwn
  191.  
  192. mt_pushvol1:
  193.     add.w    d0,$12(a6)
  194.     cmp.w    #$40,$12(a6)
  195.     bmi.s    mt_ok3
  196.     move.w    #$40,$12(a6)
  197.  
  198. mt_ok3:
  199.     move.w    $12(a6),8(a5)
  200.     rts
  201.  
  202. mt_voldwn:
  203.     clr.w    d0
  204.     move.b    3(a6),d0
  205.  
  206. mt_pushvol2:
  207.     and.b    #$0f,d0
  208.     sub.w    d0,$12(a6)
  209.     bpl.s    mt_ok4
  210.     clr.w    $12(a6)
  211.  
  212. mt_ok4:
  213.     move.w    $12(a6),8(a5)
  214.     rts
  215.  
  216. mt_arpegrt:
  217.     cmp.l        #1,mt_counter
  218.     beq.s        mt_loop2
  219.     cmp.l        #2,mt_counter
  220.     beq.s        mt_loop3
  221.     cmp.l        #3,mt_counter
  222.     beq.s        mt_loop4
  223.     cmp.l        #4,mt_counter
  224.     beq.s        mt_loop2
  225.     cmp.l        #5,mt_counter
  226.     beq.s        mt_loop3
  227.     rts
  228.  
  229. mt_loop2:
  230.     clr.l        d0
  231.     move.b        3(a6),d0
  232.     lsr.b        #4,d0
  233.     bra.s        mt_cont
  234.  
  235. mt_loop3:
  236.     clr.l        d0
  237.     move.b        3(a6),d0
  238.     and.b        #$0f,d0
  239.     bra.s        mt_cont
  240.  
  241. mt_loop4:
  242.     move.w        16(a6),d2
  243.     bra.s        mt_endpart
  244.  
  245. mt_cont:
  246.     lsl.w        #1,d0
  247.     clr.l        d1
  248.     move.w        16(a6),d1
  249.     lea        mt_arpeggio,a0
  250.  
  251. mt_loop5:
  252.     move.w        (a0,d0),d2
  253.     cmp.w        (a0),d1
  254.     beq.s        mt_endpart
  255.     addq.l        #2,a0
  256.     bra.s        mt_loop5
  257.  
  258. mt_endpart:
  259.     move.w        d2,6(a5)
  260.     rts
  261.  
  262. mt_rout2:
  263.     lea        mt_sampleinfo,a0
  264.     move.l        a0,a3
  265.     add.l        #$0c,a3
  266.     move.l        a0,a2
  267.     add.l        #$1d8,a2
  268.     add.l        #$258,a0
  269.     move.l        mt_partnrplay,d0
  270.     clr.l        d1
  271.     move.b        (a2,d0),d1
  272.     mulu        #$0400,d1
  273.     add.l        mt_partnote,d1
  274.     move.l        d1,mt_partpoint
  275.     clr.w        mt_dmacon
  276.  
  277.     move.l        #$dff0a0,a5
  278.     lea        mt_aud1temp,a6
  279.     bsr        mt_playit
  280.  
  281.     move.l        #$dff0b0,a5
  282.     lea        mt_aud2temp,a6
  283.     bsr        mt_playit
  284.  
  285.     move.l        #$dff0c0,a5
  286.     lea        mt_aud3temp,a6
  287.     bsr        mt_playit
  288.  
  289.     move.l        #$dff0d0,a5
  290.     lea        mt_aud4temp,a6
  291.     bsr        mt_playit
  292.  
  293.     move.l        #mt_speed,d0
  294. mt_rls:
  295.     dbf        d0,mt_rls
  296.  
  297.     move.l        #$8000,d0
  298.     add.w        mt_dmacon,d0
  299.     move.w        d0,$dff096
  300.  
  301.     move.l        #mt_aud4temp,a6
  302.     cmp.w        #1,14(a6)
  303.     bne.s        mt_voice3
  304.     move.l        10(a6),$dff0d0
  305.     move.w        #1,$dff0d4
  306.  
  307. mt_voice3:
  308.     move.l        #mt_aud3temp,a6
  309.     cmp.w        #1,14(a6)
  310.     bne.s        mt_voice2
  311.     move.l        10(a6),$dff0c0
  312.     move.w        #1,$dff0c4
  313.  
  314. mt_voice2:
  315.     move.l        #mt_aud2temp,a6
  316.     cmp.w        #1,14(a6)
  317.     bne.s        mt_voice1
  318.     move.l        10(a6),$dff0b0
  319.     move.w        #1,$dff0b4
  320.  
  321. mt_voice1:
  322.     move.l        #mt_aud1temp,a6
  323.     cmp.w        #1,14(a6)
  324.     bne.s        mt_voice0
  325.     move.l        10(a6),$dff0a0
  326.     move.w        #1,$dff0a4
  327.  
  328. mt_voice0:
  329.     lea        mt_modulate,a0
  330.     move.l        mt_partnote,d0
  331.     lsl.b        #7,d0
  332.     add.l        #$10,d0
  333.     move.l        d0,mt_partnote
  334.     cmp.l        #$400,d0
  335.     bne.s        mt_stop
  336.     clr.l        mt_partnote
  337.     addq.l        #1,mt_partnrplay
  338.     clr.l        d0
  339.     move.w        mt_maxpart,d0
  340.     move.l        mt_partnrplay,d1
  341.     cmp.l        d0,d1
  342.     bne.s        mt_stop
  343.     clr.l        mt_partnrplay
  344. mt_stop:
  345.     rts
  346.  
  347.  
  348. mt_playit:
  349.     move.l        (a0,d1),(a6)
  350.     addq.l        #4,d1
  351.     clr.l        d2
  352.     move.b        2(a6),d2
  353.     and.b        #$f0,d2
  354.     lsr.b        #4,d2
  355.     tst.b        d2
  356.     beq.s        mt_nosamplechange
  357.  
  358.     clr.l        d3
  359.     lea        mt_samples,a1
  360.     move.l        d2,d4
  361.     mulu        #4,d2
  362.     mulu        #$1e,d4
  363.     move.l        (a1,d2),4(a6)
  364.     move.w        (a3,d4),8(a6)
  365.     move.w        2(a3,d4),18(a6)
  366.     move.w        4(a3,d4),d3
  367.     tst.w        d3
  368.     beq.s        mt_displace
  369.     move.l        4(a6),d2
  370.     add.l        d3,d2
  371.     move.l        d2,4(a6)
  372.     move.l        d2,10(a6)
  373.     move.w        6(a3,d4),8(a6)
  374.     move.w        6(a3,d4),14(a6)
  375.     move.w        18(a6),8(a5)
  376.     bra.s        mt_nosamplechange
  377.  
  378. mt_displace:
  379.     move.l        4(a6),d2
  380.     add.l        d3,d2
  381.     move.l        d2,10(a6)
  382.     move.w        6(a3,d4),14(a6)
  383.     move.w        18(a6),8(a5)
  384.  
  385. mt_nosamplechange:
  386.     tst.w        (a6)
  387.     beq.s        mt_retrout
  388.     move.w        (a6),16(a6)
  389.     move.w        20(a6),$dff096
  390.     move.l        4(a6),(a5)
  391.     move.w        8(a6),4(a5)
  392.     move.w        (a6),6(a5)
  393.     move.w        20(a6),d0
  394.     or.w        d0,mt_dmacon
  395.  
  396. mt_retrout:
  397.     move.w    20(a6),d0
  398.     lsl.w    #4,d0
  399.     add.w    20(a6),d0
  400.     move.w    d0,$dff09e
  401.  
  402.     tst.w    (a6)
  403.     beq.s    mt_nonewper
  404.     move.w    (a6),22(a6)
  405.  
  406. mt_nonewper:
  407.     move.b    2(a6),d0
  408.     and.b    #$0f,d0
  409.     cmp.b    #14,d0
  410.     beq.s    mt_zx3
  411.     cmp.b    #15,d0
  412.     bne.s    mt_noset
  413.  
  414.     move.w    2(a6),d0
  415.     and.l    #15,d0
  416.     move.l    d0,mt_tempo
  417.     rts
  418.  
  419. mt_zx3:
  420.     move.w    2(a6),24(a6)
  421.     rts
  422.  
  423. mt_noset:
  424.     tst.b    3(a6)
  425.     bne.s    mt_noclr
  426.     clr.w    24(a6)
  427.  
  428. mt_noclr:
  429.     cmp.b    #3,d0
  430.     beq.s    mt_modvol
  431.     cmp.b    #6,d0
  432.     beq.s    mt_modvol
  433.     cmp.b    #9,d0
  434.     beq.s    mt_modvol
  435.     cmp.b    #4,d0
  436.     beq.s    mt_modper
  437.     cmp.b    #7,d0
  438.     beq.s    mt_modper
  439.     cmp.b    #10,d0
  440.     beq.s    mt_modper
  441.     cmp.b    #5,d0
  442.     beq.s    mt_modvolper
  443.     cmp.b    #8,d0
  444.     beq.s    mt_modvolper
  445.     cmp.b    #11,d0
  446.     beq.s    mt_modvolper
  447.     cmp.b    #12,d0
  448.     bne.s    mt_nochnge
  449.     move.b    3(a6),8(a5)
  450. mt_nochnge:
  451.     rts
  452.  
  453. mt_modvol:
  454.     move.w    20(a6),d0
  455.     bra.s    mt_push
  456.  
  457. mt_modper:
  458.     move.w    20(a6),d0
  459.     lsl.w    #4,d0
  460.     bra.s    mt_push
  461.  
  462. mt_modvolper:
  463.     move.w    20(a6),d0
  464.     lsl.w    #4,d0
  465.     add.w    20(a6),d0
  466.  
  467. mt_push:
  468.     add.w    #$8000,d0
  469.     move.w    d0,$dff09e
  470.     rts
  471. *------------------------------------------------------------------
  472. mt_aud1temp:
  473.     dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
  474.     dc.w $0000,$0000,$0001,$0000,$0000
  475.  
  476. mt_aud2temp:
  477.     dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
  478.     dc.w $0000,$0000,$0002,$0000,$0000
  479.  
  480. mt_aud3temp:
  481.     dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
  482.     dc.w $0000,$0000,$0004,$0000,$0000
  483.  
  484. mt_aud4temp:
  485.     dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
  486.     dc.w $0000,$0000,$0008,$0000,$0000
  487.  
  488. mt_partnote:    dc.l 0
  489. mt_partnrplay:    dc.l 0
  490. mt_counter:    dc.l 0
  491. mt_tempo:    dc.l 6
  492. mt_partpoint:    dc.l 0
  493. mt_samples:    dc.w $0000,$0000
  494.  
  495. mt_sample1:    dc.l 0
  496. mt_sample2:    dc.l 0
  497. mt_sample3:    dc.l 0
  498. mt_sample4:    dc.l 0
  499. mt_sample5:    dc.l 0
  500. mt_sample6:    dc.l 0
  501. mt_sample7:    dc.l 0
  502. mt_sample8:    dc.l 0
  503. mt_sample9:    dc.l 0
  504. mt_sample10:    dc.l 0
  505. mt_sample11:    dc.l 0
  506. mt_sample12:    dc.l 0
  507. mt_sample13:    dc.l 0
  508. mt_sample14:    dc.l 0
  509. mt_sample15:    dc.l 0
  510.  
  511. mt_maxpart:    dc.w $0000
  512. mt_kn1:        dc.w $0000
  513. mt_dmacon:    dc.w $0000
  514.  
  515. mt_modulate:    dc.w $0c39,$0039,$00bf,$ec01,$6630,$0839,$0007,$00bf
  516.         dc.w $e001,$6626,$2c79,$0000,$0004,$43fa,$0020,$4eae
  517.         dc.w $fe68,$2c40,$4280,$41fa,$0026,$223c,$0000,$0032
  518.         dc.w $4eae,$ffa6,$60ee,$0000,$0000,$4e75,$696e,$7475
  519.         dc.w $6974,$696f,$6e2e,$6c69,$6272,$6172,$7900,$0104
  520.         dc.w $1753,$6f75,$6e64,$5472,$6163,$6b65,$7220,$5632
  521.         dc.w $0063,$00f0,$20a9,$2054,$6865,$204a,$756e,$676c
  522.         dc.w $6520,$436f,$6d6d,$616e,$6400,$0000
  523.  
  524. mt_arpeggio:    dc.w $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c
  525.         dc.w $023a,$021a,$01fc,$01e0,$01c5,$01ac,$0194,$017d
  526.         dc.w $0168,$0153,$0140,$012e,$011d,$010d,$00fe,$00f0
  527.         dc.w $00e2,$00d6,$00ca,$00be,$00b4,$00aa,$00a0,$0097
  528.         dc.w $008f,$0087,$007f,$0078,$0071,$0000,$0000,$0000
  529.  
  530. mt_speed = $01f4
  531.  
  532. instr01:    blk.b   3268,0    ;smack
  533. instr02:    blk.b    8342,0    ;guitar2
  534. instr03:    blk.b    5240,0    ;snare4
  535. instr04:    blk.b    1510,0    ;bassdrum9
  536. instr05:    blk.b    2044,0    ;closedhi
  537. instr06:    blk.b    3622,0    ;bassynth
  538. instr07:    blk.b    3898,0    ;guitar1
  539. instr08:    blk.b    0,0    ;
  540. instr09:    blk.b    0,0    ;
  541. instr10:    blk.b    0,0    ;
  542. instr11:    blk.b    0,0    ;
  543. instr12:    blk.b    0,0    ;
  544. instr13:    blk.b    0,0    ;
  545. instr14:    blk.b    0,0    ;
  546. instr15:    blk.b    0,0    ;
  547. mt_sampleinfo:    blk.b    4696,0    ;
  548. *------------------------------------------------------------------
  549.  
  550.