home *** CD-ROM | disk | FTP | other *** search
/ Dave Lowe: Kings Quest Backup 2 / Lowe_KingsQuestBackup2.adf / castle_beauty / kq6cb.s < prev   
Encoding:
Text File  |  1978-04-17  |  33.1 KB  |  2,100 lines

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