home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Sound / Tracker / THEPROF.MUSICARTIST.DMS / in.adf / Musikasr.S < prev    next >
Encoding:
Text File  |  1989-04-27  |  8.8 KB  |  557 lines

  1. musl   = 900        ; Musik-Länge
  2. sndl   = 900        ; Sound-Länge
  3. ; Hier beginnt die Musik-Abspielroutine V1.0 vom 12.08.1989
  4. ; Copyright 1989 by Michael Winterberg
  5. ;                   Deusener Straße 275
  6. ;                   4600 Dortmund 18
  7. musirqan:
  8.     bsr    musinit
  9.     move.l    musspeed,musoldspeed
  10.     or.b    #2,$bfe001
  11.     lea    musirq,a0
  12.     move.l    a0,$6c
  13.     rts
  14. musirqaus:
  15.     or.b    #2,$bfe001
  16.     eor.b    #2,$bfe001
  17.     move.w    #$f,$dff096
  18.     move.l    oldirq,$6c
  19.     rts
  20. musinit:
  21.     move.l    $6c,oldirq
  22.     clr.l    muscmd
  23.     lea    musperiod,a0
  24.     clr.l    (a0)+
  25.     clr.l    (a0)+
  26.     move.l    startpos,muspos
  27.     move.l    startpos,musstart
  28.     move.l    endepos,musende
  29.     clr.l    musy
  30.     clr.l    muscount
  31.     move.l    #muscode,musmem
  32.     move.l    maxpos,musmaxpos
  33.     lea    soundstart,a0
  34.     lea    mussoundstart,a1
  35.     lea    sounddata,a2
  36. musinitloop:
  37.     move.b    (a0)+,(a1)+
  38.     cmp.l    a0,a2
  39.     bne.s    musinitloop
  40.     move.l    geschwindigkeit,musspeed
  41.     clr.l    muscmd2
  42.     lea    mussoundstart,a0
  43.     bsr    musaddmem
  44.     lea    musiffstart,a0
  45.     bra    musaddmem
  46. musaddmem:
  47.     lea    soundlist,a1
  48.     clr.l    d0
  49. musaddmemloop:
  50.     move.l    (a0),d1
  51.     add.l    a1,d1
  52.     move.l    d1,(a0)+
  53.     addq.l    #1,d0
  54.     cmp.l    #32,d0
  55.     bne.s    musaddmemloop
  56.     rts
  57. musmem:
  58.     dc.l    0
  59. musmaxpos:
  60.     dc.l    0
  61. mussoundstart:
  62.     blk.l    32,0
  63. mussoundlaenge:
  64.     blk.l    32,0
  65. musiffstart:
  66.     blk.l    32,0
  67. mussoundloop:
  68.     blk.l    32,0
  69. mussoundlooplaenge:
  70.     blk.l    32,0
  71. mus_period_daten:
  72. dc.w    0,3416,3232,3048,2872,2712,2360,2416,2280,2152,2032,1920
  73. dc.w    1808,1712,0,0
  74. dc.w    0,1708,1616,1524,1436,1356,1280,1208,1140,1076,1016,960
  75. dc.w    904,856,0,0
  76. dc.w    0,854,808,762,718,678,640,604,570,538,508,480,452,428,0,0
  77. dc.w    0,427,404,381,359,339,320,302,285,269,254,240,226,214,0,0
  78. dc.w    0,214,202,191,180,170,160,151,143,135,127,120,113,107,0,0
  79. mus_wave_daten:
  80.     dc.w    0,1,2,3,4,6,9,13,18,24,31,39,48,50,61,72
  81. muscmd:
  82.     dc.b    0,0,0,0
  83. muscmd2:
  84.     dc.b    0,0,0,0
  85. musperiod:
  86.     dc.w    0,0,0,0
  87. musvol:
  88.     dc.w    0,0,0,0
  89. musvolcount:
  90.     dc.w    0,0,0,0
  91. musdata:
  92.     dc.w    0,0,0,0
  93. musdata2:
  94.     dc.w    0,0,0,0
  95. musdata3:
  96.     dc.w    0,0,0,0
  97. musdata4:
  98.     dc.w    0,0,0,0
  99. muscount:
  100.     dc.l    0
  101. musnr:
  102.     dc.l    0,0,0,0
  103. musspeed:
  104.     dc.l    0
  105. musstart:
  106.     dc.l    0
  107. musende:
  108.     dc.l    0
  109. musvoice:
  110.     dc.l    0
  111. muspos:
  112.     dc.l    0
  113. musy:
  114.     dc.l    0
  115. musoldspeed:
  116.     dc.l    0
  117. musirq:
  118.     movem.l    a0-a6/d0-d7,-(a7)
  119.     bsr    musplay
  120.     movem.l    (a7)+,a0-a6/d0-d7
  121.     move.l    oldirq,-(a7)
  122.     rts
  123. musplay:
  124.     cmp.l    #0,muscount
  125.     beq    musplay_func
  126.     sub.l    #1,muscount
  127.     bsr    musdo_func
  128.     rts
  129. musplay_func:
  130.     move.l    musspeed,muscount
  131.     move.l    #0,musvoice
  132. musplay_func_loop:
  133.     bsr    musplaysounds
  134.     add.l    #1,musvoice
  135.     cmp.l    #4,musvoice
  136.     bne    musplay_func_loop
  137.     cmp.w    #0,musflags
  138.     beq    musdo_cont
  139.     or.w    #$8000,musflags
  140.     move.w    musflags,$dff096
  141.     move.w    #0,musflags
  142. musdo_cont:
  143.     bsr    musdo_func
  144.     add.l    #1,musy
  145.     cmp.l    #16,musy
  146.     beq    musneuepos
  147.     rts
  148. musneuepos:
  149.     add.l    #1,muspos
  150.     move.l    #0,musy
  151.     move.l    muspos,d0
  152.     cmp.l    musende,d0
  153.     beq    musrestart
  154.     rts
  155. musrestart:
  156.     move.l    musoldspeed,musspeed
  157.     move.l    musstart,muspos
  158.     move.l    #0,muscmd2
  159.     rts
  160. musplayabbruch:
  161.     move.l    #-1,musy
  162.     move.l    #3,musvoice
  163.     jmp    musrestart
  164. musplaysounds:
  165.     move.l    muspos,d0
  166.     move.l    musmem,a0
  167.     muls    #8,d0
  168.     add.l    d0,a0
  169.     move.l    musvoice,d0
  170.     muls    #2,d0
  171.     add.l    d0,a0
  172.     cmp.w    #$ffff,(a0)
  173.     beq    musplayabbruch
  174.     move.w    (a0),d0
  175.     muls    #48,d0
  176.     move.l    musmaxpos,d1
  177.     muls    #8,d1
  178.     add.l    musmem,d1
  179.     add.l    d0,d1
  180.     move.l    d1,a0
  181.     move.l    musy,d0
  182.     muls    #3,d0
  183.     add.l    d0,a0
  184.     cmp.b    #$ff,(a0)
  185.     beq    musplayabbruch
  186.     move.b    (a0),d0
  187.     and.l    #$ff,d0
  188.     cmp.l    #$e0,d0
  189.     bpl    musok
  190.     cmp.l    #$50,d0
  191.     bpl    musfunc
  192.     lea    mus_period_daten,a1
  193.     muls    #2,d0
  194.     add.l    d0,a1
  195.     move.w    (a1),d7
  196.     cmp.l    #0,d7
  197.     beq    musok
  198.     move.l    musvoice,d0
  199.     move.l    d0,d2
  200.     move.l    d0,d3
  201.     move.l    d0,d4
  202.     muls    #$10,d2
  203.     muls    #4,d3
  204.     muls    #2,d4
  205.     move.b    1(a0),d6
  206.     and.l    #$ff,d6
  207.     move.b    2(a0),d5
  208.     and.l    #$ff,d5
  209.     cmp.l    #32,d5
  210.     bpl    musok
  211.     muls    #4,d5
  212.     lea    mussoundstart,a0
  213.     cmp.l    #0,(a0,d5)
  214.     beq    musok
  215.     jsr    musvoiceoff
  216.     cmp.l    #0,d6
  217.     beq    mus_iff_only
  218.     lea    muscmd,a0
  219.     add.l    musvoice,a0
  220.     move.b    #$e3,(a0)
  221.     lea    musvol,a2
  222.     move.w    #0,(a2,d4)
  223.     cmp.l    #$10,d6
  224.     bpl    musatdc
  225.     move.b    #$e4,(a0)
  226.     lea    musvol,a0
  227.     move.w    #64,(a2,d4)
  228. musatdc:
  229.     lea    mus_wave_daten,a0
  230.     lea    musdata,a1
  231.     lea    musdata2,a2
  232.     add.l    d4,a1
  233.     add.l    d4,a2
  234.     move.l    d6,d1
  235.     and.l    #$f,d1
  236.     muls    #2,d1
  237.     move.w    (a0,d1),(a2)
  238.     lea    musvolcount,a4
  239.     move.w    (a0,d1),(a4,d4)
  240.     move.l    d6,d0
  241.     and.l    #$f0,d0
  242.     asr.l    #3,d0
  243.     move.w    (a0,d0),(a1)
  244.     lea    muscmd,a1
  245.     move.l    musvoice,d1
  246.     cmp.b    #$E3,(a1,d1)
  247.     bne    muskeinvol
  248.     move.w    (a0,d0),(a4,d4)
  249. muskeinvol:
  250.     lea    musperiod,a1
  251.     move.w    d7,(a1,d4)
  252.     move.l    #$dff000,a6
  253.     add.l    d2,a6
  254.     lea    musiffstart,a0
  255.     cmp.l    #0,(a0,d5)
  256.     bne    musdo_iff
  257.     lea    mussoundstart,a0
  258.     move.l    (a0,d5),$a0(a6)
  259.     lea    mussoundlaenge,a0
  260.     move.l    (a0,d5),d0
  261.     asr.l    #1,d0
  262.     move.w    d0,$a4(a6)
  263.     move.w    d7,$a6(a6)
  264.     bsr    mussetvol
  265.     bsr    musvoiceon
  266.     lea    musnr,a0
  267.     move.l    d5,(a0,d3)
  268.     rts
  269. musdo_iff:
  270.     move.l    (a0,d5),$a0(a6)
  271.     lea    mussoundloop,a0
  272.     move.l    (a0,d5),d0
  273.     lea    mussoundlooplaenge,a0
  274.     add.l    (a0,d5),d0
  275.     asr.l    #1,d0
  276.     move.w    d0,$a4(a6)
  277.     move.w    d7,$a6(a6)
  278.     bsr    musvoiceon
  279.     lea    musnr,a0
  280.     move.l    d5,(a0,d3)
  281.     rts
  282. mus_keiniff:
  283.     lea    mussoundstart,a0
  284.     move.l    (a0,d5),$a0(a6)
  285.     lea    mussoundlaenge,a0
  286.     move.l    (a0,d5),d0
  287.     asr.l    #1,d0
  288.     move.w    d0,$a4(a6)
  289.     move.w    d7,$a6(a6)
  290.     bsr    musvoiceon
  291.     lea    musnr,a0
  292.     move.l    #-1,(a0,d3)
  293.     lea    musperiod,a0
  294.     move.w    d7,(a0,d4)
  295.     rts
  296. mus_iff_only:
  297.     move.l    #$dff000,a6
  298.     move.l    musvoice,d2
  299.     muls    #$10,d2
  300.     add.l    d2,a6
  301.     lea    muscmd,a0
  302.     add.l    musvoice,a0
  303.     move.b    #0,(a0)
  304.     lea    musvol,a0
  305.     move.l    musvoice,d4
  306.     muls    #2,d4
  307.     move.w    #64,(a0,d4)
  308.     lea    musiffstart,a0
  309.     cmp.l    #0,(a0,d5)
  310.     beq    mus_keiniff
  311.     move.l    (a0,d5),$a0(a6)
  312.     lea    mussoundlaenge,a0
  313.     move.l    (a0,d5),d0
  314.     sub.l    #104,d0
  315.     asr.l    #1,d0
  316.     move.w    d0,$a4(a6)
  317.     move.w    d7,$a6(a6)
  318.     bsr    musvoiceon
  319.     lea    musnr,a0
  320.     move.l    #-1,(a0,d3)
  321.     lea    musperiod,a0
  322.     move.w    d7,(a0,d4)
  323.     rts
  324. musvoiceoff:
  325.     move.l    musvoice,d0
  326.     move.l    #1,d1
  327.     asl.l    d0,d1
  328.     move.w    d1,$dff096
  329.     move.l    musvoice,d0
  330.     muls    #$10,d0
  331.     move.l    #$dff000,a3
  332.     add.l    d0,a3
  333.     move.l    #musleer,$a0(a3)
  334.     move.w    #5,$a4(a3)
  335.     move.w    #0,$a8(a3)
  336.     move.w    #202,$a6(a3)
  337.     rts
  338. musvoiceon:
  339.     move.l    musvoice,d0
  340.     move.l    #1,d1
  341.     asl.l    d0,d1
  342.     or.w    d1,musflags
  343.     rts
  344. musflags:
  345.     dc.w    0
  346. mussetvol:
  347.     move.l    #$dff000,a5
  348.     move.l    musvoice,d0
  349.     muls    #2,d0
  350.     lea    musvol,a0
  351.     add.l    d0,a0
  352.     muls    #8,d0
  353.     add.l    d0,a5
  354.     move.w    (a0),$a8(a5)
  355.     rts
  356. musok:
  357.     rts
  358. muschangespeed:
  359.     move.b    2(a0),d0
  360.     and.l    #$ff,d0
  361.     cmp.l    #32,d0
  362.     bpl    musnochangespeed
  363.     move.l    d0,musspeed
  364. musnochangespeed:
  365.     rts
  366. musfunc:
  367.     cmp.b    #$52,d0
  368.     beq    muschangespeed
  369.     move.l    musvoice,d0
  370.     muls    #2,d0
  371.     lea    muscmd2,a1
  372.     add.l    musvoice,a1
  373.     move.b    (a0),(a1)
  374.     move.b    1(a0),d1
  375.     and.l    #$ff,d1
  376.     lea    musdata3,a1
  377.     move.w    d1,(a1,d0)
  378.     move.b    2(a0),d1
  379.     and.l    #$ff,d1
  380.     lea    musdata4,a1
  381.     move.w    d1,(a1,d0)
  382.     rts
  383. musdo_func:
  384.     move.l    #0,musvoice
  385. musdo_func_loop:
  386.     bsr    musfunc_work
  387.     bsr    mussetvol
  388.     add.l    #1,musvoice
  389.     cmp.l    #4,musvoice
  390.     bne    musdo_func_loop
  391.     rts
  392. musleer:
  393.     dc.b    0,0,0,0,0,0,0,0,0,0,0,0
  394. musfunc_work:
  395.     move.l    musvoice,d0
  396.     muls    #4,d0
  397.     lea    muscmd,a1
  398.     add.l    musvoice,a1
  399.     cmp.b    #0,(a1)
  400.     bne    mus_func_work_weiter
  401. mus_noloop:
  402.     move.l    #musleer,d2
  403.     move.l    #10,d3
  404.     jmp    mus_func_it
  405. mus_func_work_weiter:
  406.     move.l    d0,d1
  407.     lea    musnr,a0
  408.     add.l    d1,a0
  409.     cmp.l    #-1,(a0)
  410.     beq    mus_noloop
  411.     move.l    (a0),d1
  412.     lea    soundlooplaenge,a0
  413.     add.l    d1,a0
  414.     cmp.l    #0,(a0)
  415.     beq    mus_func_workok
  416.     lea    musiffstart,a0
  417.     add.l    d1,a0
  418.     move.l    (a0),d2
  419.     lea    mussoundloop,a0
  420.     add.l    (a0,d1),d2
  421.     lea    mussoundlooplaenge,a0
  422.     move.l    (a0,d1),d3
  423. mus_func_it:
  424.     move.l    musvoice,d0
  425.     muls    #$10,d0
  426.     move.l    #$dff000,a0
  427.     add.l    d0,a0
  428.     cmp.l    #0,d3
  429.     beq    mus_func_workok
  430.     move.l    d2,$a0(a0)
  431.     asr.l    #1,d3
  432.     move.w    d3,$a4(a0)
  433. mus_func_workok:
  434.     lea    musvolcount,a3
  435.     move.l    #$dff000,a6
  436.     lea    musdata,a1
  437.     lea    musdata2,a2
  438.     move.l    musvoice,d0
  439.     move.l    d0,d2
  440.     move.l    d0,d3
  441.     move.l    d0,d4
  442.     muls    #2,d4
  443.     muls    #4,d3
  444.     muls    #$10,d2
  445.     add.l    d2,a6
  446.     lea    muscmd2,a0
  447.     add.l    musvoice,a0
  448.     move.b    (a0),d0
  449.     and.l    #$ff,d0
  450.     cmp.b    #$50,d0
  451.     beq    mustonminus
  452.     cmp.b    #$51,d0
  453.     beq    mustonplus
  454. muscommand2:
  455.     lea    muscmd,a0
  456.     add.l    musvoice,a0
  457.     move.b    (a0),d0
  458.     and.l    #$ff,d0
  459.     cmp.b    #$e3,d0
  460.     beq    musattack
  461.     cmp.b    #$e4,d0
  462.     beq    musdecay
  463.     rts
  464. musattack:
  465.     cmp.w    #0,(a3,d4)
  466.     beq    musdo_attack
  467.     sub.w    #1,(a3,d4)
  468.     rts
  469. musdo_attack:
  470.     lea    musvol,a0
  471.     cmp.w    #64,(a0,d4)
  472.     beq    musattack_ok
  473.     add.w    #8,(a0,d4)
  474.     move.w    (a1,d4),(a3,d4)
  475.     sub.w    #1,(a3,d4)
  476.     rts
  477. musattack_ok:
  478.     lea    muscmd,a0
  479.     move.l    musvoice,d0
  480.     move.b    #$e4,(a0,d0)
  481.     move.w    (a2,d4),(a3,d4)
  482.     sub.w    #1,(a3,d4)
  483. musdecay:
  484.     cmp.w    #0,(a3,d4)
  485.     beq    musdo_decay
  486.     sub.w    #1,(a3,d4)
  487.     rts
  488. musdo_decay:
  489.     lea    musvol,a0
  490.     cmp.w    #0,(a0,d4)
  491.     beq    musdecay_ok
  492.     sub.w    #8,(a0,d4)
  493.     move.w    (a2,d4),(a3,d4)
  494.     sub.w    #1,(a3,d4)
  495.     rts
  496. musdecay_ok:
  497.     lea    muscmd,a0
  498.     move.l    musvoice,d0
  499.     move.b    #0,(a0,d0)
  500.     rts
  501. mustonminus:
  502.     move.l    #$dff000,a6
  503.     move.l    musvoice,d0
  504.     muls    #$10,d0
  505.     add.l    d0,a6
  506.     lea    musdata3,a0
  507.     move.w    (a0,d4),d0
  508.     muls    #$100,d0
  509.     lea    musdata4,a0
  510.     add.w    (a0,d4),d0
  511.     lea    musperiod,a0
  512.     add.w    d0,(a0,d4)
  513.     move.w    (a0,d4),$a6(a6)
  514.     jmp    muscommand2
  515. mustonplus:
  516.     move.l    #$dff000,a6
  517.     move.l    musvoice,d0
  518.     muls    #$10,d0
  519.     add.l    d0,a6
  520.     lea    musdata3,a0
  521.     move.w    (a0,d4),d0
  522.     muls    #$100,d0
  523.     lea    musdata4,a0
  524.     add.w    (a0,d4),d0
  525.     lea    musperiod,a0
  526.     sub.w    d0,(a0,d4)
  527.     move.w    (a0,d4),$a6(a6)
  528.     jmp    muscommand2
  529. muslist:
  530. geschwindigkeit:
  531.     dc.l    0
  532. startpos:
  533.     dc.l    0
  534. endepos:
  535.     dc.l    0
  536. maxpos:
  537.     dc.l    0
  538. muscode:
  539.     blk.b    musl,0
  540. soundlist:
  541. soundstart:
  542.     blk.l    32,0
  543. soundlaenge:
  544.     blk.l    32,0
  545. iffstart:
  546.     blk.l    32,0
  547. soundloop:
  548.     blk.l    32,0
  549. soundlooplaenge:
  550.     blk.l    32,0
  551. soundname:
  552. sounddata:
  553.     blk.b    sndl-640,0
  554. oldirq:
  555.     dc.l    0
  556. musend:
  557.