home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 4: Demo 1 / almathera_demo1.bin / sourcecode / noisetracker1.1 / replay1.1.s < prev    next >
Text File  |  1995-03-17  |  15KB  |  636 lines

  1. *---------------------------------------------------------------*
  2. *                                *
  3. *        NoisetrackerV1.0 replayroutine            *
  4. *                                *
  5. *     Documented, debugged and optimized by JMP in Nov 89    *
  6. *                                *
  7. *---------------------------------------------------------------*
  8. * ALTERATIONS
  9. *
  10. * 1)    SetVolume now sets the shadow copy as well as the chip volume
  11. *    so that volume slides work.
  12. * 2)    Vibrato no longer crashes the main program, it used to use A4
  13. *    although this register wasn't saved by the interrupt routine !!
  14. * 3)    The instrument parameters (addr,length,repeat,replen) are now
  15. *    calculated once in mt_init rather than every time a new note
  16. *    is played
  17. * 4)    Code is now totally position independent.
  18.  
  19.     opt    p+
  20.  
  21. *------------------------------
  22. * EQUATES
  23.  
  24. _custom    equ    $DFF000
  25.  
  26. dmacon    equ    $96
  27.  
  28. aud0    equ    $A0
  29. aud1    equ    $B0
  30. aud2    equ    $C0
  31. aud3    equ    $D0
  32.  
  33. ac_ptr    equ    0
  34. ac_len    equ    4
  35. ac_per    equ    6
  36. ac_vol    equ    8
  37. ac_dat    equ    10
  38.  
  39. *------------------------------
  40. * VOICE INFO
  41.  
  42.     rsreset
  43. vi_command    rs.l    1    command $spppsfnn (see song format)
  44. vi_addr        rs.l    1    sample start address
  45. vi_length    rs.w    1    sample length
  46. vi_repeat    rs.l    1    repeat address
  47. vi_replen    rs.w    1    repeat length
  48. vi_period    rs.w    1    current period
  49. vi_volume    rs.w    1    current volume
  50. vi_voice    rs.w    1    voice enable bit mask (for dmacon)
  51. vi_tdir        rs.b    1    tone portamento direction 0 down/1 up
  52. vi_tspeed    rs.b    1    tone portamento speed
  53. vi_tperiod    rs.w    1    tone portamento dest. period (0=off)
  54. vi_vspeed    rs.b    1    vibrato, bits 7..4=speed, bits 3..0=size
  55. vi_vframe    rs.b    1    vibrato frame count
  56. vi_size        rs.w    0
  57.  
  58. *------------------------------
  59. * LOCAL VARIABLES
  60.  
  61.     rsreset
  62. mv_file        rs.l    1    song file address
  63. mv_speed    rs.b    1    current speed
  64. mv_songpos    rs.b    1    current position 0..127
  65. mv_counter    rs.b    1    frame count
  66. mv_break    rs.b    1    set if pattern break/position jump
  67. mv_length    rs.w    1    song length
  68. mv_pattpos    rs.w    1    current pattern row 0..63
  69. mv_dmacon    rs.w    1    shadow reg for enabled voices
  70. mv_size        rs.w    0
  71.  
  72. *------------------------------
  73. * CONSTANTS
  74.  
  75. no_of_instruments equ 31
  76. no_of_positions equ 128
  77. row_size equ 16
  78. no_of_rows equ 64
  79. pattern_size equ no_of_rows*row_size
  80. instname_size equ 22
  81. songname_size equ 20
  82.  
  83. *------------------------------
  84. * SONG/MODULE format
  85.  
  86. * instrument info
  87.  
  88.     rsreset
  89. in_name        rs.b    instname_size        padded with 0's
  90. in_length    rs.w    1            length in words
  91. in_volume    rs.w    1            volume 0..64
  92. in_repeat    rs.w    1            repeat offset in words
  93. in_replen    rs.w    1            repeat length in words
  94. in_size        rs.w    0
  95.  
  96. * song file
  97.  
  98.     rsreset
  99. sf_name        rs.b    songname_size        padded with 0's
  100. sf_instr    rs.b    no_of_instruments*in_size
  101. sf_length    rs.b    1            song length
  102. sf_restart    rs.b    1            =120, not implemented
  103. sf_positions    rs.b    no_of_positions        pattern nos.
  104. sf_ident    rs.l    1            identifier 'M.K.'
  105. sf_patterns    rs.w    0            patterns start here
  106.  
  107. * pattern format
  108. *
  109. * 16 bytes/row : 4 bytes per voice
  110. * format : $spppsfnn
  111. * where ppp = note (period value)
  112. *    ss  = instrument no. (0 or $01..$1F)
  113. *    f   = special function (0..$F)
  114. *    nn  = parameters for function
  115. *
  116. * function    no.        parameters
  117. *
  118. * arpeggio    0    2nd halfnote    3rd halfnote
  119. * porta up    1               speed
  120. * porta down    2           speed
  121. * tone porta    3           speed
  122. * vibrato    4    vibratospeed     vibratosize
  123. * volume slide    A      upslide      downslide
  124. * jump        B          position
  125. * set volume    C           volume
  126. * pattern break    D         0             0
  127. * set filter    E         0        0=on/1=off
  128. * set speed    F           speed
  129.  
  130. *------------------------------
  131. * TESTER
  132.  
  133. test    lea    mt_data(pc),a0
  134.     bsr.s    mt_init            setup
  135. .loop    move.l    _custom+4,d0        wait for v64
  136.     lsr.l    #8,d0
  137.     and.w    #$1FF,d0
  138.     cmp.w    #128,d0
  139.     bne.s    .loop
  140.     move.w    #$070,_custom+$180    border=green
  141.     bsr    mt_music        irq routine
  142.     move.w    #$000,_custom+$180
  143.     btst    #6,$BFE001        until right button
  144.     bne.s    .loop
  145.     bsr    mt_end            all done
  146.     moveq    #0,d0            ok
  147.     rts
  148.  
  149. *------------------------------
  150. * PLAYER
  151.  
  152. * initialize song
  153. * entry    a0=song file address
  154. * exit    d0-d2,a0-a3 used
  155.  
  156. mt_init    lea    mt_vars(pc),a3
  157.     move.l    a0,mv_file(a3)
  158.     move.b    sf_length(a0),mv_length(a3)    save length
  159.     lea    sf_positions(a0),a1        find maximum pattern no.
  160.     moveq    #no_of_positions-1,d0
  161.     moveq    #0,d2
  162. .find    move.b    (a1)+,d1
  163.     cmp.b    d1,d2
  164.     bgt.s    .find2
  165.     move.b    d1,d2
  166. .find2    dbra    d0,.find
  167.     addq.b    #1,d2
  168.     mulu    #pattern_size,d2
  169.     lea    sf_patterns(a0),a2
  170.     add.l    d2,a2                a2=samples
  171.     lea    sf_instr(a0),a0            a0=instrument info
  172.     lea    mt_sampleinfo(pc),a1        a1=sample info
  173.     moveq    #no_of_instruments-1,d0        for each instrument
  174. .instr    clr.l    (a2)                wipe start of sample
  175.     move.l    a2,(a1)                save addr
  176.     moveq    #0,d1
  177.     move.w    in_length(a0),d1
  178.     move.w    d1,4(a1)            save length
  179.     add.l    d1,d1
  180.     add.l    d1,a2                step 2*length bytes
  181.     move.w    in_volume(a0),12(a1)        save volume
  182.     moveq    #0,d3
  183.     move.w    in_repeat(a0),d3        if repeat<>0 then
  184.     beq.s    .norep
  185.     move.l    (a1),d2
  186.     asl.w    #1,d3
  187.     add.l    d3,d2
  188.     move.l    d2,6(a1)                set repeat addr
  189.     move.w    in_repeat(a0),d0
  190.     add.w    in_replen(a0),d0
  191.     move.w    d0,4(a1)                set length
  192.     bra.s    .next
  193. .norep    move.l    (a1),6(a1)            else    repeat addr = addr
  194. .next    move.w    in_replen(a0),10(a1)            set repeat length
  195.     lea    in_size(a0),a0            next
  196.     lea    16(a1),a1
  197.     dbra    d0,.instr
  198.     or.b    #2,$bfe001            LED off i.e. filter off
  199.     lea    _custom,a0
  200.     clr.w    aud0+ac_vol(a0)            clear volumes
  201.     clr.w    aud1+ac_vol(a0)
  202.     clr.w    aud2+ac_vol(a0)
  203.     clr.w    aud3+ac_vol(a0)
  204.     move.b    #6,mv_speed(a3)            default tempo
  205.     clr.b    mv_songpos(a3)            position 0
  206.     clr.b    mv_counter(a3)            frame 0
  207.     clr.w    mv_pattpos(a3)            row 0
  208.     rts
  209.  
  210. * end song
  211. * exit    a0 used
  212.  
  213. mt_end    lea    _custom,a0
  214.     clr.w    aud0+ac_vol(a0)            clear volumes
  215.     clr.w    aud1+ac_vol(a0)
  216.     clr.w    aud2+ac_vol(a0)
  217.     clr.w    aud3+ac_vol(a0)
  218.     move.w    #$000F,dmacon(a0)        disable audio dma
  219.     rts
  220.  
  221. * music irq handler
  222. * exit    all registers preserved
  223. * note    call on a vbl
  224.  
  225. mt_music
  226.     movem.l    d0-d4/a0-a6,-(a7)        save used registers
  227.     lea    mt_vars(pc),a3            local variables
  228.     lea    _custom,a4            hardware
  229.     move.l    mv_file(a3),a0            a0=song file
  230.     addq.b    #1,mv_counter(a3)        frame+1
  231.     move.b    mv_counter(a3),d0
  232.     cmp.b    mv_speed(a3),d0            if frame<speed then
  233.     bge.s    .getnew
  234.     lea    mt_voice1(pc),a6            update each voice
  235.     lea    aud0(a4),a5
  236.     bsr    mt_checkcom
  237.     lea    mt_voice2(pc),a6
  238.     lea    aud1(a4),a5
  239.     bsr    mt_checkcom
  240.     lea    mt_voice3(pc),a6
  241.     lea    aud2(a4),a5
  242.     bsr    mt_checkcom
  243.     lea    mt_voice4(pc),a6
  244.     lea    aud3(a4),a5
  245.     bsr    mt_checkcom
  246.     bra    .endr
  247. .getnew    clr.b    mv_counter(a3)            else frame=0
  248.     move.l    mv_file(a3),a0            check new notes
  249.     lea    sf_positions(a0),a2        a2=positions
  250.     lea    sf_patterns(a0),a0        a0=patterns
  251.     moveq    #0,d0
  252.     move.l    d0,d1
  253.     move.b    mv_songpos(a3),d0
  254.     move.b    (a2,d0.w),d1            get current pattern no.
  255.     asl.l    #8,d1
  256.     asl.l    #2,d1
  257.     add.l    d1,a0
  258.     add.w    mv_pattpos(a3),a0        a0=ptr to current pattern
  259.     lea    mt_voice1(pc),a6
  260.     move.l    (a0)+,vi_command(a6)        get command bytes
  261.     move.l    (a0)+,vi_size+vi_command(a6)
  262.     move.l    (a0)+,2*vi_size+vi_command(a6)
  263.     move.l    (a0)+,3*vi_size+vi_command(a6)
  264.     clr.w    mv_dmacon(a3)            no voices selected
  265.     lea    aud0(a4),a5            update each voice
  266.     lea    mt_voice1(pc),a6
  267.     bsr    mt_playvoice
  268.     lea    aud1(a4),a5
  269.     lea    mt_voice2(pc),a6
  270.     bsr    mt_playvoice
  271.     lea    aud2(a4),a5
  272.     lea    mt_voice3(pc),a6
  273.     bsr    mt_playvoice
  274.     lea    aud3(a4),a5
  275.     lea    mt_voice4(pc),a6
  276.     bsr    mt_playvoice
  277.     move.w    #300,d0                delay
  278. .wait    dbra    d0,.wait
  279.     move.w    mv_dmacon(a3),d0        enable flagged voices
  280.     or.w    #$8000,d0
  281.     move.w    d0,dmacon(a4)
  282.     move.w    #300,d0                delay
  283. .wait2    dbra    d0,.wait2
  284.     lea    mt_voice1(pc),a6
  285.     move.l    vi_repeat(a6),aud0+ac_ptr(a4)    set repeat address,length
  286.     move.w    vi_replen(a6),aud0+ac_len(a4)
  287.     move.l    vi_size+vi_repeat(a6),aud1+ac_ptr(a4)
  288.     move.w    vi_size+vi_replen(a6),aud1+ac_len(a4)
  289.     move.l    2*vi_size+vi_repeat(a6),aud2+ac_ptr(a4)
  290.     move.w    2*vi_size+vi_replen(a6),aud2+ac_len(a4)
  291.     move.l    3*vi_size+vi_repeat(a6),aud3+ac_ptr(a4)
  292.     move.w    3*vi_size+vi_replen(a6),aud3+ac_len(a4)
  293.     add.w    #row_size,mv_pattpos(a3)    bump pattern row
  294.     cmp.w    #pattern_size,mv_pattpos(a3)    if end of pattern then
  295.     bne.s    .endr
  296. .nex    clr.w    mv_pattpos(a3)                row=0
  297.     clr.b    mv_break(a3)                cancel break flag
  298.     move.b    mv_songpos(a3),d1            next position
  299.     addq.b    #1,d1
  300.     and.b    #no_of_positions-1,d1
  301.     cmp.b    mv_length(a3),d1            if end of song then
  302.     bne.s    .ok
  303.     moveq    #0,d1                        restart
  304. .ok    move.b    d1,mv_songpos(a3)
  305. .endr    move.b    mv_break(a3),d0            if pattern break then next
  306.     bne.s    .nex
  307.     movem.l    (a7)+,d0-d4/a0-a6        restore registers
  308.     rts
  309.  
  310. * update voice for new note
  311. * entry    d1=index into current pattern
  312. *    a5=audio ptr
  313. *    a6=voice info
  314.  
  315. mt_playvoice
  316.     moveq    #0,d2
  317.     move.b    vi_command+2(a6),d2        get instrument no.
  318.     lsr.b    #4,d2
  319.     move.b    vi_command(a6),d0
  320.     and.b    #$F0,d0
  321.     or.b    d0,d2                if new instrument then
  322.     beq.s    .setreg
  323.     lsl.w    #4,d2                    get parameters
  324.     lea    mt_sampleinfo-16(pc),a1
  325.     add.w    d2,a1
  326.     move.l    (a1)+,vi_addr(a6)
  327.     move.w    (a1)+,vi_length(a6)
  328.     move.l    (a1)+,vi_repeat(a6)
  329.     move.w    (a1)+,vi_replen(a6)
  330.     move.w    (a1)+,vi_volume(a6)
  331. .setreg    move.w    vi_volume(a6),ac_vol(a5)        set chip volume
  332.     move.w    vi_command(a6),d2        get period
  333.     and.w    #$FFF,d2
  334.     beq    mt_checkcom2            if period<>0 then
  335.     move.b    vi_command+2(a6),d0
  336.     and.b    #$F,d0                    if command=3 then
  337.     cmp.b    #$3,d0
  338.     bne.s    .setper                    set portamento
  339.     move.w    d2,vi_tperiod(a6)            set dest. period
  340.     clr.b    vi_tdir(a6)
  341.     cmp.w    vi_period(a6),d2            cancel if = period
  342.     beq.s    .port1                    set direction flag
  343.     bge.s    .port2
  344.     addq.b    #1,vi_tdir(a6)
  345.     bra.s    .port2
  346. .port1    clr.w    vi_tperiod(a6)
  347. .port2    bra    mt_checkcom2
  348. .setper    move.w    vi_voice(a6),d0            else
  349.     move.w    d0,dmacon(a4)                disable voice
  350.     or.w    d0,mv_dmacon(a3)            flag voice used
  351.     move.w    d2,vi_period(a6)            set period
  352.     clr.b    vi_vframe(a6)                clear vibrato frame
  353.     move.l    vi_addr(a6),ac_ptr(a5)            set chip address
  354.     move.w    vi_length(a6),ac_len(a5)        set chip length
  355.     move.w    d2,ac_per(a5)                set chip period
  356.     bra    mt_checkcom2
  357.  
  358. * check commands 1..4,10
  359. * entry    A5=audio ptr
  360. *    A6=voice info
  361.  
  362. mt_checkcom
  363.     move.w    vi_command+2(a6),d0        skip if no command
  364.     and.w    #$FFF,d0
  365.     beq.s    .skip
  366.     lsr.w    #6,d0
  367.     and.w    #$003C,d0
  368.     jmp    .v0(pc,d0.w)
  369. .v0    bra    mt_arpeggio        (quicker)
  370. .v1    bra    mt_portup
  371. .v2    bra    mt_portdown
  372. .v3    bra    mt_myport
  373. .v4    bra    mt_vib
  374. .v5    bra    .skip
  375. .v6    bra    .skip
  376. .v7    bra    .skip
  377. .v8    bra    .skip
  378. .v9    bra    .skip
  379. .vA    bra    mt_volslide
  380. .vB    bra    .skip
  381. .vC    bra    .skip
  382. .vD    bra    .skip
  383. .vE    bra    .skip
  384. .vF    bra    .skip
  385. .skip    move.w    vi_period(a6),ac_per(a5)
  386.     rts
  387.  
  388. * do arpeggio
  389.  
  390. mt_arpeggio
  391.     moveq    #0,d0
  392.     move.b    mv_counter(a3),d0        cycle = counter mod 3
  393.     divs    #3,d0
  394.     swap    d0
  395.     cmp.w    #1,d0
  396.     bcs.s    .arp2
  397.     bne.s    .arp1
  398.     moveq    #0,d0                cycle=1 : period+2nd halfnote
  399.     move.b    vi_command+3(a6),d0
  400.     lsr.b    #4,d0
  401.     bra.s    .arp3
  402. .arp1    moveq    #0,d0                cycle=2 : period+3rd halfnote
  403.     move.b    vi_command+3(a6),d0
  404.     and.b    #$F,d0
  405. .arp3    asl.w    #1,d0
  406.     moveq    #0,d1
  407.     lea    mt_periods(pc),a0
  408.     move.w    vi_period(a6),d1
  409.     moveq    #37-1,d7
  410. .loop    move.w    (a0,d0.w),d2            find new period
  411.     cmp.w    (a0)+,d1
  412.     bge.s    .arp4
  413.     dbra    d7,.loop
  414.     rts
  415. .arp2    move.w    vi_period(a6),d2        cycle=0 : period
  416. .arp4    move.w    d2,ac_per(a5)            set chip period
  417.     rts
  418.  
  419. * portamento up
  420.  
  421. mt_portup
  422.     moveq    #0,d0
  423.     move.b    vi_command+3(a6),d0
  424.     sub.w    d0,vi_period(a6)        period-offset
  425.     move.w    vi_period(a6),d0
  426.     and.w    #$FFF,d0
  427.     cmp.w    #$71,d0                min $71
  428.     bpl.s    .ok
  429.     and.w    #$F000,vi_period(a6)
  430.     or.w    #$71,vi_period(a6)
  431. .ok    move.w    d0,ac_per(a5)            set chip period
  432.     rts
  433.  
  434. * portamento down
  435.  
  436. mt_portdown
  437.     moveq    #0,d0
  438.     move.b    vi_command+3(a6),d0
  439.     add.w    d0,vi_period(a6)        period+offset
  440.     move.w    vi_period(a6),d0
  441.     and.w    #$FFF,d0
  442.     cmp.w    #$358,d0            max $358
  443.     bmi.s    .ok
  444.     and.w    #$F000,vi_period(a6)
  445.     or.w    #$358,vi_period(a6)
  446. .ok    move.w    d0,ac_per(a5)            set chip period
  447.     rts
  448.  
  449. * do tone portamento
  450.  
  451. mt_myport
  452.     move.b    vi_command+3(a6),d0        if new speed then
  453.     beq.s    .slide
  454.     move.b    d0,vi_tspeed(a6)            set speed
  455.     clr.b    vi_command+3(a6)
  456. .slide    tst.w    vi_tperiod(a6)            skip if off
  457.     beq.s    .skip
  458.     moveq    #0,d0                get speed
  459.     move.b    vi_tspeed(a6),d0
  460.     tst.b    vi_tdir(a6)            if up then
  461.     bne.s    .minus
  462.     add.w    d0,vi_period(a6)            period+speed
  463.     move.w    vi_tperiod(a6),d0
  464.     cmp.w    vi_period(a6),d0            if >=dest then done
  465.     bgt.s    .ok
  466.     bra.s    .done
  467. .minus    sub.w    d0,vi_period(a6)        else
  468.     move.w    vi_tperiod(a6),d0            period-speed
  469.     cmp.w    vi_period(a6),d0
  470.     blt.s    .ok                    if <=dest then
  471. .done    move.w    vi_tperiod(a6),vi_period(a6)            period=dest
  472.     clr.w    vi_tperiod(a6)                    cancel
  473. .ok    move.w    vi_period(a6),ac_per(a5)        set chip period
  474. .skip    rts
  475.  
  476. * do vibrato
  477.  
  478. mt_vib    move.b    vi_command+3(a6),d0        if new speed/size then
  479.     beq.s    .vi
  480.     move.b    d0,vi_vspeed(a6)            set speed/size
  481. .vi    move.b    vi_vframe(a6),d0        get frame
  482.     lsr.w    #2,d0
  483.     and.w    #$1F,d0
  484.     moveq    #0,d2
  485.     move.b    .sine(pc,d0.w),d2        index offset = 255*sin(frame)
  486.     move.b    vi_vspeed(a6),d0        *size/64
  487.     and.w    #$F,d0
  488.     mulu    d0,d2
  489.     lsr.w    #6,d2
  490.     move.w    vi_period(a6),d0
  491.     tst.b    vi_vframe(a6)            set chip period+/-offset
  492.     bpl.s    .plus
  493.     neg.w    d2
  494. .plus    add.w    d2,d0
  495.     move.w    d0,ac_per(a5)
  496.     move.b    vi_vspeed(a6),d0        frame+speed
  497.     lsr.w    #2,d0
  498.     and.w    #$3C,d0
  499.     add.b    d0,vi_vframe(a6)
  500.     rts
  501.  
  502. * fn(i=0..31)=255*sin(i*360/32)
  503.  
  504. .sine    dc.b    $00,$18,$31,$4a,$61,$78,$8d,$a1
  505.     dc.b    $b4,$c5,$d4,$e0,$eb,$f4,$fa,$fd
  506.     dc.b    $ff,$fd,$fa,$f4,$eb,$e0,$d4,$c5
  507.     dc.b    $b4,$a1,$8d,$78,$61,$4a,$31,$18
  508.     even
  509.  
  510. * volume slide
  511.  
  512. mt_volslide
  513.     move.w    vi_period(a6),ac_per(a5)    set period
  514.     moveq    #0,d0
  515.     move.b    vi_command+3(a6),d0
  516.     cmp.b    #16,d0                if high nibble <> 0 then
  517.     bcs.s    .down
  518.     lsr.b    #4,d0
  519.     add.w    vi_volume(a6),d0            volume+offset, max 64
  520.     cmp.w    #64,d0
  521.     bmi.s    .vol2
  522.     moveq    #64,d0
  523.     bra.s    .vol2
  524. .down    and.b    #$F,d0                else
  525.     neg.w    d0
  526.     add.w    vi_volume(a6),d0            volume-offset, min 0
  527.     bpl.s    .vol2
  528.     moveq    #0,d0
  529. .vol2    move.w    d0,vi_volume(a6)
  530.     move.w    d0,ac_vol(a5)            set chip volume
  531.     rts
  532.  
  533. * check for commands B..F
  534.  
  535. mt_checkcom2
  536.     move.b    vi_command+2(a6),d0        get command no.
  537.     and.w    #$000F,d0
  538.     add.w    d0,d0
  539.     jmp    .v0(pc,d0.w)
  540. .v0    rts            (quicker)
  541. .v1    rts
  542. .v2    rts
  543. .v3    rts
  544. .v4    rts
  545. .v5    rts
  546. .v6    rts
  547. .v7    rts
  548. .v8    rts
  549. .v9    rts
  550. .vA    rts
  551. .vB    bra.s    .jump
  552. .vC    bra.s    .setvol
  553. .vD    bra.s    .break
  554. .vE    bra.s    .filter
  555. .vF    bra.s    .speed
  556. .filter    move.b    vi_command+3(a6),d0
  557.     and.b    #1,d0
  558.     add.b    d0,d0
  559.     and.b    #$FD,$BFE001            0=on/1=off
  560.     or.b    d0,$BFE001
  561.     rts
  562. .jump    move.b    vi_command+3(a6),d0
  563.     subq.b    #1,d0
  564.     move.b    d0,mv_songpos(a3)        set song position
  565. .break    not.b    mv_break(a3)            force break
  566.     rts
  567. .setvol    moveq    #0,d0
  568.     move.b    vi_command+3(a6),d0        max 64
  569.     cmp.b    #64,d0
  570.     ble.s    .sv2
  571.     moveq    #64,d0
  572. .sv2    move.w    d0,vi_volume(a6)
  573.     move.w    d0,ac_vol(a5)
  574.     rts
  575. .speed    move.b    vi_command+3(a6),d0
  576.     and.w    #31,d0                skip if 0
  577.     beq.s    .speed2
  578.     clr.b    mv_counter(a3)
  579.     move.b    d0,mv_speed(a3)
  580. .speed2    rts
  581.  
  582. *------------------------------
  583. * TABLES
  584.  
  585.  
  586. mt_periods
  587.     dc.w    $0358,$0328,$02fa,$02d0,$02a6,$0280
  588.     dc.w    $025c,$023a,$021a,$01fc,$01e0,$01c5
  589.     dc.w    $01ac,$0194,$017d,$0168,$0153,$0140
  590.     dc.w    $012e,$011d,$010d,$00fe,$00f0,$00e2
  591.     dc.w    $00d6,$00ca,$00be,$00b4,$00aa,$00a0
  592.     dc.w    $0097,$008f,$0087,$007f,$0078,$0071
  593.     dc.w    0,0
  594.  
  595. *------------------------------
  596. * VARIABLES
  597.  
  598. mt_vars    ds.b    mv_size
  599.     even
  600.  
  601. * sample info
  602. * 16 bytes per sample = addr.l,length.w,repeat.l,replen.w,volume.w,padding.w
  603.  
  604. mt_sampleinfo
  605.     ds.b    no_of_instruments*16
  606.  
  607. * voice info (see rs at top of file)
  608.  
  609. mt_voice1
  610.     ds.l    5
  611.     dc.w    $0001        dma select mask
  612.     ds.w    3
  613. mt_voice2
  614.     ds.l    5
  615.     dc.w    $0002
  616.     ds.w    3
  617. mt_voice3
  618.     ds.l    5
  619.     dc.w    $0004
  620.     ds.w    3
  621. mt_voice4
  622.     ds.l    5
  623.     dc.w    $0008
  624.     ds.w    3
  625.  
  626. *------------------------------
  627. * MODULE
  628.  
  629. mt_data    incbin    "st-00:modules/mod.scav3"
  630.  
  631. *------------------------------
  632.  
  633.     end
  634.  
  635.  
  636.