home *** CD-ROM | disk | FTP | other *** search
/ Dave Lowe: KQ 6 Amiga Samples / Lowe_KQ6AmigaSamples.adf / kq6v1.bak < prev    next >
Encoding:
Text File  |  1993-10-25  |  34.6 KB  |  1,894 lines

  1.  
  2.     ;    DRIVER AND MUSIC REMAIN COPYRIGHT D.LOWE 
  3.  
  4.     ;     KINGS QUEST VI..Island Of Dreams
  5.  
  6.  
  7.  
  8.     ; It must be assembled with SYMBOLS CASE independent.
  9.  
  10.     ; dont hesitate to ring with any problems
  11.  
  12.  
  13.  
  14.     ;        DAVE LOWE.....0723  870648
  15.  
  16.  
  17.  
  18. ;        **************************
  19.  
  20.     section issA,code_c    ;must be in low memory for dma access
  21.                 ;DEVPAC PSEUDO OP ..CAN BE DELETED
  22.  
  23.  
  24. ;*****************************************
  25.  
  26.         ;  ALL EQUs
  27.  
  28. a00  equ  508*2
  29. bb00  equ  480*2
  30. b00  equ  453*2
  31.  
  32. c01  equ  428*2
  33. db01  equ  404*2
  34. d01 equ  381*2
  35. eb01  equ  360*2
  36. e01  equ  339*2
  37. f01  equ  320*2
  38. gb01  equ  302*2
  39. g01  equ  285*2
  40. ab01 equ 269*2
  41. a01  equ  508
  42. bb01  equ  480
  43. b01  equ  453
  44.  
  45. c02  equ  428
  46. db02  equ  404
  47. d02  equ  381
  48. eb02  equ  360
  49. e02  equ  339
  50. f02  equ  320
  51. gb02  equ  302
  52. g02  equ  285
  53. ab02 equ 269
  54. a02  equ  254
  55. bb02  equ  240
  56. b02  equ  226
  57.  
  58. c03  equ  214
  59. db03  equ  202
  60. d03  equ  190
  61. eb03  equ  180
  62. e03  equ  170
  63. f03  equ  160
  64. gb03  equ  151
  65. g03  equ  143
  66. ab03 equ 135
  67. a03  equ  127
  68.  
  69. bb03  equ  480*2
  70. b03  equ  453*2
  71.  
  72. c04  equ  428*2
  73. db04  equ  404*2
  74. d04 equ  381*2
  75. eb04  equ  360*2
  76. e04  equ  339*2
  77. f04  equ  320*2
  78. gb04  equ  302*2
  79. g04  equ  285*2
  80. ab04 equ 269*2
  81. a04  equ  508
  82. bb04  equ  480
  83. b04  equ  453
  84.  
  85. c05  equ  428
  86. db05  equ  404
  87. d05  equ  381
  88. eb05  equ  360
  89. e05  equ  339
  90. f05  equ  320
  91. gb05  equ  302
  92. g05  equ  285
  93. ab05 equ 269
  94. a05  equ  254
  95. bb05  equ  240
  96. b05  equ  226
  97.  
  98. c06  equ  214
  99. db06  equ  202
  100. d06  equ  190
  101. eb06  equ  180
  102. e06  equ  170
  103. f06  equ  160
  104. gb06  equ  151
  105. g06  equ  143
  106. ab06 equ 135
  107. a06  equ  127
  108. bb06  equ  480*2
  109. b06  equ  453*2
  110.  
  111. c07  equ  428*2
  112. db07  equ  404*2
  113. d07 equ  381*2
  114. eb07  equ  360*2
  115. e07  equ  339*2
  116. f07  equ  320*2
  117. gb07  equ  302*2
  118. g07  equ  285*2
  119. ab07 equ 269*2
  120. a07  equ  508
  121. bb07  equ  480
  122. b07  equ  453
  123.  
  124. c08  equ  428
  125. db08  equ  404
  126. d08  equ  381
  127. eb08  equ  360
  128. e08  equ  339
  129. f08  equ  320
  130. gb08  equ  302
  131. g08  equ  285
  132. ab08 equ 269
  133. a08  equ  254
  134. bb08  equ  240
  135. b08  equ  226
  136.  
  137.  
  138. v equ 0
  139.  
  140. no_loop equ 0
  141. loop equ 0
  142. chann1reg   equ $dff0a0    
  143. chann2reg   equ $dff0b0
  144. chann3reg   equ $dff0c0
  145. chann4reg   equ $dff0d0
  146. dmacon     equ $dff096
  147. int_bf_int   equ   $dff01e
  148. int_bf_w    equ   $dff09a
  149. vhposr     equ   $dff006
  150. in_line    equ   0
  151. new_snd    equ   4
  152. end_song     equ   1
  153. end_patt    equ   8
  154. new_env    equ   12
  155. pbend     equ   16
  156.  
  157.  
  158.  
  159. hi: equ 223
  160. lo:  equ 446
  161.  
  162. r22    equ 134
  163. r20    equ 179        ;correctum
  164. r19    equ 150
  165. r18    equ 178
  166. r17    equ 200
  167. r16:    equ 227        ;correctum
  168. r15:    equ 249
  169. r14    equ 280
  170. r13:    equ 305
  171. r12:    equ 333
  172. r11:    equ 361
  173. r10:    equ 389
  174. r9:    equ 419
  175. r8:    equ 446
  176. r7:    equ 446+112
  177. r6:    equ 446+223
  178. r5:    equ 446+223+112
  179. r4:    equ 446*2
  180. r3:    equ 446*3
  181. r2:    equ 446*4
  182. r1:    equ 446*8
  183.  
  184.  
  185. filter: equ $bfe001
  186. filter_on equ 44
  187. filter_off equ 48
  188.  
  189. modon     equ   20
  190. pboff     equ   24
  191. modoff     equ   28
  192. rest     equ 32
  193. end_fxp  equ 36
  194. end_fx3  equ 36
  195. end_fx4  equ 40
  196. acc    equ 52
  197. repeat    equ 56
  198. down      equ   1
  199. up       equ   2
  200.  
  201. ;***************************************************************
  202.  
  203.  
  204.  ;    THIS IS THE CONTROL SECTION FOR TESTING AS A STAND ALONE PRG. 
  205.  
  206.     ;       AND CAN BE DELETED WHEN NOT REQUIRED
  207.  
  208.  
  209.     jsr select_new_song
  210.  
  211. testloop:
  212.     jsr delay    ;wait for scan line  at 50hz on pal
  213.  
  214.     jsr driver
  215.  
  216.         bra testloop
  217.  
  218.  
  219. delay:
  220.     tst.w fxtimer
  221.     bne no_test
  222.     clr.l d0
  223.     move.b $bfe001,d0
  224.     btst #6,d0
  225.     bne no_test1
  226.     move.w #10,fxtimer
  227.     bra testfx4
  228. no_test
  229.     subq #1,fxtimer
  230. no_test1
  231.     clr.l d0
  232.         move.w vhposr,d0
  233.         andi.w #%1111111100000000,d0
  234.         cmpi.w #%1111111100000000,d0
  235.  
  236.     bne no_test1
  237.     rts
  238.  
  239. testfx4:  
  240.  
  241.     ;jsr    kill_chip
  242.     ;move.w #1,int_disable
  243.     clr.l d0
  244.     move.b $bfe001,d0
  245.     btst #6,d0
  246.     beq testfx4
  247.  
  248.     move.l song_buffer,d0
  249.     addq.l #1,d0
  250.     cmp.l    #4,d0
  251.     bne nores
  252.     move.l #1,d0
  253. nores    move.l d0,song_buffer
  254.     jsr    select_new_song
  255.  
  256.  
  257.     ;move.l fx_last,d0
  258.     ;move.l d0,fx_kill
  259.  
  260.     ;jsr kill_loopfx        ;use only one fx at a time
  261.                     ;for testing
  262.  
  263. no_k
  264.         move.l fx_no,fx_number
  265.     move.l fx_no,fx_last
  266.     addq.l #1,fx_no
  267.     move.l    max_fx,d0
  268.         cmp.l fx_no,d0
  269.     bne noreset
  270.     move.l #1,fx_no    
  271. noreset: 
  272.     ;jsr set_up_fx
  273.     bra no_test    
  274.  
  275. fxtc:          dc.w 10
  276. fx_no:         dc.l  1
  277. fx_last        dc.l  0
  278.  
  279.  
  280. ;        END OF CONTROL (DELETABLE) SECTION
  281.  
  282. ;**********************************************************
  283.  
  284. ; --------------------------------------------------------------
  285.  
  286. ;    MAIN VARIABLES TO BE ACCESSED BY PROGRAMMER DURING RUNTIME
  287.  
  288.  
  289. fx_number:     dc.l 0 ;     number of fx required here...no fx in this one
  290. fx_kill        dc.l 0 ;     number of fx to kill/only needed for looped fx
  291.  
  292. song_buffer     dc.l 1 ;     number of piece of music required here ie.1 to 6
  293.  
  294. music_disable:  dc.w 0 ;     1 = disable music
  295. fx_disable:     dc.w 0 ;     1 = disable fx  (currently disabled)
  296.  
  297. ;    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  298.  
  299. ;  THESE VARIABLES ARE USED INTERNALLY BY THE DRIVER
  300. fxr1         dc.l 0  
  301. fxr2         dc.l 0  
  302. fxr3         dc.l 0  
  303. fxr4         dc.l 0  
  304. fxc1        dc.l 0
  305. fxc2          dc.l 0
  306. fxc3        dc.l 0
  307. fxc4          dc.l 0
  308. fx1_flag    dc.w 0
  309. fx2_flag    dc.w 0
  310. fx3_flag    dc.w 0
  311. fx4_flag    dc.w 0
  312. fxtimer        dc.w 0
  313. gen        dc.w 0
  314. int_disable    dc.w 0
  315. altpf         dc.w 0
  316. kill_flag    dc.w 0
  317. ;  *******************************************************
  318.  
  319. ;  CALL THIS SUBROUTINE TO SET UP THE REQIURED FX
  320. ;  on entry it requires the fx number to be in "fx_number"(see above)
  321.  
  322.  
  323. set_up_fx
  324.     movem.l d5/a2,-(a7)    ;save used registers
  325.  
  326.     tst.l fxc4
  327.     bne check3
  328. use4:    
  329.     move.w #%0000000000001000,d5
  330.     lea chann4reg,a2
  331.     jsr end_fx4p
  332.     move.l fx_number,fxr4
  333.     move.l fx_number,fxc4
  334.     move.l #0,fx_number
  335.     bra no_fx
  336. check3:    tst.l fxc3
  337.     bne check2
  338. use3:
  339.     move.w #%0000000000000100,d5
  340.     lea chann3reg,a2
  341.     jsr end_fx3p
  342.     move.l fx_number,fxr3
  343.     move.l fx_number,fxc3
  344.     move.l #0,fx_number
  345.     bra no_fx
  346. check2:    tst.l fxc2
  347.     bne check1
  348. use2:
  349.     move.w #%0000000000000010,d5
  350.     lea chann2reg,a2
  351.     jsr end_fx2p
  352.     move.l fx_number,fxr2
  353.     move.l fx_number,fxc2
  354.     move.l #0,fx_number
  355.     bra no_fx
  356. check1:    tst.l fxc1
  357.     bne use3
  358. use1:
  359.     move.w #%0000000000000001,d5
  360.     lea chann1reg,a2
  361.     jsr end_fx1p
  362.     move.l fx_number,fxr1
  363.     move.l fx_number,fxc1
  364.     move.l #0,fx_number
  365. no_fx
  366.     movem.l (a7)+,d5/a2    ;restore registers
  367.     rts
  368.  
  369. ;*************************************************
  370. ;          CALL HERE TO KILL ANY FX...
  371. ;       after putting the number of the fx you want to kill
  372. ;            into fx_kill
  373.  
  374. kill_loopfx
  375.  
  376.     movem.l d5/a2,-(a7)    ;save used registers
  377.     move.l fx_kill,d5
  378.     cmp.l fxc1,d5
  379.     bne k2
  380.     move.w #%0000000000000001,d5
  381.     lea chann1reg,a2
  382.     jsr end_fx1p
  383.     bra error
  384. k2    cmp.l fxc2,d5
  385.     bne k3
  386.     move.w #%0000000000000010,d5
  387.     lea chann2reg,a2
  388.     jsr end_fx2p
  389.     bra error
  390. k3    cmp.l fxc3,d5
  391.     bne k4
  392.     move.w #%0000000000000100,d5
  393.     lea chann3reg,a2
  394.     jsr end_fx3p
  395.     bra error
  396. k4    cmp.l fxc4,d5
  397.     bne error
  398.     move.w #%0000000000001000,d5
  399.     lea chann2reg,a2
  400.     jsr end_fx4p
  401. error
  402.     clr.l fx_kill
  403.     movem.l (a7)+,d5/a2    ;restore registers
  404.     rts
  405. ;*************************************************
  406.  
  407.     ; CALL HERE TO KILL ANY SOUND for whatever reason
  408.  
  409. kill_chip:
  410.     move.w #%0000000000001111,dmacon
  411.     move.l rest_data,chann1reg
  412.     move.l rest_data,chann2reg
  413.     move.l rest_data,chann3reg
  414.     move.l rest_data,chann4reg
  415.     move.w #16,chann1reg+4    
  416.     move.w #16,chann2reg+4    
  417.     move.w #16,chann3reg+4    
  418.     move.w #16,chann4reg+4    
  419.     move.w #0,chann1reg+8
  420.     move.w #0,chann2reg+8
  421.     move.w #0,chann3reg+8
  422.     move.w #0,chann4reg+8
  423.     move.w #1,chann1reg+6
  424.     move.w #1,chann2reg+6
  425.     move.w #1,chann3reg+6
  426.     move.w #1,chann4reg+6
  427.     move.l #0,fxr1
  428.     move.l #0,fxr2
  429.     move.l #0,fxr3
  430.     move.l #0,fxr4
  431.     move.w #0,fx1_flag
  432.     move.w #0,fx2_flag
  433.     move.w #0,fx3_flag
  434.     move.w #0,fx4_flag
  435.     move.l #0,fxc1
  436.     move.l #0,fxc2
  437.     move.l #0,fxc3
  438.     move.l #0,fxc4
  439.     rts
  440. ;****************************************
  441.  
  442. ;  CALL HERE TO SELECT WHICH PIECE OF MUSIC TO PLAY
  443. ;  AFTER PLACING NUMBER (1 to 6) IN "SONG_BUFFER"..see above
  444. ;  a call to this routine will initiliase the driver/kill any sound etc.      
  445. ;  make sure this routine has been called before running the interrupt
  446. ;  driven section....see below
  447.  
  448. select_new_song:
  449.  
  450.     move.w #1,int_disable
  451.     movem.l d0/d1/a0/a1,-(a7)    ;save used registers
  452.     move.w music_disable,gen
  453.     move.w #1,music_disable
  454.         jsr kill_chip           
  455.     clr.l d0
  456.         move.w #204,d0
  457.         lea gvars,a0
  458. clloop: clr.w (a0)+        
  459.         dbra  d0,clloop
  460.     tst.l song_buffer
  461.     beq no_song
  462.         move.l song_buffer,d1
  463.     add.l d1,d1
  464.      add.l d1,d1
  465.      add.l d1,d1
  466.      add.l d1,d1
  467.         LEA  SONG_TABLE-16,A1
  468.  
  469.         add.l d1,a1      
  470.         MOVE.L (A1)+,WSONG1    
  471.         move.l (a1)+,wsong2    
  472.         move.l (a1)+,wsong3
  473.     move.l (a1),wsong4
  474.         MOVE.L #pstart,PATTR1
  475.         MOVE.L #pstart,PATTR2
  476.         MOVE.L #pstart,PATTR3
  477.     move.l #pstart,pattr4
  478.         move.l #sstart,songr1
  479.         MOVE.L #sstart,SONGR2
  480.         MOVE.L #sstart,SONGR3
  481.     move.l #sstart,songr4
  482. no_song
  483.     move.w #1,ch1vars
  484.     move.w #2,ch2vars
  485.     move.w #3,ch3vars
  486.     move.w #4,ch4vars
  487.     move.w #6,ch4fxvars
  488.     move.w #5,ch3fxvars
  489.     move.w #7,ch2fxvars
  490.     move.w #8,ch1fxvars
  491.     move.w gen,music_disable
  492.     clr.w int_disable
  493.     movem.l (a7)+,d0/d1/a0/a1    ;restore registers
  494.         rts
  495.  
  496. ;**************************************************
  497.  
  498. ;  CALL HERE ON A 50hz INTERRUPT DURING RUNTIME
  499. ;  TO PLAY FX AND TUNES
  500.  
  501. driver:  
  502.     tst.w int_disable
  503.     beq process_data
  504.     rts        
  505. process_data
  506.     movem.l d0-d6/a0-a6,-(a7)    ;save used registers
  507.  
  508.  
  509. ch1:
  510.     tst.w fx_disable
  511.     bne test_music1
  512.     tst.l fxr1
  513.     bne   ch1j1
  514.     tst.l fxc1
  515.     beq test_music1
  516.     bra ch1j3
  517. ch1j2    jsr run_dummy1
  518.     jsr run_fx1
  519.     bra ch2
  520. ch1j1
  521.     jsr set_up1
  522. ch1j3    tst.w music_disable    
  523.     beq ch1j2
  524.     jsr run_fx1
  525.     bra ch2
  526. test_music1
  527.     tst.w music_disable
  528.     bne ch2
  529.     jsr run_music1
  530.     bra ch2
  531.     ;***********************
  532.  
  533.     ; channel 1 subroutines
  534.  
  535. run_dummy1    
  536.      lea ch1vars,a0
  537.      lea dummy_reg,a2 
  538.      move.w #0,d5 
  539.      jsr sect1    
  540.     rts
  541.  
  542. set_up1    
  543.          move.l fxr1,d0
  544.          add d0,d0
  545.          add d0,d0
  546.          lea  fxjump_table-4,A1
  547.      add.l d0,a1
  548.          move.l (a1),currfx1
  549.       clr.l fxr1
  550.      clr.w fxintc1
  551.       rts
  552.   
  553.      
  554. run_fx1
  555.     lea ch1fxvars,a0
  556.        lea chann1reg,a2
  557.       move.w #%0000000000000001,d5 
  558.      move.w #%1000001000000001,d1 
  559.      jsr sect1
  560.     rts
  561.  
  562. run_music1
  563.     lea ch1vars,a0
  564.        lea chann1reg,a2
  565.       move.w #%0000000000000001,d5 
  566.       move.w #%1000001000000001,d1 
  567.       jsr sect1     
  568.     rts
  569.  
  570.     ;  **************************
  571. ch2
  572.     tst.w fx_disable
  573.     bne test_music2
  574.     tst.l fxr2
  575.     bne   ch2j1
  576.     tst.l fxc2
  577.     beq test_music2
  578.     bra ch2j3
  579. ch2j2    jsr run_dummy2
  580.     jsr run_fx2
  581.     bra ch3
  582. ch2j1
  583.     jsr set_up2
  584. ch2j3    tst.w music_disable    
  585.     beq ch2j2
  586.     jsr run_fx2
  587.     bra ch3
  588.  
  589. test_music2
  590.     tst.w music_disable
  591.     bne ch3
  592.     jsr run_music2
  593.     bra ch3
  594.     ;***********************
  595.     ; channel 2 subroutines
  596. run_dummy2    
  597.      lea ch2vars,a0
  598.      lea dummy_reg,a2 
  599.      move.w #0,d5 
  600.      jsr sect1    
  601.     rts
  602.  
  603. set_up2    
  604.          move.l fxr2,d0
  605.          add d0,d0
  606.          add d0,d0
  607.          lea  fxjump_table-4,A1
  608.      add.l d0,a1
  609.          move.l (a1),currfx2
  610.       clr.l fxr2
  611.      clr.w fxintc2
  612.       rts
  613.   
  614.      
  615. run_fx2
  616.     lea ch2fxvars,a0
  617.        lea chann2reg,a2
  618.       move.w #%0000000000000010,d5 
  619.      move.w #%1000001000000010,d1 
  620.      jsr sect1
  621.     rts
  622.  
  623. run_music2
  624.     lea ch2vars,a0
  625.        lea chann2reg,a2
  626.       move.w #%0000000000000010,d5 
  627.       move.w #%1000001000000010,d1 
  628.       jsr sect1     
  629.     rts
  630.  
  631.     ;  **************************
  632.  
  633. ch3:
  634.     tst.w fx_disable
  635.     bne test_music3
  636.     tst.l fxr3
  637.     bne   ch3j1
  638.     tst.l fxc3
  639.     beq test_music3
  640.     bra ch3j3
  641. ch3j2    jsr run_dummy3
  642.     jsr run_fx3
  643.     bra ch4
  644. ch3j1
  645.     jsr set_up3
  646. ch3j3    tst.w music_disable    
  647.     beq ch3j2
  648.     jsr run_fx3
  649.     bra ch4
  650.  
  651. test_music3
  652.     tst.w music_disable
  653.     bne ch4
  654.     jsr run_music3
  655.     bra ch4
  656.  
  657.     ;***********************
  658.  
  659.     ; channel 3 subroutines
  660.  
  661. run_dummy3    
  662.      lea ch3vars,a0
  663.      lea dummy_reg,a2 
  664.      move.w #0,d5 
  665.      jsr sect1    
  666.     rts
  667.  
  668. set_up3    
  669.          move.l fxr3,d0
  670.          add d0,d0
  671.          add d0,d0
  672.          lea  fxjump_table-4,A1
  673.      add.l d0,a1
  674.          move.l (a1),currfx3
  675.       clr.l fxr3
  676.      clr.w fxintc3
  677.       rts
  678.   
  679.      
  680. run_fx3
  681.     lea ch3fxvars,a0
  682.        lea chann3reg,a2
  683.       move.w #%0000000000000100,d5 
  684.      move.w #%1000001000000100,d1 
  685.      jsr sect1
  686.     rts
  687.  
  688. run_music3
  689.     lea ch3vars,a0
  690.        lea chann3reg,a2
  691.       move.w #%0000000000000100,d5 
  692.       move.w #%1000001000000100,d1 
  693.       jsr sect1     
  694.     rts
  695.  
  696.     ;  **************************
  697.  
  698. ch4:
  699.     tst.w fx_disable
  700.     bne test_music4
  701.     tst.l fxr4
  702.     bne   ch4j1
  703.     tst.l fxc4
  704.     beq test_music4
  705.     bra ch4j3
  706. ch4j2    jsr run_dummy4
  707.     jsr run_fx4
  708.     bra no4
  709. ch4j1
  710.     jsr set_up4
  711. ch4j3    tst.w music_disable    
  712.     beq ch4j2
  713.     jsr run_fx4
  714.     bra no4
  715.  
  716. test_music4
  717.     tst.w music_disable
  718.     bne no4
  719.     jsr run_music4
  720. no4    
  721.     movem.l (a7)+,d0-d6/a0-a6    ;restore registers
  722.     rts
  723.  
  724.     ;***********************
  725.  
  726.     ; channel 4 subroutines
  727.  
  728. run_dummy4    
  729.      lea ch4vars,a0
  730.      lea dummy_reg,a2 
  731.      move.w #0,d5 
  732.      jsr sect1    
  733.     rts
  734.  
  735. set_up4    
  736.          move.l fxr4,d0
  737.          add d0,d0
  738.          add d0,d0
  739.          lea  fxjump_table-4,A1
  740.      add.l d0,a1
  741.          move.l (a1),currfx4
  742.       clr.l fxr4
  743.      clr.w fxintc4
  744.       rts
  745.   
  746.      
  747. run_fx4
  748.     lea ch4fxvars,a0
  749.        lea chann4reg,a2
  750.       move.w #%0000000000001000,d5 
  751.      move.w #%1000001000001000,d1 
  752.      jsr sect1
  753.     rts
  754.  
  755. run_music4
  756.     lea ch4vars,a0
  757.        lea chann4reg,a2
  758.       move.w #%0000000000001000,d5 
  759.       move.w #%1000001000001000,d1 
  760.       jsr sect1     
  761.     rts
  762.     ;  **************************
  763.  
  764. sect1: tst.w 0(a0)
  765.     bne s1j1
  766.     rts
  767.  
  768. s1j1:    tst.w 2(a0)
  769.         beq sect3       
  770.         cmpi.w #1,2(a0)
  771.         beq sect4
  772.  
  773.         cmpi.w #3,4(a0)    
  774.         beq part2       
  775.     
  776. mode_switch:  subq.w #1,2(a0)     
  777.  
  778. check_effects: clr.w altpf      
  779.         move.w 6(a0),d2    
  780.         tst.w 8(a0)      
  781.         beq check_mod
  782.         tst.w 14(a0)      
  783.         beq cont_bend
  784.         subq.w #1,14(a0)
  785.         bra check_mod
  786. cont_bend:   addq.w #1,altpf    
  787.         move.w 10(a0),d3    
  788.         move.w 12(a0),d4    
  789.         cmpi.w #1,8(a0)
  790.         beq pbup
  791.     
  792.         sub.w d3,d2
  793.         cmp.w d2,d4
  794.         bcs check_mod
  795.         bra fbend
  796.  
  797. pbup:     add.w d3,d2
  798.         cmp.w d2,d4
  799.         bcc check_mod
  800. fbend:     move.w d4,d2
  801.         clr.w 8(a0)      
  802. check_mod:   tst.w 16(a0)
  803.         beq send_alt_pitch
  804.    
  805.  
  806.     tst.w  58(a0)
  807.     beq st_ok
  808.     subq.w #1,58(a0)
  809.     bra send_alt_pitch
  810. st_ok:
  811.         tst.w 50(a0)
  812.         beq cont_mod
  813.         subq #1,50(a0)
  814.         bra send_alt_pitch
  815. cont_mod:    move.w 52(a0),50(a0)  
  816.         addq #1,altpf
  817.         cmpi #3,16(a0)
  818.         bcc addmod
  819.     
  820.         move.w 56(a0),d3 
  821.         sub.w d3,d2
  822.         addq.w #1,16(a0)  
  823.         bra send_alt_pitch
  824. addmod:
  825.  
  826.         move.w 54(a0),d3 
  827.         add.w d3,d2
  828.         addq.w #1,16(a0)
  829.         cmpi.w #5,16(a0)
  830.        bne send_alt_pitch
  831.         move.w #1,16(a0)  
  832.  
  833. send_alt_pitch: tst.w altpf
  834.         beq send_env
  835.         move.w d2,6(a0)  
  836.         move.w d2,6(a2)  
  837.  
  838. send_env: 
  839.  
  840.     ;cmpi #6,(a0)
  841.     ;beq norm_env    
  842.     ;cmpi #5,(a0)
  843.     ;bne do_env_check
  844.  
  845.     ;tst.w fxc4
  846.     ;beq norm_env
  847.     ;bra low_vol
  848.  
  849. do_env_check:
  850.     move.w fx_disable,d0
  851.     ;or.w fxc4,d0
  852.     cmpi.w  #1,d0
  853.     beq norm_env
  854. low_vol:    
  855.     move.l 18(a0),a1    
  856.         cmpi.w #255,(a1)
  857.         beq evj1
  858.     move.w (a1)+,d0
  859. evj2:    sub.w  62(a0),d0
  860.     bcc no_over
  861.     move.w 0,d0
  862. no_over:
  863.         move.w d0,8(a2) 
  864.     bra fint        
  865.  
  866. evj1:   subq.l #2,a1
  867.     move.w (a1)+,d0
  868.     bra evj2
  869.  
  870. norm_env:
  871.     move.l 18(a0),a1    
  872.         cmpi.w #255,(a1)
  873.         beq env_finished
  874.     ;cmpi.w #1,66(a0)    
  875.     ;bne    no_acc 
  876.  
  877.     clr.l d0
  878.     move.w (a1)+,d0
  879.     ;sub.w 64(a0),d0    
  880.     move.w d0,8(a2)    
  881.     move.l a1,18(a0)
  882.     rts        
  883.  
  884.  
  885. no_acc:
  886. resu:  
  887. no_off    move.w d0,8(a2)
  888.      move.w (a1)+,8(a2)
  889.    
  890. fint:   move.l a1,18(a0)    
  891.     rts
  892.  
  893. env_finished:
  894.      subq.l #2,a1    
  895.      bra resu
  896.  
  897.  
  898. one_shot_note: move.w #3,4(a0)     
  899.         move.l 38(a0),(a2)
  900.         move.w 42(a0),4(a2)
  901.         move.w d1,dmacon     
  902.         bra send_env
  903.  
  904.  
  905. part2:                         
  906.         move.l 44(a0),(a2)
  907.         move.w 48(a0),4(a2)
  908.         subq.w #1,2(a0)      
  909.         move.w #1,4(a0)
  910.         bra check_effects
  911.  
  912. sect3:
  913.     move.w 0,66(a0)    
  914.  
  915.     move.l 22(a0),a1  
  916. control_ret: move.w (a1)+,d0  
  917.     cmpi.w #100,d0   
  918.     bls sect5   
  919.   
  920. acc_note:
  921.     move.w d0,6(a0)  
  922.     move.w d0,6(a2)  
  923.     move.w (a1)+,2(a0) 
  924.     subq.w #1,2(a0)  
  925.     move.l a1,22(a0)  
  926.     move.l 34(a0),18(a0) 
  927.     move.w 60(a0),58(a0) 
  928.  
  929.  
  930.     tst.w 16(a0)
  931.     beq no_mod_res
  932.     move.w #1,16(a0)
  933. no_mod_res:
  934.     cmpi.w #0,4(a0)
  935.     beq do_loop
  936.     bra one_shot_note    
  937.  
  938.  
  939. do_loop:    move.w d1,dmacon   
  940.         bra send_env
  941.  
  942. do_rest:
  943.     move.w (a1)+,2(a0) 
  944.     subq.w #1,2(a0)  
  945.     move.l a1,22(a0)  
  946.     move.l  #rest_env,18(a0)
  947.  
  948.         move.w #0,8(a2)
  949.         bra send_env
  950.    
  951. sect4:
  952.         cmpi.w #0,4(a0)
  953.         beq noof
  954.         move.w d5,dmacon   
  955. noof:     subq.w #1,2(a0)
  956.         bra check_effects
  957.    
  958. sect5:     move.l #jump_table,a3
  959.         move.l (a3,d0),a4
  960.         jmp (a4)
  961.  
  962. jump_table: 
  963.     dc.l  in_line_data
  964.         dc.l  nsound
  965.         dc.l  patt_end
  966.         dc.l  get_env
  967.         dc.l  check_pbend
  968.         dc.l  do_mod
  969.         dc.l  bend_off
  970.         dc.l  mod_off
  971.         dc.l  do_rest
  972.         dc.l  end_fx
  973.         dc.l  end_fx
  974.     dc.l  s_f_on
  975.     dc.l  s_f_off
  976.     dc.l  set_acc
  977.     dc.l  rept
  978.  
  979. in_line_data:
  980.  
  981.         nop
  982.         rts
  983.  
  984. rept:
  985.     move.l (a1),a1
  986.     bra control_ret
  987.  
  988. s_f_on: 
  989.     bclr #1,filter
  990.     bra control_ret
  991. s_f_off:
  992.     bset #1,filter
  993.     bra control_ret
  994.  
  995. nsound:    move.l (a1)+,a3     
  996.         cmpi.w #0,(a3)
  997.         bne one_shot_sound
  998.         move.w (a3)+,4(a0)    
  999.         move.l (a3)+,(a2)     
  1000.         move.w (a3),4(a2)    
  1001.         jmp control_ret
  1002.  
  1003. one_shot_sound:
  1004.         move.w (a3)+,4(a0)
  1005.         move.l (a3)+,38(a0)   
  1006.         move.l (a3)+,42(a0)
  1007.         move.l (a3),46(a0)
  1008.         jmp control_ret
  1009.  
  1010. patt_end:
  1011.  
  1012.         move.l 26(a0),a1    
  1013.         cmpi.l #0,(a1)     
  1014.         beq song_control
  1015.         addq.l #4,26(a0)    
  1016.         move.l (a1),a1     
  1017.         jmp control_ret
  1018. get_env: 
  1019.        move.l (a1)+,a4 
  1020.     move.l (a4)+,62(a0)    
  1021.     
  1022.     move.l  a4,34(a0)    
  1023.     
  1024.         bra control_ret
  1025.  
  1026. check_pbend:
  1027.      move.l (a1)+,8(a0)
  1028.         move.l (a1)+,12(a0)
  1029.         bra control_ret
  1030.  
  1031. do_mod:    move.w #1,16(a0)  
  1032.         move.l (a1)+,50(a0)
  1033.         move.l (a1)+,54(a0)
  1034.         move.l (a1)+,58(a0)
  1035.         bra control_ret
  1036.  
  1037. bend_off:   clr.w 8(a0)
  1038.         bra control_ret
  1039.  
  1040. mod_off:    clr.w 16(a0)
  1041.         bra control_ret
  1042.  
  1043.  
  1044. end_fx:    
  1045.     cmpi.w #6,(a0)
  1046.     beq end_fx4p
  1047.     cmpi.w #5,(a0)
  1048.     beq end_fx3p
  1049.     cmpi.w #7,(a0)
  1050.     beq end_fx2p
  1051.  
  1052. end_fx1p:
  1053.         move.w d5,dmacon   
  1054.     move.w  #1,chann1reg+6
  1055.     move.w #0,8(a2)
  1056.     move.l #0,fxc1
  1057.     rts
  1058.  
  1059. end_fx2p:
  1060.     move.w d5,dmacon 
  1061.     move.w  #1,chann2reg+6
  1062.         move.w #0,8(a2) 
  1063.     move.l #0,fxc2
  1064.         rts
  1065.  
  1066.  
  1067. end_fx3p:
  1068.         move.w d5,dmacon   
  1069.     move.w  #1,chann3reg+6
  1070.     move.w #0,8(a2)
  1071.     move.l #0,fxc3
  1072.     rts
  1073.  
  1074. end_fx4p:
  1075.     move.w d5,dmacon 
  1076.     move.w  #1,chann4reg+6
  1077.         move.w #0,8(a2) 
  1078.     move.l #0,fxc4
  1079.         rts
  1080.  
  1081. set_acc: move.w #1,66(a0) 
  1082.     bra control_ret
  1083.  
  1084. song_control:
  1085.         addq.l #4,a1
  1086.         move.l 30(a0),26(a0)
  1087.         move.l 26(a0),a1
  1088.         addq.l #4,26(a0)
  1089.         move.l (a1),a1
  1090.         jmp control_ret
  1091.  
  1092.  
  1093.     ;"""""""""""""""""""""""""""""""""""""""""""""""""
  1094.  
  1095.     ;;; DATA
  1096.  
  1097. song_table:
  1098.  
  1099.         dc.l s1_v1,s2_v1,s3_v1,s4_v1
  1100.         dc.l s1_v2,s2_v2,s3_v2,s4_v2
  1101.         dc.l s1_castle,s2_castle,s3_castle,s4_castle
  1102.  
  1103. ;************************************************************
  1104. gvars:
  1105. ch1vars     
  1106.     dc.w 0     
  1107.         dc.w 0,0,0,0,0,0,0,0,0,0     
  1108. pattr1: dc.l 0    
  1109. songr1: dc.l 0    
  1110. wsong1: dc.l 0   
  1111.         dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0   
  1112.  
  1113. ch2vars     
  1114.     dc.w 0     
  1115.         dc.w 0,0,0,0,0,0,0,0,0,0     
  1116. pattr2: dc.l 0    
  1117. songr2: dc.l 0    
  1118. wsong2: dc.l 0    
  1119.         dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0   
  1120.  
  1121. ch3vars 
  1122.     dc.w 0     
  1123.         dc.w 0,0,0,0,0,0,0,0,0,0     
  1124. pattr3: dc.l 0    
  1125. songr3: dc.l 0    
  1126. wsong3: dc.l 0    
  1127.         dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0   
  1128.  
  1129. ch4vars 
  1130.     dc.w 0     
  1131.         dc.w 0,0,0,0,0,0,0,0,0,0     
  1132. pattr4: dc.l 0    
  1133. songr4: dc.l 0    
  1134. wsong4: dc.l 0    
  1135.         dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0   
  1136.  
  1137.  
  1138. ch1fxvars 
  1139.     dc.w 0     
  1140. fxintc1:
  1141.     dc.w 0,0,0,0,0,0,0,0,0,0     
  1142. currfx1:
  1143.     dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0    
  1144.  
  1145. ch2fxvars 
  1146.     dc.w 0     
  1147. fxintc2:
  1148.     dc.w 0,0,0,0,0,0,0,0,0,0     
  1149. currfx2:
  1150.     dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0    
  1151.  
  1152.  
  1153. ch3fxvars
  1154.     dc.w 0     
  1155. fxintc3:
  1156.     dc.w 0,0,0,0,0,0,0,0,0,0     
  1157. currfx3:
  1158.     dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0    
  1159.  
  1160. ch4fxvars 
  1161.     dc.w 0     
  1162. fxintc4:
  1163.     dc.w 0,0,0,0,0,0,0,0,0,0     
  1164. currfx4:
  1165.     dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0    
  1166. ;************************************************************
  1167.  
  1168. dummy_reg dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1169.         dc.l  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1170.         dc.l  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1171.         dc.l  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1172. ;************************************************************
  1173.  
  1174. ;       THESE ARE THE FX PATTERNS................
  1175.  
  1176. ; The interrupt counter in these patterns is dependent on the
  1177. ; playback speed.The figure is calculated as follows
  1178. ; (length/playback speed) *50
  1179. ; the figure then needs rounding up to give a clear finish
  1180. ; if you have the count longer than needed it will cut
  1181. ; out the music on the relevent channel for longer than
  1182. ; neccessary and make it sound jerky
  1183. ; The fx table is below the patterns
  1184.  
  1185.  
  1186. ;fight:
  1187.       ;dc.w new_env
  1188.       ;dc.l fight_env
  1189.       ;dc.w new_snd
  1190.       ;dc.l fightp
  1191.     ;dc.w r8,8        ;r8=8000 playback speed/8=int counter
  1192.       ;dc.w end_fxp
  1193.  
  1194. ;fight_env:            dc.w 0,64,64,64,255
  1195.  
  1196. ;*************************
  1197.  
  1198.  
  1199. fxjump_table:  
  1200.  
  1201.     dc.l 0            ;fx number 1
  1202.  
  1203. max_fx    dc.l    30
  1204. ;______________________________________________________________________
  1205.  
  1206.  
  1207. sstart: dc.l 0,end_song
  1208.  
  1209. pstart: dc.w end_patt
  1210.  
  1211.  
  1212. ;----------------------------------
  1213.  
  1214. ;;;;;;;;;;;;;;;;;;;;;   Music Data ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1215.  
  1216. cr  set   32
  1217. q set  cr/2
  1218. sq set q/2
  1219. dsq set sq/4
  1220.  
  1221. tq1 set      7
  1222. tq2 set   6
  1223. tsq1 set  3
  1224. tsq2 set 4
  1225.  
  1226. ssilence:
  1227.     dc.l    pr
  1228.       dc.l     0,end_song
  1229.  
  1230.  
  1231. ;************************************************
  1232.  
  1233. songs:
  1234.  
  1235. s1_v1:
  1236.  
  1237.     dc.l    tune_pat
  1238.       dc.l     0,end_song
  1239. s2_v1:
  1240.  
  1241.     dc.l    abass_snd
  1242.     dc.l    bass
  1243.         DC.L    0,end_song
  1244.  
  1245.  
  1246. s3_v1:
  1247.  
  1248.     ;dc.l    pr
  1249.     dc.l    sitar_snd
  1250.     dc.l    sitar
  1251.     dc.l     0,end_song
  1252.  
  1253.  
  1254. s4_v1:
  1255.     dc.l    tamb_snd
  1256.     dc.l    tambourine
  1257.     dc.l     0,end_song
  1258.  
  1259.  
  1260.  
  1261. patterns:
  1262.  
  1263. pr:
  1264.     dc.w rest,cr*4
  1265.     dc.w end_patt
  1266.  
  1267.  
  1268. tambourine:
  1269.     dc.w    130,cr,130,q,130,q
  1270.     dc.w end_patt
  1271.  
  1272.  
  1273.  
  1274. sitar
  1275.     dc.w modon,1,1,2,2,6,6
  1276.     dc.w    c01,cr*8,c01,cr*8,c01,cr*8,c01,cr*4,c02,cr*2,c02,cr*2
  1277.     dc.w    g01,cr*4,g04,cr*4,bb01,cr*4,g01,cr*4
  1278.     dc.w    g01,cr*4,g04,cr*4,bb01,cr*2,g01,cr*2
  1279.     dc.w    c01,cr*8,c01,cr*8,c01,cr*8,c01,cr*8,c02,cr*4
  1280.  
  1281.     dc.w    g01,cr*4,g04,cr*4,bb01,cr*4,g01,cr*4
  1282.     dc.w    g01,cr*4,g04,cr*4,bb01,cr*4,g01,cr*4
  1283.     
  1284.  
  1285.     dc.w end_patt
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.         ;flute and guitar  for village 1 tune                 
  1292.  
  1293. tune_pat:
  1294.     dc.w    new_env
  1295.     dc.l    flute_env
  1296.     dc.w    new_snd
  1297.     dc.l    flutep
  1298. ;patch here*********
  1299.     dc.w modon,1,1,2,2,6,6
  1300.     dc.w    rest,cr*5
  1301.     dc.w c03,cr,b02,cr+q,ab02,q,g02,$0124,d02,$005c
  1302.     dc.w eb02,$0004,d02,$0010,c02,$0068,g01,$0014,ab01,$0014
  1303.     dc.w b01,$0004,ab01,$0004,b01,$0004,ab01,$000c,g01,$00c4
  1304.     dc.w g02,$0020
  1305.  
  1306.     dc.w    new_env
  1307.     dc.l    aguitar_env
  1308.     dc.w    new_snd
  1309.     dc.l    aguitp
  1310.  
  1311. ;patch here*********
  1312.     dc.w g02,$0010,ab02,$0010,b02,$0008,c03,$0004,b02,$0004
  1313.     dc.w ab02,$0010,g02,$0010,f02,$0014,g02,$000c,ab02,$0010
  1314.     dc.w g02,$0004,ab02,$0004,g02,$0008,f02,$0010,g02,$0020
  1315.     dc.w d02,$0010,eb02,$0010,f02,$0010,g02,$0010,f02,$0004
  1316.     dc.w g02,$0004,f02,$0004,eb02,$0014,d02,$0010,eb02,$0010
  1317.     dc.w d02,$0004,eb02,$0004,d02,$0008,c02,$0010,b01,$0010
  1318.     dc.w c02,$0010,b01,$0004,c02,$0004,b01,$0008,ab01,$0010
  1319.     dc.w b01,$0040,g02,$0020,g02,$0010,ab02,$0010,b02,$0004
  1320.     dc.w c03,$0004,b02,$0008,ab02,$0010,g02,$0010,f02,$0010
  1321.     dc.w g02,$0010,ab02,$0010,g02,$0004,ab02,$0004,g02,$0008
  1322.     dc.w f02,$0010,g02,$0020,d02,$0010,eb02,$0010,f02,$0010
  1323.     dc.w g02,$0010,f02,$0004,g02,$0004,f02,$0008,eb02,$0010
  1324.     dc.w d02,$0010,eb02,$0010,d02,$0004,eb02,$0004,d02,$0008
  1325.     dc.w b01,q,c02,$00e8-8
  1326.  
  1327.     dc.w    new_env
  1328.     dc.l    flute_env
  1329.     dc.w    new_snd
  1330.     dc.l    flutep
  1331.  
  1332. ;patch here*********
  1333.     dc.w g02,$004c,c02,$0004,g02,$0004,c02,$0098,c02,$0018
  1334.     dc.w b01,$0030,ab01,$002c,g01,$00ac,d02,$0010,eb02,$000c
  1335.     dc.w f02,$0008,g02,$000c,ab02,$0008,b02,$0008,c03,$0008
  1336.     dc.w d03,$0008,eb03,$0008,f03,$0008,g03,$0044,g03,$0004
  1337.     dc.w ab03,$0008,g03,$0004,f03,$0004,g03,$0008,f03,$0004
  1338.     dc.w eb03,$0010,d03,$0004,eb03,$0004,d03,$0008,c03,$0010
  1339.     dc.w b02,$0004,c03,$0004,b02,$0008,ab02,$0020,g02,$0004
  1340.     dc.w ab02,$0008,g02,$0004,f02,$0004,g02,$0008,f02,$0004
  1341.     dc.w eb02,$0004,f02,$0008,eb02,$0004,d02,$0004,eb02,$0008
  1342.     dc.w d02,$0004,c02,$0004,d02,$0008,c02,$0004,b01,$0004
  1343.     dc.w c02,$0008,b01,$0004,ab01,$0004,b01,$0008,ab01,$0004
  1344.     dc.w g01,$0004,g01,$000c,ab01,$0010,g01,$0010,c02,$0010    ;start g01 fiddled was 0
  1345.     dc.w b01,$0004,c02,$0004,b01,$0008,ab01,$0010,g01,$0020
  1346.     dc.w g01,$0010,ab01,$0010,g01,$0010,c02,$0010,b01,$0004
  1347.     dc.w c02,$0004,b01,$0008,ab01,$0010,g01,$0020,d02,$0010
  1348.     dc.w eb02,$0010,d02,$0010,g02,$0010,f02,$0004,g02,$0004
  1349.     dc.w f02,$0008,eb02,$0010,d02,$0004,eb02,$0004,d02,$0008
  1350.     dc.w c02,$0010,d02,$0040,d02,$0040,g01,$0010
  1351.  
  1352.     dc.w    new_env
  1353.     dc.l    aguitar_env
  1354.     dc.w    new_snd
  1355.     dc.l    aguitp
  1356.  
  1357. ;patch here*********
  1358.     dc.w ab01,$0010,g01,$0010,c02,$0010,b01,$0004,c02,$0004
  1359.     dc.w b01,$0008,ab01,q,g01,$0024-4,g01,$0010,ab01,$0010
  1360.     dc.w g01,$0010,c02,$0010,b01,$0004,c02,$0004,b01,$0008
  1361.     dc.w ab01,$0010,g01,$0020,d02,$0010,eb02,$0010,d02,$0010
  1362.     dc.w g02,$0010,f02,$0004,g02,$0004,f02,$0004,eb02,$0014
  1363.     dc.w d02,$0004,eb02,$0004,d02,$0004,c02,$0014,b01,cr*2
  1364.     dc.w b01,cr*2
  1365.     dc.w end_patt
  1366.  
  1367. bass         ;                                                     
  1368.     dc.w c02,$0070,c02,$0010,c02,$0080,c02,$0070
  1369.     dc.w c02,$0010,c02,$0080,c02,$0070,c02,$0010,c02,$0080
  1370.     dc.w c02,$0070,c02,$0010,c02,$0060,c02,$0020,g01,$0030
  1371.     dc.w g01,$0010,g01,$0040,g01,$0030,g01,$0010,g01,$0040
  1372.     dc.w bb01,$0030,bb01,$0010,bb01,$0040,g01,$0030,g01,$0010
  1373.     dc.w g01,$0020,g02,$0020,g01,$0030,g01,$0010,g01,$0040
  1374.     dc.w g01,$0030,g01,$0010,g01,$0040,bb01,$0030,bb01,$0010
  1375.     dc.w g01,$0040,c02,$0030,c02,$0010,c02,$0040,c02,$0070
  1376.     dc.w c02,$0010,c02,$0080,c02,$0070,c02,$0010,c02,$0080
  1377.     dc.w c02,$0070,c02,$0010,c02,$0080,c02,$0070,c02,$0010
  1378.     dc.w c02,$0060,c02,$0020,g01,$0030,g01,$0010,g01,$0040
  1379.     dc.w g01,$0030,g01,$0010,g01,$0040,bb01,$0030,bb01,$0010
  1380.     dc.w bb01,$0040,g01,$0030,g01,$0010,g01,$0020,g02,$0020
  1381.     dc.w g01,$0030,g01,$0010,g01,$0040,g01,$0030,g01,$0010
  1382.     dc.w g01,$0040,bb01,$0030,bb01,$0010,bb02,$0040,g01,cr*2-q
  1383.     dc.w g01,q,g01,cr*2
  1384.     dc.w end_patt
  1385. ;******************************
  1386.  
  1387. s1_v2:
  1388.     dc.l    aguitar_snd
  1389.     dc.l    v2tune
  1390.       dc.l     0,end_song
  1391. s2_v2:
  1392.  
  1393.     dc.l    flute_snd
  1394.     dc.l    v2flute
  1395.         DC.L    0,end_song
  1396.  
  1397.  
  1398. s3_v2:
  1399.  
  1400.     dc.l    aguitar_snd_quiet
  1401.     dc.l    v2chords
  1402.     dc.l     0,end_song
  1403.  
  1404.  
  1405. s4_v2:
  1406.     dc.l    tamb_snd
  1407.     dc.l    v2tamb
  1408.     dc.l     0,end_song
  1409.  
  1410.  
  1411. v2tune:
  1412.  
  1413. pattxxx         ;tune vill 2                                          
  1414.  
  1415.     dc.w g02,$0010,f02,$0010,g02,$0010,ab02,$0010
  1416.     dc.w bb02,$0010,c03,$0010,bb02,$0010,c03,$0010,bb02,$0004
  1417.     dc.w c03,$0004,bb02,$0008,ab02,$0010,g02,$0010,eb02,$0010
  1418.     dc.w d02,$0010,c02,$0010,d02,$0010,eb02,$0010,f02,$0010
  1419.     dc.w g02,$000c,g02,$0004,f02,$0060,c02,$0010,b01,$0010
  1420.     dc.w c02,$0010,d02,$0010,eb02,$0010,f02,$0010,g02,$0010
  1421.     dc.w ab02,$0010,g02,$0004,ab02,$0004,g02,$0004,f02,$0010+4
  1422.     dc.w eb02,$0010,c02,$0010,b01,$0010,a01,$0010,b01,$0010
  1423.     dc.w c02,$0010,d02,$0010,eb02,$0008,d02,$0008,eb02,cr*3
  1424.     dc.w g02,$0010,f02,$0010,g02,$0010,a02,$0010,bb02,$0010
  1425.     dc.w c03,$0010,d03,$0010,eb03,$0010,d03,$0010,c03,$0010
  1426.     dc.w bb02,$0010,g02,$0010,gb02,$0010,e02,$0010,gb02,$0010
  1427.     dc.w g02,$0010,a02,$0010,bb02,$000c,a02,$0004,bb02,$0044
  1428.     dc.w gb02,$001c,g02,$0010,f02,$0010,eb02,$0010,d02,$0010
  1429.     dc.w c02,$0010,a01,$0010,b01,$0020,c02,$0040,b01,$0020
  1430.     dc.w c02,$0060,c02,cr*3
  1431.     dc.w end_patt
  1432.  
  1433. v2flute:
  1434.  
  1435.     dc.w    rest,cr*16*3
  1436.  
  1437.     dc.w eb02,$0020,bb02,$0058,bb02,$0004,c03,$0004
  1438.     dc.w bb02,$0020,ab02,$0018,g02,$0004,ab02,$0004,g02,$0020
  1439.     dc.w f02,$0058,f02,$0004,g02,$0004,f02,$0020,eb02,$0018
  1440.     dc.w d02,$0004,eb02,$0004,d02,$0020,c02,$0058,c02,$0004
  1441.     dc.w d02,$0004,c02,$0020,b01,$0018,ab01,$0004,b01,$0004
  1442.     dc.w ab01,$0020,g01,$0070,g01,$0010,ab01,$0010,b01,$0010
  1443.     dc.w c02,$0010,d02,$0010,eb02,$0040,eb02,$0010,f02,$0010
  1444.     dc.w g02,$0060,gb02,$0040,gb02,$0010,d02,$0010,a02,$0080
  1445.     dc.w g02,$0010,f02,$0010,eb02,$0010,c02,$0010,d02,$0020
  1446.     dc.w eb02,$0018,d02,$0004,eb02,$0004,d02,$0040,c02,cr*6
  1447.     dc.w end_patt
  1448.  
  1449. v2chords
  1450.     dc.w eb02,cr,bb02,cr,eb03,cr
  1451.     dc.w eb02,cr,bb02,cr,eb03,cr
  1452.     dc.w bb01,cr,f02,cr,bb02,cr
  1453.     dc.w bb01,cr,f02,cr,bb02,cr
  1454.     dc.w c02,cr,g02,cr,c03,cr
  1455.     dc.w c02,cr,g02,cr,c03,cr
  1456.     dc.w g01,cr,d02,cr,g02,cr
  1457.     dc.w g01,cr,d02,cr,g02,cr
  1458.  
  1459.  
  1460.     dc.w eb02,cr,bb02,cr,eb03,cr
  1461.     dc.w g01,cr,d02,cr,g02,cr
  1462.     dc.w d01,cr,a02,cr,d02,cr
  1463.     dc.w d01,cr,a02,cr,d02,cr
  1464.  
  1465.     dc.w c02,cr,g02,cr,c03,cr
  1466.  
  1467.     dc.w g01,cr,d02,cr,g02,cr,g01,cr
  1468.     dc.w c02,cr,g02,cr,c03,cr
  1469.     dc.w c02,cr,g02,cr,c03,cr
  1470.     dc.w end_patt
  1471.  
  1472. v2tamb
  1473.  
  1474.     dc.w    rest,cr*16*3+cr
  1475.     dc.w    rest,cr,130,q,130,q,130,cr
  1476.     dc.w    rest,cr,130,q,130,q,130,cr
  1477.     dc.w    rest,cr,130,q,130,q,130,cr
  1478.     dc.w    rest,cr,130,q,130,q,130,cr
  1479.     dc.w    rest,cr,130,q,130,q,130,cr
  1480.     dc.w    rest,cr,130,q,130,q,130,cr
  1481.     dc.w    rest,cr,130,q,130,q,130,cr
  1482.     dc.w    rest,cr,130,q,130,q,130,cr
  1483.     dc.w    rest,cr,130,q,130,q,130,cr
  1484.     dc.w    rest,cr,130,q,130,q,130,cr
  1485.     dc.w    rest,cr,130,q,130,q,130,cr
  1486.     dc.w    rest,cr,130,q,130,q,130,cr
  1487.     dc.w    rest,cr,130,q,130,q,130,cr
  1488.     dc.w    rest,cr,130,q,130,q,130,cr,130,cr
  1489.     dc.w    rest,cr,130,q,130,q,130,cr
  1490.     dc.w    rest,cr,130,q,130,q,130,cr
  1491.     dc.w end_patt
  1492.  
  1493. ;-------------------
  1494. cr  set   32
  1495. q set  cr/2
  1496. sq set q/2
  1497. dsq set sq/4
  1498.  
  1499. tcr1    set 16
  1500. tq1 set      8
  1501. tq2 set   8
  1502. tsq1 set 5
  1503. tsq2 set 6
  1504.  
  1505.  
  1506. s1_castle:
  1507.     dc.l    trumpet_snd
  1508.     dc.l    ctune1
  1509.     dc.l    flute_snd
  1510.     dc.l    ctune2
  1511.     dc.l    flute_snd
  1512.     dc.l    ctune2
  1513.  
  1514.     dc.l    pr,pr
  1515.  
  1516.  
  1517.     dc.l    aguitar_snd
  1518.     dc.l    ctune2
  1519.       dc.l     0,end_song
  1520.  
  1521. s2_castle:
  1522.  
  1523.     dc.l    csnare
  1524.     dc.l    csnare
  1525.     dc.l    csnare
  1526.     dc.l    cs1
  1527.     dc.l    tamb_snd
  1528.     dc.l    ctamb
  1529.     dc.l    ctamb
  1530.     dc.l    ctamb
  1531.     dc.l    ctamb
  1532.  
  1533.     dc.l    snare_snd
  1534.     dc.l    cs1
  1535.  
  1536.     dc.l    tamb_snd
  1537.  
  1538.     dc.l    ctamb
  1539.     dc.l    ctamb
  1540.  
  1541.         dc.l    0,end_song
  1542.  
  1543.  
  1544. s3_castle:
  1545.  
  1546.  
  1547.     dc.l    trumpet_snd
  1548.     dc.l    ctune1h1
  1549.  
  1550.     dc.l    flute_snd
  1551.     dc.l    ctune2d
  1552.     dc.l    flute_snd
  1553.     dc.l    ctune2d
  1554.  
  1555.     dc.l    pr,pr
  1556.  
  1557.     dc.l    flute_snd
  1558.     dc.l    ctune2d
  1559.  
  1560.  
  1561.     dc.l     0,end_song
  1562.  
  1563.  
  1564. s4_castle:
  1565.  
  1566.  
  1567.     dc.l    csnared
  1568.     dc.l    csnared
  1569.     dc.l    csnared
  1570.     dc.l    cs1d
  1571.  
  1572.     dc.l    aguitar_sndq
  1573.     dc.l    cflute_acc
  1574.     dc.l    aguitar_sndq
  1575.     dc.l    cflute_acc
  1576.  
  1577.     dc.l    snare_snd
  1578.     dc.l    cs1d
  1579.     dc.l    pr,pr,pr,pr,pr,pr,pr,pr
  1580.     dc.l     0,end_song
  1581.  
  1582.  
  1583. cp:
  1584.  
  1585. ctune1:
  1586.     ;dc.w d03,$0008
  1587.     dc.w modon,1,1,2,2,6,6
  1588.     dc.w g03,$0038,d03,$0004,g03,$0004,d03,cr*6,rest,440-cr*6
  1589.     dc.w d03,$0004,f03,$0038,d03,$0004,f03,$0008,d03,cr*6,rest,$01a0-sq-cr*6
  1590.     dc.w d03,$0024,eb03,$005c,f03,$0010,eb03,$0010,d03,$0020
  1591.     dc.w bb02,$0020,f02,$0020,bb02,$0020,g02,cr*8
  1592.  
  1593.     dc.w    rest,cr*8
  1594.     dc.w end_patt
  1595.  
  1596.  
  1597. ctune2:
  1598.     dc.w modon,1,1,2,2,6,6
  1599.  
  1600.     dc.w g02,$0038,d02,$0004,g02,$0004,d02,cr*6-4
  1601.     dc.w d02,$0004,f02,$0038,d02,$0004,f02,$0008,d02,cr*5-12
  1602.     dc.w d02,$0024,eb02,$005c,f02,$0010,eb02,$0010,d02,$0020
  1603.     dc.w bb01,$0020,f01,$0020,bb01,$0020,g01,cr*8+4
  1604.     dc.w end_patt
  1605.  
  1606. cflute_acc
  1607.     dc.w modon,1,1,1,1,6,6
  1608.     dc.w    g01,q,bb01,q,d02,q,g02,q,d02,q,bb02,q,d02,q,g02,q    
  1609.     dc.w    g01,q,bb01,q,d02,q,g02,q,d02,q,bb02,q,d02,q,g02,q    
  1610.     dc.w    f01,q,a01,q,c02,q,f02,q,g02,q,bb01,q,d02,q,g02,q    
  1611.     dc.w    g01,q,bb01,q,d02,q,g02,q,d02,q,bb02,q,d02,q,g02,q    
  1612.     dc.w    eb01,q,g01,q,bb01,q,eb02,q,bb01,q,g01,q,bb01,q,eb02,q    
  1613.     dc.w    bb01,q,d02,q,f02,q,bb02,q,f02,q,d02,q,f02,q,bb02,q    
  1614.     dc.w    g01,q,b01,q,d02,q,g02,q,d02,q,b02,q,d02,q,g02,q    
  1615.     dc.w    g01,q,b01,q,d02,q,g02,q,d02,q,b02,q,d02,q,g02,q    
  1616.  
  1617.     dc.w end_patt
  1618.  
  1619.  
  1620. ctune1h1
  1621.  
  1622.     dc.w g02,$0038,d02,$0004,g02,$0004,d02,cr*6,rest,440-cr*6
  1623.     dc.w d02,$0004,f02,$0038,d02,$0004,f02,$0008,d02,cr*6,rest,$01a0-sq-cr*6
  1624.     dc.w d02,$0024,eb02,$005c,f02,$0010,eb02,$0010,d02,$0020
  1625.     dc.w bb01,$0020,f01,$0020,bb01,$0020,g01,cr*8
  1626.     dc.w    rest,cr*8
  1627.     dc.w end_patt
  1628.  
  1629.  
  1630. ctune2d:
  1631.     dc.w modon,1,1,2,2,6,6
  1632.     dc.w rest,4,g02,$0038,d02,$0004,g02,$0004,d02,cr*6-4
  1633.     dc.w d02,$0004,f02,$0038,d02,$0004,f02,$0008,d02,cr*5-12
  1634.     dc.w d02,$0024,eb02,$005c,f02,$0010,eb02,$0010,d02,$0020
  1635.     dc.w bb01,$0020,f01,$0020,bb01,$0020,g01,cr*8
  1636.  
  1637.     dc.w end_patt
  1638.  
  1639.  
  1640. csnare:
  1641.     dc.w    new_env
  1642.     dc.l    snare_env
  1643.     dc.w    new_snd
  1644.     dc.l    snarep
  1645.  
  1646.     dc.w    r16,cr+q,r16,tsq1,r16,tsq1,r16,tsq1,r16,q,r16,cr+q
  1647.     dc.w    r16,cr+q,r16,tsq1,r16,tsq1,r16,tsq1,r16,q,r16,cr+q
  1648. cs1    dc.w    r16,cr+q,r16,tsq1,r16,tsq1,r16,tsq1,r16,q,r16,cr+q
  1649.     dc.w    r16,cr+q,r16,tsq1,r16,tsq1,r16,tsq1,r16,q,r16,cr+q
  1650.     dc.w end_patt
  1651.  
  1652. csnared:
  1653.     dc.w    new_env
  1654.     dc.l    snare_envq
  1655.     dc.w    new_snd
  1656.     dc.l    snarep
  1657.     dc.w modon,1,1,8,8,1,1
  1658.  
  1659.     dc.w    rest,2,r16,cr+q,r16,tsq1,r16,tsq1,r16,tsq1,r16,q,r16,cr+q
  1660.     dc.w    r16,cr+q,r16,tsq1,r16,tsq1,r16,tsq1,r16,q,r16,cr+q-2
  1661. cs1d    dc.w    rest,3,r16,cr+q,r16,tsq1,r16,tsq1,r16,tsq1,r16,q,r16,cr+q
  1662.     dc.w    r16,cr+q,r16,tsq1,r16,tsq1,r16,tsq1,r16,q,r16,cr+q-3
  1663.     dc.w end_patt
  1664.  
  1665. ctamb
  1666.     dc.w    130,cr+q,130,q,130,cr*2
  1667.     dc.w    130,cr+q,130,q,130,cr*2
  1668.     dc.w    130,cr+q,130,q,130,cr*2
  1669.     dc.w    130,cr+q,130,q,130,cr*2
  1670.     dc.w end_patt
  1671.  
  1672.  
  1673.  
  1674.  
  1675. ;--------------------
  1676.  
  1677. sounds:
  1678.  
  1679. flute_snd:
  1680.     dc.w    new_env
  1681.     dc.l    flute_env
  1682.     dc.w    new_snd
  1683.     dc.l    flutep
  1684.     dc.w     end_patt
  1685.  
  1686. flute_sndq:
  1687.     dc.w    new_env
  1688.     dc.l    flute_envq
  1689.     dc.w    new_snd
  1690.     dc.l    flutep
  1691.     dc.w     end_patt
  1692.  
  1693. aguitar_snd:
  1694.     dc.w    new_env
  1695.     dc.l    aguitar_env
  1696.     dc.w    new_snd
  1697.     dc.l    aguitp
  1698.     dc.w     end_patt
  1699.  
  1700. aguitar_sndq:
  1701. aguitar_snd_quiet:
  1702.     dc.w    new_env
  1703.     dc.l    aguitar_env_quiet
  1704.     dc.w    new_snd
  1705.     dc.l    aguitp
  1706.     dc.w     end_patt
  1707.  
  1708.  
  1709. tamb_snd:
  1710.     dc.w    new_env
  1711.     dc.l    tamb_env
  1712.     dc.w    new_snd
  1713.     dc.l    tambp
  1714.     dc.w     end_patt
  1715.  
  1716.  
  1717.  
  1718. abass_snd:
  1719.     dc.w    new_env
  1720.     dc.l    abass_env
  1721.     dc.w    new_snd
  1722.     dc.l    abassp
  1723.     dc.w     end_patt
  1724.  
  1725. sitar_snd:
  1726.     dc.w    new_env
  1727.     dc.l    sitar_env
  1728.     dc.w    new_snd
  1729.     dc.l    sitarp
  1730.     dc.w     end_patt
  1731.  
  1732. snare_snd:
  1733.     dc.w    new_env
  1734.     dc.l    snare_env
  1735.     dc.w    new_snd
  1736.     dc.l    snarep
  1737.     dc.w     end_patt
  1738.  
  1739. snare_sndq:
  1740.     dc.w    new_env
  1741.     dc.l    snare_envq
  1742.     dc.w    new_snd
  1743.     dc.l    snarep
  1744.     dc.w     end_patt
  1745.  
  1746. trumpet_snd:
  1747.     dc.w    new_env
  1748.     dc.l    trumpet_env
  1749.     dc.w    new_snd
  1750.     dc.l    trumpetp
  1751.     dc.w     end_patt
  1752.  
  1753. trumpet_sndq:
  1754.     dc.w    new_env
  1755.     dc.l    trumpet_envq
  1756.     dc.w    new_snd
  1757.     dc.l    trumpetp
  1758.     dc.w     end_patt
  1759.  
  1760.  
  1761.  
  1762. ;***********************************************
  1763.  
  1764. parameters:
  1765.  
  1766. iff    equ 108
  1767.  
  1768.     ; sample parameters
  1769.  
  1770.  
  1771. snarep
  1772.         dc.w 1  
  1773.              dc.l snared
  1774.              dc.w 2240/2  
  1775.              dc.l restd
  1776.              dc.w 16/2
  1777.  
  1778.  
  1779. trumpetp
  1780.         dc.w 1  
  1781.              dc.l synbras1d
  1782.              dc.w 3338/2  
  1783.              dc.l synbras1d
  1784.              dc.w 3338/2  
  1785.  
  1786. abassp
  1787.         dc.w 1  
  1788.              dc.l abassd+iff
  1789.              dc.w 8000/2 
  1790.              dc.l restd
  1791.              dc.w 16/2
  1792.  
  1793. flutep
  1794.         dc.w 1  
  1795.              dc.l fluted+iff
  1796.              dc.w 7278/2
  1797.              dc.l fluted+4173+iff
  1798.              dc.w 3106/2
  1799.  
  1800. tambp
  1801.         dc.w 1  
  1802.              dc.l tambd
  1803.              dc.w 1457/2 
  1804.              dc.l restd
  1805.              dc.w 16/2
  1806.  
  1807. sitarp
  1808.         dc.w 1  
  1809.              dc.l sitard
  1810.              dc.w 7708/2 
  1811.              dc.l restd
  1812.              dc.w 16/2
  1813.  
  1814. aguitp
  1815.         dc.w 1  
  1816.              dc.l aguitd+iff
  1817.              dc.w 9576/2 
  1818.              dc.l restd
  1819.              dc.w 16/2
  1820.  
  1821.  
  1822. envelopes:
  1823.  
  1824.  
  1825. rest_env:            dc.w 0,0,0,0,0,0,0,0,255
  1826. flute_env:            dc.w 0,48,255
  1827. flute_envq:            dc.w 0,28,255
  1828. tamb_env:            dc.w 0,62,255
  1829. aguitar_env:            dc.w 0,45,255
  1830. aguitar_env_quiet:        dc.w 0,30,255
  1831. sitar_env:            dc.w 0,42,255
  1832. abass_env:            dc.w 0,54,255
  1833. snare_env:            dc.w 0,35,255
  1834. snare_envq:            dc.w 0,25,255
  1835. trumpet_env:            dc.w 0,35,255
  1836. trumpet_envq:            dc.w 0,25,255
  1837.  
  1838.  
  1839.  
  1840.  
  1841. ;guit.sam                    6191 rwed Today     01:27:11
  1842. ;tamb.sam                    1457 rwed Today     01:27:10
  1843. ;flute.sam                   8410 rwed Today     01:27:08
  1844. ;sitar.sam                   8993 rwed Today     01:27:07
  1845. ;bass.sam                    8583 rwed Today     01:27:05
  1846. ;7 files - 207 blocks used
  1847.  
  1848. ;**************************************************
  1849.  
  1850.  
  1851. aguitd            incbin c:instruments/aguit.sam 
  1852. tambd            incbin c:instruments/tamb.sam 
  1853. fluted            incbin c:instruments/flute.sam 
  1854. sitard            incbin c:instruments/sitar.sam 
  1855. abassd            incbin c:instruments/abass.sam 
  1856. snared            incbin c:instruments/snare.sam 
  1857. synbras1d        incbin c:instruments/hbrass3l.sam 
  1858.  
  1859.  
  1860. ;********************************************
  1861.  
  1862. ;;THE FX SAMPLES ARE PULLED IN HERE...THis section can be anywhere
  1863. ;; in lower memory,and in any order
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870. ;***********************
  1871.  
  1872. restd:
  1873. rest_data:
  1874.              dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1875.              dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1876.              dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1877.              dc.w 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1878. sined:
  1879. sine_datad:
  1880.              dc.w 127,80,50,25,0,-25,-50,-100,-127
  1881.              dc.w -127,-100,-50,-35,0,35,50,80,127
  1882.  
  1883.  
  1884. ;*************************************************
  1885.  
  1886.     end
  1887.  
  1888.  
  1889.  
  1890.  
  1891.     dc.w modon,1,1,8,8,6,6
  1892.     dc.w pbend,down,1,60000,32
  1893.  
  1894.