home *** CD-ROM | disk | FTP | other *** search
/ Dave Lowe: Amiga KQ 6 Levels Data / Lowe_AmigaKQ6LevelsData.adf / isle_of_mists / kq6iom.s < prev   
Encoding:
Text File  |  2000-01-01  |  14.3 KB  |  863 lines

  1.  
  2.  
  3.  
  4.  
  5.     ;    DRIVER AND MUSIC REMAIN COPYRIGHT D.LOWE 
  6.  
  7.     ;       KINGS QUEST VI..Island Of MISTS
  8.     ;    see song_table and fx_table for music/fx lists
  9.  
  10.  
  11.  
  12.  
  13.     ;    JEREMY
  14.     ;    devpac source code file... no macros.
  15.     ;       Its commented wherever needed
  16.     ;    The samples are incbin at the end,you will
  17.     ;    need to change the directory to your own.
  18.     ;    This source files contains a devpac pseudo op
  19.     ;    called set. it allows redefining of values
  20.     ;    you may need to change this to something else if
  21.     ;    using a different assembler.
  22.  
  23.     ;    It must be assembled with SYMBOLS CASE independent.
  24.  
  25.     ;       dont hesitate to ring with any problems
  26.  
  27.  
  28.  
  29.     ;        DAVE LOWE.....0723  870648
  30.  
  31.  
  32.  
  33. ;        **************************
  34.  
  35.     section issA,code_c    ;must be in low memory for dma access
  36.                 ;DEVPAC PSEUDO OP ..CAN BE DELETED
  37.  
  38.  
  39. ;*****************************************
  40.  
  41.  
  42. select_tunes    equ 1        ;for conditional assembly whilst testing
  43.                 ; zero to step tunes on mouse button
  44.                 ; can be deleted..not essential
  45.  
  46.         ;  ALL EQUs
  47.  
  48. a00  equ  508*2
  49. bb00  equ  480*2
  50. b00  equ  453*2
  51.  
  52. c01  equ  428*2
  53. db01  equ  404*2
  54. d01 equ  381*2
  55. eb01  equ  360*2
  56. e01  equ  339*2
  57. f01  equ  320*2
  58. gb01  equ  302*2
  59. g01  equ  285*2
  60. ab01 equ 269*2
  61. a01  equ  508
  62. bb01  equ  480
  63. b01  equ  453
  64.  
  65. c02  equ  428
  66. db02  equ  404
  67. d02  equ  381
  68. eb02  equ  360
  69. e02  equ  339
  70. f02  equ  320
  71. gb02  equ  302
  72. g02  equ  285
  73. ab02 equ 269
  74. a02  equ  254
  75. bb02  equ  240
  76. b02  equ  226
  77.  
  78. c03  equ  214
  79. db03  equ  202
  80. d03  equ  190
  81. eb03  equ  180
  82. e03  equ  170
  83. f03  equ  160
  84. gb03  equ  151
  85. g03  equ  143
  86. ab03 equ 135
  87. a03  equ  127
  88.  
  89. bb03  equ  480*2
  90. b03  equ  453*2
  91.  
  92. c04  equ  428*2
  93. db04  equ  404*2
  94. d04 equ  381*2
  95. eb04  equ  360*2
  96. e04  equ  339*2
  97. f04  equ  320*2
  98. gb04  equ  302*2
  99. g04  equ  285*2
  100. ab04 equ 269*2
  101. a04  equ  508
  102. bb04  equ  480
  103. b04  equ  453
  104.  
  105. c05  equ  428
  106. db05  equ  404
  107. d05  equ  381
  108. eb05  equ  360
  109. e05  equ  339
  110. f05  equ  320
  111. gb05  equ  302
  112. g05  equ  285
  113. ab05 equ 269
  114. a05  equ  254
  115. bb05  equ  240
  116. b05  equ  226
  117.  
  118. c06  equ  214
  119. db06  equ  202
  120. d06  equ  190
  121. eb06  equ  180
  122. e06  equ  170
  123. f06  equ  160
  124. gb06  equ  151
  125. g06  equ  143
  126. ab06 equ 135
  127. a06  equ  127
  128. bb06  equ  480*2
  129. b06  equ  453*2
  130.  
  131. c07  equ  428*2
  132. db07  equ  404*2
  133. d07 equ  381*2
  134. eb07  equ  360*2
  135. e07  equ  339*2
  136. f07  equ  320*2
  137. gb07  equ  302*2
  138. g07  equ  285*2
  139. ab07 equ 269*2
  140. a07  equ  508
  141. bb07  equ  480
  142. b07  equ  453
  143.  
  144. c08  equ  428
  145. db08  equ  404
  146. d08  equ  381
  147. eb08  equ  360
  148. e08  equ  339
  149. f08  equ  320
  150. gb08  equ  302
  151. g08  equ  285
  152. ab08 equ 269
  153. a08  equ  254
  154. bb08  equ  240
  155. b08  equ  226
  156.  
  157.  
  158. v equ 0
  159.  
  160. no_loop equ 0
  161. loop equ 0
  162. chann1reg   equ $dff0a0    
  163. chann2reg   equ $dff0b0
  164. chann3reg   equ $dff0c0
  165. chann4reg   equ $dff0d0
  166. dmacon     equ $dff096
  167. int_bf_int   equ   $dff01e
  168. int_bf_w    equ   $dff09a
  169. vhposr     equ   $dff006
  170. in_line    equ   0
  171. new_snd    equ   4
  172. end_song     equ   1
  173. end_patt    equ   8
  174. new_env    equ   12
  175. pbend     equ   16
  176.  
  177.  
  178.  
  179. hi: equ 223
  180. lo:  equ 446
  181.  
  182. r22    equ 134
  183. r20    equ 179        ;correctum
  184. r19    equ 150
  185. r18    equ 178
  186. r17    equ 200
  187. r16:    equ 227        ;correctum
  188. r15:    equ 249
  189. r14    equ 280
  190. r13:    equ 305
  191. r12:    equ 333
  192. r11:    equ 361
  193. r10:    equ 389
  194. r9:    equ 419
  195. r8:    equ 446
  196. r7:    equ 446+112
  197. r6:    equ 446+223
  198. r5:    equ 446+223+112
  199. r4:    equ 446*2
  200. r3:    equ 446*3
  201. r2:    equ 446*4
  202. r1:    equ 446*8
  203.  
  204.  
  205. filter: equ $bfe001
  206. filter_on equ 44
  207. filter_off equ 48
  208.  
  209. modon     equ   20
  210. pboff     equ   24
  211. modoff     equ   28
  212. rest     equ 32
  213. end_fxp  equ 36
  214. end_fx3  equ 36
  215. end_fx4  equ 40
  216. acc    equ 52
  217. repeat    equ 56
  218. down      equ   1
  219. up       equ   2
  220.  
  221. fx    equ 0
  222.  
  223.  
  224.  
  225. ;**************************************************************************
  226. ;**************************************************************************
  227.  
  228.  
  229.  ;    THIS IS THE CONTROL SECTION FOR TESTING AS A STAND ALONE PRG. 
  230.  
  231.     ;       AND CAN BE DELETED WHEN NOT REQUIRED
  232.  
  233.     move.l    #1,song_buffer
  234.     jsr select_new_song    ;set up tune..numnber 1
  235.  
  236. testloop:
  237.     jsr delay    ;wait for scan line  at 50hz on pal
  238.  
  239.     jsr driver    ;run driver at 50 hz for testing
  240.  
  241.         bra testloop    ;loop back
  242.  
  243.  
  244. ;--------
  245.  
  246.         ;these are all routines used during test/stand alone
  247.         ;        assembly
  248.  
  249. delay:
  250.     tst.w fxtimer
  251.     bne no_test
  252.     clr.l d0
  253.     move.b $bfe001,d0
  254.     btst #6,d0
  255.     bne no_test1
  256.     move.w #10,fxtimer
  257.     bra testfx4
  258. no_test
  259.     subq #1,fxtimer
  260. no_test1
  261.     clr.l d0
  262.         move.w vhposr,d0
  263.         andi.w #%1111111100000000,d0
  264.         cmpi.w #%1111111100000000,d0
  265.  
  266.     bne no_test1
  267.     rts
  268.  
  269. testfx4:  
  270.  
  271.     clr.l d0
  272.     move.b $bfe001,d0
  273.     btst #6,d0
  274.     beq testfx4
  275.  
  276.     move.l song_buffer,d0
  277.     addq.l #1,d0
  278.     cmp.l    max_songs,d0
  279.     bne nores
  280.     move.l #1,d0
  281. nores    move.l d0,song_buffer
  282.  
  283.  
  284.     ifeq    select_tunes
  285.  
  286.     jsr    select_new_song        ;new song on mouse button
  287.  
  288.  
  289.     endc
  290.  
  291.     move.l fx_last,d0
  292.     move.l d0,fx_kill
  293.  
  294.     jsr kill_loopfx            ;use only one fx at a time
  295.                     ;for testing
  296.  
  297. no_k
  298.         move.l fx_no,fx_number
  299.     move.l fx_no,fx_last
  300.     addq.l #1,fx_no
  301.     move.l    max_fx,d0
  302.         cmp.l fx_no,d0
  303.     bne noreset
  304.     move.l #1,fx_no    
  305. noreset: 
  306.  
  307.  
  308.     ifne    select_tunes
  309.  
  310.     jsr set_up_fx
  311.  
  312.     endc
  313.  
  314.     bra no_test    
  315.  
  316. fxtc:          dc.w 10
  317. fx_no:         dc.l  1
  318. fx_last        dc.l  0
  319.  
  320.  
  321. ;        END OF CONTROL (DELETABLE) SECTION
  322.  
  323. ;********************************************************************
  324. ;********************************************************************
  325.  
  326. ;    MAIN VARIABLES TO BE ACCESSED BY PROGRAMMER DURING RUNTIME
  327.  
  328.  
  329. fx_number:     dc.l 0 ;     number of fx required here
  330.  
  331.  
  332. fx_kill        dc.l 0 ;     number of fx to kill/used mainly
  333.                ;     to kill looping fx
  334.  
  335.  
  336. song_buffer     dc.l 1 ;     number of piece of music required here ie.1 to ?               ;     currently playing beach background..see list
  337.  
  338. music_disable:  dc.w 1 ;     1 = disable music
  339.  
  340. fx_disable:     dc.w 0 ;     1 = disable fx
  341.  
  342.  
  343. fade:        dc.w 0 ;      0 to 64..0 = full volume/64 = off
  344.  
  345.  
  346. ;    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  347.  
  348. ;  THESE VARIABLES ARE USED INTERNALLY BY THE DRIVER
  349. fxr1         dc.l 0  
  350. fxr2         dc.l 0  
  351. fxr3         dc.l 0  
  352. fxr4         dc.l 0  
  353. fxc1        dc.l 0
  354. fxc2          dc.l 0
  355. fxc3        dc.l 0
  356. fxc4          dc.l 0
  357. fx1_flag    dc.w 0
  358. fx2_flag    dc.w 0
  359. fx3_flag    dc.w 0
  360. fx4_flag    dc.w 0
  361. fxtimer        dc.w 0
  362. gen        dc.w 0
  363. int_disable    dc.w 0
  364. altpf         dc.w 0
  365. kill_flag    dc.w 0
  366. ;  *******************************************************
  367.  
  368. ;  CALL THIS SUBROUTINE TO SET UP THE REQIURED FX
  369. ;  on entry it requires the fx number to be in "fx_number"(see above)
  370.  
  371.  
  372. set_up_fx
  373.     movem.l d5/a2,-(a7)    ;save used registers
  374.  
  375.     tst.l fxc4
  376.     bne check3
  377. use4:    
  378.     move.w #%0000000000001000,d5
  379.     lea chann4reg,a2
  380.     jsr end_fx4p
  381.     move.l fx_number,fxr4
  382.     move.l fx_number,fxc4
  383.     move.l #0,fx_number
  384.     bra no_fx
  385. check3:    tst.l fxc3
  386.     bne check2
  387. use3:
  388.     move.w #%0000000000000100,d5
  389.     lea chann3reg,a2
  390.     jsr end_fx3p
  391.     move.l fx_number,fxr3
  392.     move.l fx_number,fxc3
  393.     move.l #0,fx_number
  394.     bra no_fx
  395. check2:    tst.l fxc2
  396.     bne check1
  397. use2:
  398.     move.w #%0000000000000010,d5
  399.     lea chann2reg,a2
  400.     jsr end_fx2p
  401.     move.l fx_number,fxr2
  402.     move.l fx_number,fxc2
  403.     move.l #0,fx_number
  404.     bra no_fx
  405. check1:    tst.l fxc1
  406.     bne use3
  407. use1:
  408.     move.w #%0000000000000001,d5
  409.     lea chann1reg,a2
  410.     jsr end_fx1p
  411.     move.l fx_number,fxr1
  412.     move.l fx_number,fxc1
  413.     move.l #0,fx_number
  414. no_fx
  415.     movem.l (a7)+,d5/a2    ;restore registers
  416.     rts
  417.  
  418. ;*************************************************
  419. ;          CALL HERE TO KILL ANY FX...
  420. ;       after putting the number of the fx you want to kill
  421. ;            into fx_kill
  422.  
  423. kill_loopfx
  424.  
  425.     movem.l d5/a2,-(a7)    ;save used registers
  426.     move.l fx_kill,d5
  427.     cmp.l fxc1,d5
  428.     bne k2
  429.     move.w #%0000000000000001,d5
  430.     lea chann1reg,a2
  431.     jsr end_fx1p
  432.     bra error
  433. k2    cmp.l fxc2,d5
  434.     bne k3
  435.     move.w #%0000000000000010,d5
  436.     lea chann2reg,a2
  437.     jsr end_fx2p
  438.     bra error
  439. k3    cmp.l fxc3,d5
  440.     bne k4
  441.     move.w #%0000000000000100,d5
  442.     lea chann3reg,a2
  443.     jsr end_fx3p
  444.     bra error
  445. k4    cmp.l fxc4,d5
  446.     bne error
  447.     move.w #%0000000000001000,d5
  448.     lea chann2reg,a2
  449.     jsr end_fx4p
  450. error
  451.     clr.l fx_kill
  452.     movem.l (a7)+,d5/a2    ;restore registers
  453.     rts
  454. ;*************************************************
  455.  
  456.     ; CALL HERE TO KILL ANY SOUNDS LEFT ON CHIP
  457.  
  458. kill_chip:
  459.     move.w #%0000000000001111,dmacon
  460.     move.l rest_data,chann1reg
  461.     move.l rest_data,chann2reg
  462.     move.l rest_data,chann3reg
  463.     move.l rest_data,chann4reg
  464.     move.w #16,chann1reg+4    
  465.     move.w #16,chann2reg+4    
  466.     move.w #16,chann3reg+4    
  467.     move.w #16,chann4reg+4    
  468.     move.w #0,chann1reg+8
  469.     move.w #0,chann2reg+8
  470.     move.w #0,chann3reg+8
  471.     move.w #0,chann4reg+8
  472.     move.w #1,chann1reg+6
  473.     move.w #1,chann2reg+6
  474.     move.w #1,chann3reg+6
  475.     move.w #1,chann4reg+6
  476.     move.l #0,fxr1
  477.     move.l #0,fxr2
  478.     move.l #0,fxr3
  479.     move.l #0,fxr4
  480.     move.w #0,fx1_flag
  481.     move.w #0,fx2_flag
  482.     move.w #0,fx3_flag
  483.     move.w #0,fx4_flag
  484.     move.l #0,fxc1
  485.     move.l #0,fxc2
  486.     move.l #0,fxc3
  487.     move.l #0,fxc4
  488.     rts
  489. ;****************************************
  490.  
  491. ;  CALL HERE TO SELECT WHICH PIECE OF MUSIC TO PLAY
  492. ;  AFTER PLACING NUMBER (1 to ?) IN "SONG_BUFFER"..see above
  493. ;  a call to this routine will initiliase the driver/kill any sound etc.      
  494. ;  make sure this routine has been called before running the interrupt
  495. ;  driven section....see below
  496.  
  497. select_new_song:
  498.  
  499.     move.w #1,int_disable
  500.     movem.l d0/d1/a0/a1,-(a7)    ;save used registers
  501.     move.w music_disable,gen
  502.     move.w #1,music_disable
  503.         jsr kill_chip           
  504.     clr.l d0
  505.         move.w #204,d0
  506.         lea gvars,a0
  507. clloop: clr.w (a0)+        
  508.         dbra  d0,clloop
  509.     tst.l song_buffer
  510.     beq no_song
  511.         move.l song_buffer,d1
  512.     add.l d1,d1
  513.      add.l d1,d1
  514.      add.l d1,d1
  515.      add.l d1,d1
  516.         LEA  SONG_TABLE-16,A1
  517.  
  518.         add.l d1,a1      
  519.         MOVE.L (A1)+,WSONG1    
  520.         move.l (a1)+,wsong2    
  521.         move.l (a1)+,wsong3
  522.     move.l (a1),wsong4
  523.         MOVE.L #pstart,PATTR1
  524.         MOVE.L #pstart,PATTR2
  525.         MOVE.L #pstart,PATTR3
  526.     move.l #pstart,pattr4
  527.         move.l #sstart,songr1
  528.         MOVE.L #sstart,SONGR2
  529.         MOVE.L #sstart,SONGR3
  530.     move.l #sstart,songr4
  531. no_song
  532.     move.w #1,ch1vars
  533.     move.w #2,ch2vars
  534.     move.w #3,ch3vars
  535.     move.w #4,ch4vars
  536.     move.w #6,ch4fxvars
  537.     move.w #5,ch3fxvars
  538.     move.w #7,ch2fxvars
  539.     move.w #8,ch1fxvars
  540.     move.w gen,music_disable
  541.     clr.w int_disable
  542.     movem.l (a7)+,d0/d1/a0/a1    ;restore registers
  543.         rts
  544.  
  545. ;**************************************************
  546.  
  547.         ;This is the interrupt routine
  548.  
  549.  
  550. ;  CALL HERE ON A 50hz INTERRUPT DURING RUNTIME
  551. ;  TO PLAY FX AND TUNES
  552.  
  553. driver:  
  554.     tst.w int_disable
  555.     beq process_data
  556.     rts        
  557. process_data
  558.     movem.l d0-d6/a0-a6,-(a7)    ;save used registers
  559.  
  560.  
  561. ch1:
  562.     tst.w fx_disable
  563.     bne test_music1
  564.     tst.l fxr1
  565.     bne   ch1j1
  566.     tst.l fxc1
  567.     beq test_music1
  568.     bra ch1j3
  569. ch1j2    jsr run_dummy1
  570.     jsr run_fx1
  571.     bra ch2
  572. ch1j1
  573.     jsr set_up1
  574. ch1j3    tst.w music_disable    
  575.     beq ch1j2
  576.     jsr run_fx1
  577.     bra ch2
  578. test_music1
  579.     tst.w music_disable
  580.     bne ch2
  581.     jsr run_music1
  582.     bra ch2
  583.     ;***********************
  584.  
  585.     ; channel 1 subroutines
  586.  
  587. run_dummy1    
  588.      lea ch1vars,a0
  589.      lea dummy_reg,a2 
  590.      move.w #0,d5 
  591.      jsr sect1    
  592.     rts
  593.  
  594. set_up1    
  595.          move.l fxr1,d0
  596.          add d0,d0
  597.          add d0,d0
  598.          lea  fxjump_table-4,A1
  599.      add.l d0,a1
  600.          move.l (a1),currfx1
  601.       clr.l fxr1
  602.      clr.w fxintc1
  603.       rts
  604.   
  605.      
  606. run_fx1
  607.     lea ch1fxvars,a0
  608.        lea chann1reg,a2
  609.       move.w #%0000000000000001,d5 
  610.      move.w #%1000000000000001,d1 
  611.      jsr sect1
  612.     rts
  613.  
  614. run_music1
  615.     lea ch1vars,a0
  616.        lea chann1reg,a2
  617.       move.w #%0000000000000001,d5 
  618.       move.w #%1000000000000001,d1 
  619.       jsr sect1     
  620.     rts
  621.  
  622.     ;  **************************
  623. ch2
  624.     tst.w fx_disable
  625.     bne test_music2
  626.     tst.l fxr2
  627.     bne   ch2j1
  628.     tst.l fxc2
  629.     beq test_music2
  630.     bra ch2j3
  631. ch2j2    jsr run_dummy2
  632.     jsr run_fx2
  633.     bra ch3
  634. ch2j1
  635.     jsr set_up2
  636. ch2j3    tst.w music_disable    
  637.     beq ch2j2
  638.     jsr run_fx2
  639.     bra ch3
  640.  
  641. test_music2
  642.     tst.w music_disable
  643.     bne ch3
  644.     jsr run_music2
  645.     bra ch3
  646.     ;***********************
  647.     ; channel 2 subroutines
  648. run_dummy2    
  649.      lea ch2vars,a0
  650.      lea dummy_reg,a2 
  651.      move.w #0,d5 
  652.      jsr sect1    
  653.     rts
  654.  
  655. set_up2    
  656.          move.l fxr2,d0
  657.          add d0,d0
  658.          add d0,d0
  659.          lea  fxjump_table-4,A1
  660.      add.l d0,a1
  661.          move.l (a1),currfx2
  662.       clr.l fxr2
  663.      clr.w fxintc2
  664.       rts
  665.   
  666.      
  667. run_fx2
  668.     lea ch2fxvars,a0
  669.        lea chann2reg,a2
  670.       move.w #%0000000000000010,d5 
  671.      move.w #%1000000000000010,d1 
  672.      jsr sect1
  673.     rts
  674.  
  675. run_music2
  676.     lea ch2vars,a0
  677.        lea chann2reg,a2
  678.       move.w #%0000000000000010,d5 
  679.       move.w #%1000000000000010,d1 
  680.       jsr sect1     
  681.     rts
  682.  
  683.     ;  **************************
  684.  
  685. ch3:
  686.     tst.w fx_disable
  687.     bne test_music3
  688.     tst.l fxr3
  689.     bne   ch3j1
  690.     tst.l fxc3
  691.     beq test_music3
  692.     bra ch3j3
  693. ch3j2    jsr run_dummy3
  694.     jsr run_fx3
  695.     bra ch4
  696. ch3j1
  697.     jsr set_up3
  698. ch3j3    tst.w music_disable    
  699.     beq ch3j2
  700.     jsr run_fx3
  701.     bra ch4
  702.  
  703. test_music3
  704.     tst.w music_disable
  705.     bne ch4
  706.     jsr run_music3
  707.     bra ch4
  708.  
  709.     ;***********************
  710.  
  711.     ; channel 3 subroutines
  712.  
  713. run_dummy3    
  714.      lea ch3vars,a0
  715.      lea dummy_reg,a2 
  716.      move.w #0,d5 
  717.      jsr sect1    
  718.     rts
  719.  
  720. set_up3    
  721.          move.l fxr3,d0
  722.          add d0,d0
  723.          add d0,d0
  724.          lea  fxjump_table-4,A1
  725.      add.l d0,a1
  726.          move.l (a1),currfx3
  727.       clr.l fxr3
  728.      clr.w fxintc3
  729.       rts
  730.   
  731.      
  732. run_fx3
  733.     lea ch3fxvars,a0
  734.        lea chann3reg,a2
  735.       move.w #%0000000000000100,d5 
  736.      move.w #%1000000000000100,d1 
  737.      jsr sect1
  738.     rts
  739.  
  740. run_music3
  741.     lea ch3vars,a0
  742.        lea chann3reg,a2
  743.       move.w #%0000000000000100,d5 
  744.       move.w #%1000000000000100,d1 
  745.       jsr sect1     
  746.     rts
  747.  
  748.     ;  **************************
  749.  
  750. ch4:
  751.     tst.w fx_disable
  752.     bne test_music4
  753.     tst.l fxr4
  754.     bne   ch4j1
  755.     tst.l fxc4
  756.     beq test_music4
  757.     bra ch4j3
  758. ch4j2    jsr run_dummy4
  759.     jsr run_fx4
  760.     bra no4
  761. ch4j1
  762.     jsr set_up4
  763. ch4j3    tst.w music_disable    
  764.     beq ch4j2
  765.     jsr run_fx4
  766.     bra no4
  767.  
  768. test_music4
  769.     tst.w music_disable
  770.     bne no4
  771.     jsr run_music4
  772. no4    
  773.     movem.l (a7)+,d0-d6/a0-a6    ;restore registers
  774.     rts
  775.  
  776.     ;***********************
  777.  
  778.     ; channel 4 subroutines
  779.  
  780. run_dummy4    
  781.      lea ch4vars,a0
  782.      lea dummy_reg,a2 
  783.      move.w #0,d5 
  784.      jsr sect1    
  785.     rts
  786.  
  787. set_up4    
  788.          move.l fxr4,d0
  789.          add d0,d0
  790.          add d0,d0
  791.          lea  fxjump_table-4,A1
  792.      add.l d0,a1
  793.          move.l (a1),currfx4
  794.       clr.l fxr4
  795.      clr.w fxintc4
  796.       rts
  797.   
  798.      
  799. run_fx4
  800.     lea ch4fxvars,a0
  801.        lea chann4reg,a2
  802.       move.w #%0000000000001000,d5 
  803.      move.w #%1000001000001000,d1 
  804.      jsr sect1
  805.     rts
  806.  
  807. run_music4
  808.     lea ch4vars,a0
  809.        lea chann4reg,a2
  810.       move.w #%0000000000001000,d5 
  811.       move.w #%1000001000001000,d1 
  812.       jsr sect1     
  813.     rts
  814.     ;  **************************
  815.  
  816. sect1: tst.w (a0)
  817.     bne s1j1
  818.     rts
  819.  
  820. s1j1:    tst.w 2(a0)
  821.         beq sect3       
  822.         cmpi.w #1,2(a0)
  823.         beq sect4
  824.  
  825.         cmpi.w #3,4(a0)    
  826.         beq part2       
  827.     
  828. mode_switch:  subq.w #1,2(a0)     
  829.  
  830. check_effects: clr.w altpf      
  831.         move.w 6(a0),d2    
  832.         tst.w 8(a0)      
  833.         beq check_mod
  834.         tst.w 14(a0)      
  835.         beq cont_bend
  836.         subq.w #1,14(a0)
  837.         bra check_mod
  838. cont_bend:   addq.w #1,altpf    
  839.         move.w 10(a0),d3    
  840.         move.w 12(a0),d4    
  841.         cmpi.w #1,8(a0)
  842.         beq pbup
  843.     
  844.         sub.w d3,d2
  845.         cmp.w d2,d4
  846.         bcs check_mod
  847.         bra fbend
  848.  
  849. pbup:     add.w d3,d2
  850.         cmp.w d2,d4
  851.         bcc check_mod
  852. fbend:     move.w d4,d2
  853.         clr.w 8(a0)      
  854. check_mod:   tst.w 16(a0)
  855.         beq send_alt_pitch
  856.    
  857.  
  858.     tst.w  58(a0)
  859.     beq st_ok
  860.     subq.w #1,58(a0)
  861.     bra send_alt_pitch
  862. st_ok:
  863.