home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-01-01 | 38.1 KB | 2,447 lines |
-
-
-
-
-
- ; ELITEII/FRONTIERS TEST SOURCE
-
-
- ; DAVID
- ;The place to insert your call for a new song
- ; is called song_select
- ; all the tunes branch there on ending except
- ; The title tune now has a section tagged on the front
- ; that runs straight into the main piece....song 10
- ; it fades itself in
- ; and plays for app. 23 seconds......
-
- ; you can still run tune 2 on its own if you wish
- ; using song 2
- ; An fx that is retriggered before it ends a previous
- ; call is now only turned off in the interrupt section
- ; so it should cure the click problem on the lazers etc.
-
- ;the wind fx requires you to kill it using kill_fx
- ;and the duplicate one will now be out of sync.
-
-
-
- ;there is now a fade_up routine and a fade_out routine
- ;they require the fade rate (1 to 50)to be held in
- ;d0 when calling..(this is the number of frames before
- ;increasing or decreasing the value in FADE by #1)
-
-
- ; I am not sure if you want a small gap on the end of the
- ;tunes or to go straight into whatever is selected
- ;at present I have implemented it both ways on different
- ;tunes so you can try it and see.(its very easy to set
- ;up either way....(give me a call)
-
-
- ; the fxjump table now contains more fx and is fully
- ;labelled
-
-
- ; It must be assembled with SYMBOLS CASE independent.
-
- ; dont hesitate to ring with any problems
-
- ; DAVE LOWE.....0723 870648
-
- ; **************************
-
- section issA,code_c ;must be in low memory for dma access
- ;DEVPAC PSEUDO OP ..CAN BE DELETED
-
-
- ;*****************************************
-
- ; ALL EQUs
-
- a00 equ 508*2
- bb00 equ 480*2
- b00 equ 453*2
- c01 equ 428*2
- db01 equ 404*2
- d01 equ 381*2
- eb01 equ 360*2
- e01 equ 339*2
- f01 equ 320*2
- gb01 equ 302*2
- g01 equ 285*2
- ab01 equ 269*2
- a01 equ 508
- bb01 equ 480
- b01 equ 453
-
- c02 equ 428
- db02 equ 404
- d02 equ 381
- eb02 equ 360
- e02 equ 339
- f02 equ 320
- gb02 equ 302
- g02 equ 285
- ab02 equ 269
- a02 equ 254
- bb02 equ 240
- b02 equ 226
-
- c03 equ 214
- db03 equ 202
- d03 equ 190
- eb03 equ 180
- e03 equ 170
- f03 equ 160
- gb03 equ 151
- g03 equ 143
- ab03 equ 135
- a03 equ 127
-
- bb03 equ 480*2
- b03 equ 453*2
-
- c04 equ 428*2
- db04 equ 404*2
- d04 equ 381*2
- eb04 equ 360*2
- e04 equ 339*2
- f04 equ 320*2
- gb04 equ 302*2
- g04 equ 285*2
- ab04 equ 269*2
- a04 equ 508
- bb04 equ 480
- b04 equ 453
-
- c05 equ 428
- db05 equ 404
- d05 equ 381
- eb05 equ 360
- e05 equ 339
- f05 equ 320
- gb05 equ 302
- g05 equ 285
- ab05 equ 269
- a05 equ 254
- bb05 equ 240
- b05 equ 226
-
- c06 equ 214
- db06 equ 202
- d06 equ 190
- eb06 equ 180
- e06 equ 170
- f06 equ 160
- gb06 equ 151
- g06 equ 143
- ab06 equ 135
- a06 equ 127
- bb06 equ 480*2
- b06 equ 453*2
-
- c07 equ 428*2
- db07 equ 404*2
- d07 equ 381*2
- eb07 equ 360*2
- e07 equ 339*2
- f07 equ 320*2
- gb07 equ 302*2
- g07 equ 285*2
- ab07 equ 269*2
- a07 equ 508
- bb07 equ 480
- b07 equ 453
-
- c08 equ 428
- db08 equ 404
- d08 equ 381
- eb08 equ 360
- e08 equ 339
- f08 equ 320
- gb08 equ 302
- g08 equ 285
- ab08 equ 269
- a08 equ 254
- bb08 equ 240
- b08 equ 226
-
-
- v equ 0
-
- no_loop equ 0
- loop equ 0
- chann1reg equ $dff0a0
- chann2reg equ $dff0b0
- chann3reg equ $dff0c0
- chann4reg equ $dff0d0
- dmacon equ $dff096
- int_bf_int equ $dff01e
- int_bf_w equ $dff09a
- vhposr equ $dff006
- in_line equ 0
- new_snd equ 4
- end_song equ 1
- end_patt equ 8
- new_env equ 12
- pbend equ 16
-
-
-
- hi: equ 223
- lo: equ 446
-
- r22 equ 134
- r20 equ 179 ;correctum
- r19 equ 150
- r18 equ 178
- r17 equ 200
- r16: equ 227 ;correctum
- r15: equ 249
- r14 equ 280
- r13: equ 305
- r12: equ 333
- r11: equ 361
- r10: equ 389
- r9: equ 419
- r8: equ 446
- r7: equ 446+112
- r6: equ 446+223
- r5: equ 446+223+112
- r4: equ 446*2
- r3: equ 446*3
- r2: equ 446*4
- r1: equ 446*8
-
-
- filter: equ $bfe001
- filter_on equ 44
- filter_off equ 48
-
- modon equ 20
- pboff equ 24
- modoff equ 28
- rest equ 32
- end_fxp equ 36
- end_fx3 equ 36
- end_fx4 equ 40
- acc equ 52
- repeat equ 56
- play_new_tune equ 60
- down equ 1
- up equ 2
-
- ;***************************************************************
-
-
- ; THIS IS THE CONTROL SECTION FOR TESTING AS A STAND ALONE PRG.
-
- ; AND CAN BE DELETED WHEN NOT REQUIRED
-
- ;bra test_engine
- jsr select_new_song ;select first song and initiliase
-
- testloop:
- jsr delay ;wait for scan line at 50hz on pal
-
-
- ;move.l #10,fx_number every frame lazer test
- ;move.w #64,d1
- ;jsr set_up_fx
-
-
- ;jsr test_fade
- ;jsr en2 ;a test engine call
- jsr driver ;call music every interrupt
-
-
- ;move.l #10,fx_number
- ;move.w #64,d1
- ;jsr set_up_fx
-
- bra testloop ;loop back
-
- ;**************************************
-
- ;dff00c joystick port 1
- ; bit1 right switch
- ; bit9 left
- ; bit 1 xor bit 0 for pulled back
- ; 9 xor 8 for forward
-
-
-
-
- delay:
- tst.w fxtimer
- ;bne no_test
- clr.l d0
- move.b $bfe001,d0 ;
- btst #6,d0
- bne no_test1
- move.w #10,fxtimer
- bra testfx4
- no_test
- subq #1,fxtimer
- no_test1
- clr.l d0
- move.w vhposr,d0
- andi.w #%1111111100000000,d0
- cmpi.w #%1111111100000000,d0
-
- bne no_test1
- rts
-
- testfx4:
-
- ;jsr kill_chip
- ;move.w #1,int_disable
- clr.l d0
- move.b $bfe001,d0
- btst #6,d0
- beq testfx4
-
- move.l song_buffer,d0
- addq.l #1,d0
- cmp.l #11,d0 ; 10 tunes in this test
- ; 8 = silence
- bne nores
- move.l #1,d0
-
- ;******************************* HOW TO PLAY A NEW TUNE
-
- nores move.l d0,song_buffer
-
- ;jsr select_new_song ;this call sets up the tune
- ;number in the song buffer
- ;make sure music is enabled (see below)
- ;call is currently commented off
- ;so you can play fx over one tune
-
-
- ;******************************* HOW TO KILL ANY LOOPED FX
-
- move.l fx_last,d0
- move.l d0,fx_kill ; used on this demo
-
- ;jsr kill_loopfx ; used to kill any fx..not engines
-
-
- no_k
- move.l fx_no,fx_number
- move.l fx_no,fx_last
- addq.l #1,fx_no
- move.l max_fx,d0
- cmp.l fx_no,d0
- bne noreset
- move.l #39,fx_no
- noreset:
-
- ;;********************************** HOW TO PLAY AN FX ON THE
- ; NEXT 50th
- ; place fx number required in fx_no
- ; and do this call
- ; fx must be enabled...(see below)
-
- ;test_fade
- move.w #64,d1
- ;sub.w #1,d1
- ;cmp #0,d1
- ;bgt novr
- ;move #64,testv
- ;move.w #64,d1
- ;novr ;move.w d1,testv
- ;move.w d1,fade
-
- ; test vol for variable vol fx
-
-
- ;cmp.l #31,fx_number
- ;bne no_kill
- ;jsr kill_all_fx
- ;rts
-
- no_kill
-
- cmp.l #37,fx_number
- beq nof ;duplicate infinite wind
-
-
- cmp.l #14,fx_number
- beq twinfx
- jsr set_up_fx
- ;jsr en2
-
- ;jsr kill_engine
-
- nof rts
-
- twinfx jsr set_up_fx
- move.l #37,fx_number
- jsr set_up_fx
- rts
-
-
-
- testv dc.w 64
-
- ;***************************************************************
-
-
- ;;TEST ROUTINES SETTING UP AND UPDATING
- ;; TWO DIFFERENT ENGINES
-
- ;d0 = engine type 1 to 3
- ;d1 = engine vol
- ;d2 = engine rate
- ;d3 = engine seed (ident number)
- ; up to word value
-
-
- test_engines
-
- tst.w ref
- beq doe1
- rts
-
- ref dc.w 0
-
- doe1
- move.w #1,ref
- move.w #1,d0
- move.w test_vol,d1
- tst.w d1
- beq nosub
- ;sub.w #1,d1
- nosub move.w d1,test_vol
- move.w test_rate,d2
- cmp.w #130,d2
- blt nosubx
- sub.w #20,d2
- nosubx
- ;move.w d2,test_rate
- move.w #101,d3
-
- jjj1 jsr engines
- rts
-
- en2
-
- test_fade
-
- tst.w tek
- bne fo
-
- add.w #1,en2x
- cmp.w #10,en2x
- blt fo
-
- clr.w en2x
- move.w #3,d0 ;run 2nd engine
- move.w #20,d1
- move.w #400,d2
- move.w #50,d3
-
- ;test_fade
-
-
- ;move.w testv,d1
- ;sub.w #1,d1
- ;cmp #0,d1
- ;bgt novr
- ;move #0,testv
- ;move.w #0,d1
- novr ;move.w d1,testv
- ;move.w d1,fade
-
- jsr engines
- fo rts
-
-
-
- kill_engine
-
- move.w #1,tek
- move.w #3,d0
- move.w #1,d1 ;vol to 1
- move.w #400,d2
- move.w #50,d3
- jsr engines
- rts
-
-
-
- en2x dc.w 0
- test_rate dc.w 500
- test_vol dc.w 60
- tek dc.w 0
-
- ;***********************************
-
- ; variables used by the test section
- tflag dc.w 0
- fxtc: dc.w 10 ; ignore them !!!!!
- fx_no: dc.l 5
- fx_last dc.l 5
-
-
- ; END OF CONTROL (DELETABLE) SECTION
-
- ;**********************************************************
-
- ; --------------------------------------------------------------
-
- ; MAIN VARIABLES TO BE ACCESSED BY PROGRAMMER DURING RUNTIME
-
-
- fx_number: dc.l 0 ; number of fx required here...
- fx_kill dc.l 0 ; number of fx to kill/only needed for looped fx
-
- song_buffer dc.l 10; number of piece of music required here ie.1 to 10
-
- music_disable: dc.w 0 ; 1 = disable music
- fx_disable: dc.w 0 ; 1 = disable fx (currently disabled)
-
- fade dc.w 0; to fade music/fx out increase the
- ; value in this location from 0 to 64
- ; 0 = normal vol 64= silent.
-
- ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- ; THESE VARIABLES ARE USED INTERNALLY BY THE DRIVER
- fxr1 dc.l 0
- fxr2 dc.l 0
- fxr3 dc.l 0
- fxr4 dc.l 0
- fxc1 dc.l 0
- fxc2 dc.l 0
- fxc3 dc.l 0
- fxc4 dc.l 0
- fxce1 dc.w 0
- fxce2 dc.w 0
- fxce3 dc.w 0
- fxce4 dc.w 0
- fx1_flag dc.w 0
- fx2_flag dc.w 0
- fx3_flag dc.w 0
- fx4_flag dc.w 0
- fx_c_used dc.w 0
- fxtimer dc.w 0
- gen dc.w 0
- int_disable dc.w 0
- altpf dc.w 0
- kill_flag dc.w 0
- fx_mode dc.w 0
- existing_fx dc.w 0
- channel_to_use dc.w 0
- fflag dc.w 0
- ftimer dc.w 0 ;temp counter
- frate dc.w 0
- mode dc.w 0
-
- ; *******************************************************
-
- ; CALL THIS SUBROUTINE TO SET UP THE REQUIRED FX
- ; on entry it requires the fx number to be in "fx_number"(see above)
-
- ;********************
- ; move.w #204,d0
- ; lea gvars,a0
- ;clloop: clr.w (a0)+
- ; dbra d0,clloop
- ;************************
- set_up_fx
- ;d1 holds vol for certain fx
- move.w #1,int_disable
-
- movem.l d0/d1/d2/d5/a0/a2,-(a7) ;save used registers
- clr.w existing_fx ;flag
- clr.w channel_to_use ;channel to use
-
- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ;test for fx already running on a channel
- ;and if so then store which channel
- move.l fxc4,d0
- move.w #4,channel_to_use
- cmp.l fx_number,d0
- beq set_e_flag
-
- move.l fxc3,d0
- move.w #3,channel_to_use
- cmp.l fx_number,d0
- beq set_e_flag
-
- move.l fxc2,d0
- move.w #2,channel_to_use
- cmp.l fx_number,d0
- beq set_e_flag
-
- move.l fxc1,d0
- move.w #1,channel_to_use
- cmp.l fx_number,d0
- beq set_e_flag
-
- bra new_fx
-
- ; fx already on a channel
- set_e_flag
- move.w #1,existing_fx
-
- cmp.l #35,fx_number
- beq check35
-
- cmp.l #36,fx_number
- beq check36
-
- cmp.l #5,fx_number ;vv test
- blt fixed_vol ;engine
- cmp.l #13,fx_number
- bgt test_for_loop
- ;this is a variable vol existing fx
- ;is it louder than the existing fx ??
-
- move.l fx_number,d2
- cmp.l #5,d2
- bne isevv6
- cmp.w vv1,d1
- blt no_fx ;too quiet so drop it
- bra new_fx
-
- isevv6
- cmp.l #6,d2
- bne isevv7
- cmp.w vv2,d1
- blt no_fx ;too quiet so drop it
- bra new_fx
-
- isevv7
- cmp.l #7,d2
- bne isevv8
- cmp.w vv3,d1
- blt no_fx ;too quiet so drop it
- bra new_fx
-
- isevv8
- cmp.l #8,d2
- bne isevv9
- cmp.w vv4,d1
- blt no_fx ;too quiet so drop it
- bra new_fx
-
-
- isevv9 cmp.l #9,d2
- bne isevv10
- cmp.w vv5,d1
- blt no_fx ;too quiet so drop it
- bra new_fx
-
- isevv10
- cmp.l #10,d2
- bne isevv11
- cmp.w vv6,d1
- blt no_fx ;too quiet so drop it
- bra new_fx
-
- isevv11
- cmp.l #11,d2
- bne isevv12
- cmp.w vv7,d1
- blt no_fx ;too quiet so drop it
- bra new_fx
-
- isevv12
- cmp.l #12,d2
- bne isevv13
- cmp.w vv8,d1
- blt no_fx ;too quiet so drop it
- bra new_fx
-
- isevv13
- cmp.w vv8,d1
- blt no_fx ;too quiet so drop it
- bra new_fx
-
- check35
- cmp.w vv10,d1
- blt no_fx
- bra new_fx
-
- check36
-
- cmp.w vv11,d1
- blt no_fx
-
- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- new_fx
- cmp.l #35,fx_number
- beq write35
-
- cmp.l #36,fx_number
- beq write36
-
- cmp.l #5,fx_number
- blt fixed_vol
- cmp.l #13,fx_number
- bgt test_for_loop
- ;variable vol fx
- move.l fx_number,d2
- cmp.l #5,d2
- beq writevv1
- cmp.l #6,d2
- beq writevv2
- cmp.l #7,d2
- beq writevv3
- cmp.l #8,d2
- beq writevv4
- cmp.l #9,d2
- beq writevv5
- cmp.l #10,d2
- beq writevv6
- cmp.l #11,d2
- beq writevv7
-
- lea vv8,a0 ;write12 and 13
- bra wv
-
- writevv7
- lea vv7,a0
- bra wv
- writevv6
- lea vv6,a0
- bra wv
- writevv5
- lea vv5,a0
- bra wv
- writevv4
- lea vv4,a0
- bra wv
- writevv3
- lea vv3,a0
- bra wv
- writevv2
- lea vv2,a0
- bra wv
- writevv1
- lea vv1,a0
-
- wv move.w d1,(a0)
- bra fixed_vol
-
- write35
- lea vv10,a0
- bra wv
-
- write36
- lea vv11,a0
- bra wv
-
-
-
- ; ............................
- test_for_loop
- cmp.l #17,fx_number
- bgt fixed_vol
-
- move.l fx_number,d2
- ;is this fx already running
- cmp.l fxc4,d2
- beq is_on
- cmp.l fxc3,d2
- beq is_on
- cmp.l fxc2,d2
- beq is_on
- cmp.l fxc1,d2
- beq is_on
- ;fx not already on
- bra set_loop_counters ;so set it up and run it
-
- is_on
- cmp.l #14,d2 ;wind ?
- bne cl2
- move.w #2,loopc1 ;reset timer
- bra no_fx
-
- cl2
- cmp.l #15,d2 ;space_stat ?
- bne cl3
- move.w #1,loopc2 ;reset timer
- bra no_fx
-
- cl3
- cmp.l #16,d2 ;factories?
- bne cl4
- move.w #2,loopc3 ;reset timer
- bra no_fx
-
- cl4
- cmp.l #17,d2 ;fuelscoop?
- bne fixed_vol
- move.w #2,loopc4 ;reset timer
- bra no_fx
-
- set_loop_counters
-
- cmp.l #14,d2 ;wind ?
- bne cl2x
- move.w #1,loopc1 ;reset timer
- bra fixed_vol
-
- cl2x
- cmp.l #15,d2 ;space_stat ?
- bne cl3x
- move.w #1,loopc2 ;reset timer
- bra fixed_vol
-
- cl3x
- cmp.l #16,d2 ;factories?
- bne cl4x
- move.w #2,loopc3 ;reset timer
- bra fixed_vol
-
- cl4x
- cmp.l #17,d2 ;fuelscoop?
- bne no_fx
- move.w #2,loopc4 ;reset timer
-
-
- ;..............................
- fixed_vol
-
-
- cmp.l #31,fx_number
- beq use4 ;ship die to 4
-
-
- tst.w existing_fx
- beq sort_channel
- ;find channel to overwrite existing fx on
-
- cmp.w #4,channel_to_use
- beq use4
- cmp.w #3,channel_to_use
- beq use3
- cmp.w #2,channel_to_use
- beq use2
- bra use1
- ; ****************
-
-
- sort_channel
- tst.l fxc4
- bne check3
- tst.w fxce4
- bne check3
-
- use4:
- move.w #%0000000000001000,d5
- lea chann4reg,a2
- ;jsr end_fx4p
- ;move.l #0,fxc4
-
- ch4xx move.w #32,d0
- lea fxintc4,a0
- cfx4l: clr.w (a0)+
- dbra d0,cfx4l
-
-
- move.l fx_number,fxr4
- move.l fx_number,fxc4
- move.l #0,fx_number
- move.w #4,fx_c_used ;channel used
- bra no_fx
-
-
- check3: tst.l fxc3
- bne check2
- tst.w fxce3
- bne check2
- use3:
- move.w #%0000000000000100,d5
- lea chann3reg,a2
- ;jsr end_fx3p
- ;move.l #0,fxc3
-
- ch3xx move.w #32,d0
- lea fxintc3,a0
- cfx3l: clr.w (a0)+
- dbra d0,cfx3l
- move.l fx_number,fxr3
- move.l fx_number,fxc3
- move.l #0,fx_number
- move.w #3,fx_c_used ;channel used
- bra no_fx
-
-
-
-
- check2: tst.l fxc2
- bne check1
- tst.w fxce2
- bne check1
- use2:
- move.w #%0000000000000010,d5
- lea chann2reg,a2
- ;jsr end_fx2p
- ;move.l #0,fxc2
-
- ch2xx move.w #32,d0
- lea fxintc2,a0
- cfx2l: clr.w (a0)+
- dbra d0,cfx2l
-
- move.l fx_number,fxr2
- move.l fx_number,fxc2
- move.l #0,fx_number
- move.w #2,fx_c_used ;channel used
- bra no_fx
- check1: tst.l fxc1
- bne no_room
- tst.w fxce1
- bne no_room
-
-
- use1
- move.w #%0000000000000001,d5
- lea chann1reg,a2
- ;jsr end_fx1p
- ;move.l #0,fxc1
-
- ch1xx move.w #32,d0
- lea fxintc1,a0
- cfx1l: clr.w (a0)+
- dbra d0,cfx1l
-
- move.l fx_number,fxr1
- move.l fx_number,fxc1
- move.l #0,fx_number
- move.w #1,fx_c_used ;channel used
-
- no_fx
- clr.w int_disable
- movem.l (a7)+,d5/d2/d1/d0/a2/a0 ;restore registers
- rts
- no_room
- tst.w fx_mode
- beq overwrite ;actual fx
-
- move.w #255,fx_c_used ; no channel used
- bra no_fx
-
-
-
- overwrite
- tst.w fxce4
- bne oc3
- bra use4
- oc3 tst.w fxce3
- bne oc2
- bra use3
- oc2 tst.w fxce2
- bne oc1
- bra use2
- oc1 tst.w fxce1
- bne use1
- bra use1
-
- ;*************************************************
- ; CALL HERE TO KILL ANY FX...
- ; after putting the number of the fx you want to kill
- ; into fx_kill
-
- kill_loopfx
-
- movem.l d5/a2,-(a7) ;save used registers
- move.l fx_kill,d5
- cmp.l fxc1,d5
- bne k2
- move.w #%0000000000000001,d5
- lea chann1reg,a2
- jsr end_fx1p
- bra error
- k2 cmp.l fxc2,d5
- bne k3
- move.w #%0000000000000010,d5
- lea chann2reg,a2
- jsr end_fx2p
- bra error
- k3 cmp.l fxc3,d5
- bne k4
- move.w #%0000000000000100,d5
- lea chann3reg,a2
- jsr end_fx3p
- bra error
- k4 cmp.l fxc4,d5
- bne error
- move.w #%0000000000001000,d5
- lea chann4reg,a2
- jsr end_fx4p
- error
- clr.l fx_kill
- movem.l (a7)+,d5/a2 ;restore registers
- rts
- ;************************************************
-
- ;CALL HERE TO KILL ALL FX
-
- kill_all_fx:
-
- movem.l d5/a0,-(a7) ;save used registers
-
- move.w #%0000000000001000,d5
- lea chann4reg,a2
- jsr end_fx4p
- move.w #32,d0
- lea fxintc4,a0
- cfx4lx: clr.w (a0)+
- dbra d0,cfx4lx
-
- move.w #%0000000000000100,d5
- lea chann3reg,a2
- jsr end_fx3p
- move.w #32,d0
- lea fxintc3,a0
- cfx3lx: clr.w (a0)+
- dbra d0,cfx3lx
-
- move.w #%0000000000000010,d5
- lea chann2reg,a2
- jsr end_fx2p
- move.w #32,d0
- lea fxintc2,a0
- cfx2lx: clr.w (a0)+
- dbra d0,cfx2lx
-
- move.w #%0000000000000001,d5
- lea chann1reg,a2
- jsr end_fx1p
- move.w #32,d0
- lea fxintc1,a0
- cfx1lx: clr.w (a0)+
- dbra d0,cfx1lx
-
- movem.l (a7)+,d5/a0 ;restore registers
- rts
-
-
- ;*************************************************
-
- ; CALL HERE TO KILL ANY SOUND for whatever reason
-
- kill_chip:
- move.w #%0000000000001111,dmacon
- move.l rest_data,chann1reg
- move.l rest_data,chann2reg
- move.l rest_data,chann3reg
- move.l rest_data,chann4reg
- move.w #16,chann1reg+4
- move.w #16,chann2reg+4
- move.w #16,chann3reg+4
- move.w #16,chann4reg+4
- move.w #0,chann1reg+8
- move.w #0,chann2reg+8
- move.w #0,chann3reg+8
- move.w #0,chann4reg+8
- move.w #1,chann1reg+6
- move.w #1,chann2reg+6
- move.w #1,chann3reg+6
- move.w #1,chann4reg+6
- move.l #0,fxr1
- move.l #0,fxr2
- move.l #0,fxr3
- move.l #0,fxr4
- move.w #0,fx1_flag
- move.w #0,fx2_flag
- move.w #0,fx3_flag
- move.w #0,fx4_flag
- move.l #0,fxc1
- move.l #0,fxc2
- move.l #0,fxc3
- move.l #0,fxc4
- clr.w fx_mode
- rts
-
- ;*******************************
-
- ;d0 holds fade rate value 0 to 50
- fade_up
- move.w #1,fflag ;set flag for up
- move.w d0,frate
- move.w #64,fade ;fade value to max
- rts
-
- fade_out
- fade_down
- move.w #2,fflag ;set flag for up
- move.w d0,frate
- move.w #0,fade ;fade value to max
- rts
-
-
- ;*****************************
- engines
- movem.l d4/d5/d6/a2/a0/a1,-(a7) ;save used registers
-
- ;ENGINE RUNTIME ROUTINES
-
- ;d0 = engine type 1 to 3
- ;d1 = engine vol
- ;d2 = engine rate
- ;d3 = engine seed (ident number)
-
- ;check engine has legal volume
- tst.w d1
- beq end_engine ;drop it
- cmp.w #64,d1
- bgt end_engine
-
-
- ;decide if engine is new
- lea engine1_vars,a1
- tst.w (a1)
- beq ten2
- cmp.w engine1_seed,d3
-
- beq existing_engine
- ten2
- lea engine2_vars,a1
- tst.w (a1)
- beq ten3
- cmp.w engine2_seed,d3
- beq existing_engine
- ten3
- lea engine3_vars,a1
- tst.w (a1)
- beq ten4
- cmp.w engine3_seed,d3
- beq existing_engine
- ten4
- lea engine4_vars,a1
- tst.w (a1)
- beq setup_engine
- cmp.w engine4_seed,d3
- beq existing_engine
- ;engine not already in range
- ;so find if spare channel available
-
- setup_engine
- cmp.w #1,d0
- bne sej1
- lea engine1p,a0
- bra set_p
- sej1 cmp.w #2,d0
- bne sej3
- lea engine2p,a0
- bra set_p
- sej3 lea engine3p,a0
- set_p
- ;a0 = engine type address
- tst engine1_vars
- bne te2
- ue1 lea engine1_vars,a1
- lea current_engine1_fx,a2
- move.l #1,d6
- bra do_set_up
- te2
- tst engine2_vars
- bne te3
- ue2 lea engine2_vars,a1
- lea current_engine2_fx,a2
- move.l #2,d6
- bra do_set_up
- te3
- tst engine3_vars
- bne te4
- ue3 lea engine3_vars,a1
- lea current_engine3_fx,a2
- move.l #3,d6
- bra do_set_up
- te4
- tst engine4_vars
- bne test_vols
- ue4 lea engine4_vars,a1
- lea current_engine4_fx,a2
- move.l #4,d6
- bra do_set_up
-
- test_vols ;all channels running so
- ;find current smallest vol
- move.w #1,d5
- move.w engine1_vol,d4
- cmp engine2_vol,d4
- blt test3 ;1 is smaller than 2
- move.w #2,d5
- move.w engine2_vol,d4
- test3
- cmp engine3_vol,d4
- blt test4 ;1 or 2 is smaller
- move.w #3,d5
- move.w engine3_vol,d4
- test4
- cmp engine4_vol,d4
- blt vol_test_d
- move.w #4,d5
- move.w engine4_vol,d4
- vol_test_d ;smallest vol engine number in d5
- ;its volume in d4
- cmp.w d1,d4 ;cmp new vol
- bgt end_engine ;drop new engine fx.......
- cmp.w #1,d5
- beq ue1
- cmp.w #2,d5
- beq ue2
- cmp.w #3,d5
- beq ue3
- bra ue4
-
- do_set_up
- jsr pass_p ;write paramters to vars
-
-
- ; write parameters to fx pattern
- move.l a0,8(a2)
- move.w d2,12(a2)
- move.w #200,14(a2) ;2 second min
- move.w d1,20(a2)
-
- move.l d6,(fx_number)
-
- move.w #1,(fx_mode)
- jsr set_up_fx
- clr.w (fx_mode)
- ;d0 = amiga channel used
- cmp #255,fx_c_used
- beq end_engine ;no free channels
- move.w fx_c_used,14(a1) ;channel to vars
- move.w fx_c_used,d0
- cmp.w #4,d0
- bne re3
- clr.l fxc4
- move.w #1,fxce4
- bra end_engine
-
- re3
- cmp.w #3,d0
- bne re2
- clr.l fxc3
- move.w #1,fxce3
- bra end_engine
-
- re2
- cmp.w #2,d0
- bne re1
- clr.l fxc2
- move.w #1,fxce2
- bra end_engine
-
- re1
- clr.l fxc1
- move.w #1,fxce1
-
- end_engine
- movem.l (a7)+,d5/d4/d6/a2/a1/a0 ;restore registers
- rts
-
- ; """"""""""""""""""""""""""""""
- existing_engine
- jsr passpj1
- jsr update_engine
- bra end_engine
-
- pass_p ;a1 = which engine vars to use/d5=1 to 4
- ;a0 = address of type parameters
-
- move.w #1,(a1) ;reset flag/count to 1
-
- ;first turn off the engine already on this channel
- move.w 14(a1),d4
- cmp.w #4,d4
- bne pj1
- clr.w fxce4
- bra passpj1
- pj1 cmp.w #3,d4
- bne pj2
- clr.w fxce3
- bra passpj1
- pj2 cmp.l #2,d4
- bne pj3
- clr.w fxce2
- bra passpj1
- pj3 clr.w fxce1
-
- passpj1
-
- ;pass engine parameters to engine vars
- move.w #1,(a1) ;set on/off flag
- move.w d0,2(a1)
- move.w d1,4(a1)
- move.w d2,6(a1)
- move.w d3,8(a1)
- move.l a0,10(a1)
- clr.w 16(a1)
- rts
-
- update_engine ; (a0)= engine vars
- ;only used after driver has set sample running
-
- move.l a1,a0
- clr.w 16(a0) ;timer to 0
- update2
- move.w 14(a0),d0 ;amiga channel
- cmp.w #4,d0
- bne uej1
- tst.l fxc4
- bne off_engine
- lea chann4reg,a1
- bra write_engine
-
- uej1 cmp.w #3,d0
- bne uej2
- tst.l fxc3
- bne off_engine
- lea chann3reg,a1
- bra write_engine
-
- uej2 cmp.w #2,d0
- bne uej3
- tst.l fxc2
- bne off_engine
- lea chann2reg,a1
- bra write_engine
- uej3
- tst.l fxc1
- bne off_engine
- lea chann1reg,a1
- bra write_engine
-
- off_engine
- clr.w (a0) ;flag to off
- clr.w 8(a0) ;seed to 0
- rts
-
- write_engine ;a1 points to registers
- move.w 4(a0),8(a1) ;vol to chip
- move.w 6(a0),6(a1) ;rate to chip
- rts
-
-
-
- ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ;current engine pattern buffer
-
- current_engine1_fx
- dc.w new_env
- dc.l current_engine1_env
- dc.w new_snd
- dc.l 0 ;+8 ;paramters
-
- dc.w 0 ;+12 rate
- dc.w 0 ;+ 14 duration
-
-
- dc.w end_fxp
-
- current_engine1_env: dc.w 0,0,255 ;+20 vol
-
-
- current_engine2_fx
- dc.w new_env
- dc.l current_engine2_env
- dc.w new_snd
- dc.l 0
-
- ce2_rate dc.w 0
- ce2_time dc.w 0 ;1 sec max without refresh
-
-
- dc.w end_fxp
-
- current_engine2_env: dc.w 0,0,255
-
-
- current_engine3_fx
- dc.w new_env
- dc.l current_engine3_env
- dc.w new_snd
- dc.l 0
-
- ce3_rate dc.w 0
- ce3_time dc.w 0 ;1 sec max without refresh
-
-
- dc.w end_fxp
-
- current_engine3_env: dc.w 0,0,255
-
-
- current_engine4_fx
- dc.w new_env
- dc.l current_engine4_env
- dc.w new_snd
- dc.l 0
-
- ce4_rate dc.w 0
- ce4_time dc.w 0 ;1 sec max without refresh
-
-
- dc.w end_fxp
-
- current_engine4_env: dc.w 0,0,255
-
-
- engine1_vars dc.w 0 ;on off flag
- engine1_type dc.w 0
- engine1_vol dc.w 0
- engine1_rate dc.w 0
- engine1_seed dc.w 0 ;+8
- engine1_type_p dc.l 0 ;address of type 1 to 3
- acu1 dc.w 0 ;amiga channel used
- e1timer dc.w 0
-
-
- engine2_vars dc.w 0
- engine2_type dc.w 0
- engine2_vol dc.w 0
- engine2_rate dc.w 0
- engine2_seed dc.w 0
- engine2_type_p dc.l 0
- acu2 dc.w 0 ;amiga channel used
- e2timer dc.w 0
-
-
- engine3_vars dc.w 0
- engine3_type dc.w 0
- engine3_vol dc.w 0
- engine3_rate dc.w 0
- engine3_seed dc.w 0
- engine3_type_p dc.l 0
- acu3 dc.w 0 ;amiga channel used
- e3timer dc.w 0
-
-
- engine4_vars dc.w 0
- engine4_type dc.w 0
- engine4_vol dc.w 0
- engine4_rate dc.w 0
- engine4_seed dc.w 0
- engine4_type_p dc.l 0
- acu4 dc.w 0 ;amiga channel used
- e4timer dc.w 0
-
-
- ;****************************************
-
- ; CALL HERE TO SELECT WHICH PIECE OF MUSIC TO PLAY
- ; AFTER PLACING NUMBER (1 to ?) IN "SONG_BUFFER"..see above
- ; a call to this routine will initiliase the driver/kill any sound etc.
- ; make sure this routine has been called before running the interrupt
- ; driven section....see below
-
- start_timer dc.w 0
-
- select_new_song:
-
- move.w #1,int_disable
- movem.l d0/d1/a0/a1,-(a7) ;save used registers
- move.w music_disable,gen
- move.w #1,music_disable
- jsr kill_chip
- clr.l d0
- move.w #204,d0
- lea gvars,a0
- clloop: clr.w (a0)+
- dbra d0,clloop
- tst.l song_buffer
- beq no_song
- move.l song_buffer,d1
- add.l d1,d1
- add.l d1,d1
- add.l d1,d1
- add.l d1,d1
- LEA SONG_TABLE-16,A1
- add.l d1,a1
- MOVE.L (A1)+,WSONG1
- move.l (a1)+,wsong2
- move.l (a1)+,wsong3
- move.l (a1),wsong4
- MOVE.L #pstart,PATTR1
- MOVE.L #pstart,PATTR2
- MOVE.L #pstart,PATTR3
- move.l #pstart,pattr4
- move.l #sstart,songr1
- MOVE.L #sstart,SONGR2
- MOVE.L #sstart,SONGR3
- move.l #sstart,songr4
- no_song
- move.w #1,ch1vars
- move.w #2,ch2vars
- move.w #3,ch3vars
- move.w #4,ch4vars
- move.w #6,ch4fxvars
- move.w #5,ch3fxvars
- move.w #7,ch2fxvars
- move.w #8,ch1fxvars
- move.w gen,music_disable
- clr.w int_disable
- clr.w fade
- clr.w fflag
- clr.w engine1_vars
- clr.w engine2_vars
- clr.w engine3_vars
- clr.w engine4_vars
- clr.w fxce1
- clr.w fxce2
- clr.w fxce3
- clr.w fxce4
-
- cmp.l #10,song_buffer ;intro tagged piece
- bne no_sps
- move.w #12,d0
- jsr fade_up
- no_sps
- movem.l (a7)+,d0/d1/a0/a1 ;restore registers
- rts
-
- ;**************************************************
-
- ; CALL HERE ON A 50hz INTERRUPT DURING RUNTIME
- ; TO PLAY FX AND TUNES
-
- driver:
-
- tst.w int_disable
- beq process_data
- rts
- process_data
- movem.l d0-d6/a0-a6,-(a7) ;save used registers
-
- ;******************************
- ;fade section
- tst.w fflag
- beq proj1
- cmp.w #1,fflag
- bne tfo
- move.w ftimer,d0
- add.w #1,d0
- move.w d0,ftimer
- cmp.w frate,d0
- bne proj1
- sub.w #1,fade
- clr.w ftimer
- tst.w fade
- bne proj1
- clr.w fflag
- bra proj1
- tfo
- move.w ftimer,d0
- add.w #1,d0
- move.w d0,ftimer
- cmp.w frate,d0
- bne proj1
- add.w #1,fade
- clr.w ftimer
- cmp.w #64,fade
- bne proj1
- clr.w fflag
-
- ;*******************************
- proj1
- lea engine1_vars,a0
- tst.w (a0)
- beq tt2
- add.w #1,16(a0)
- cmp.w #51,16(a0)
- blt tt2
- sub.w #1,4(a0)
- jsr update2
-
- tt2
-
- lea engine2_vars,a0
- tst.w (a0)
- beq tt3
- add.w #1,16(a0)
- cmp.w #51,16(a0)
- blt tt3
- sub.w #1,4(a0)
- jsr update2
-
- tt3
- lea engine3_vars,a0
- tst.w (a0)
- beq tt4
- add.w #1,16(a0)
- cmp.w #51,16(a0)
- blt tt4
- sub.w #1,4(a0)
- jsr update2
- tt4
- lea engine4_vars,a0
- tst.w (a0)
- beq etf
- add.w #1,16(a0)
- cmp.w #51,16(a0)
- blt etf
- sub.w #1,4(a0)
- jsr update2
-
- etf
-
- ;^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;service engine vars
- ; if an engine volume is at 0 then turn it off
-
- lea engine1_vars,a0
- tst.w (a0)
- beq tev2 ;no engine here
- cmp.w #1,4(a0) ;vol at 0
- bgt tev2
- rb clr.w (a0)
- clr.w 8(a0)
- clr.w 16(a0)
- move.w acu1,d0
- jsr clear_amiga_channel
-
-
- tev2
- lea engine2_vars,a0
- tst.w (a0)
- beq tev3 ;no engine here
-
- cmp.w #1,4(a0) ;vol at 0
- bgt tev3
- clr.w (a0)
- clr.w 8(a0)
- clr.w 16(a0)
- move.w acu2,d0
- jsr clear_amiga_channel
-
- tev3
- lea engine3_vars,a0
- tst.w (a0)
- beq tev4 ;no engine here
- cmp.w #1,4(a0) ;vol at 0
- bgt tev4
- clr.w (a0)
- clr.w 8(a0)
- clr.w 16(a0)
- move.w acu3,d0
- jsr clear_amiga_channel
- tev4
- lea engine4_vars,a0
- tst.w (a0)
- beq ch1 ;no engine here
- cmp.w #1,4(a0) ;vol at 0
- bne ch1
- clr.w (a0)
- clr.w 8(a0)
- clr.w 16(a0)
- move.w acu4,d0
- jsr clear_amiga_channel
- bra ch1
-
- clear_amiga_channel
- cmp.w #4,d0
- bne cac2
- clr.w fxce4
- move.w #%0000000000001000,d5
- lea chann4reg,a2
- jsr end_fx4p
-
- rts
- cac2 cmp.w #3,d0
- bne cac3
- clr.w fxce3
- move.w #%0000000000000100,d5
- lea chann3reg,a2
- jsr end_fx3p
-
- rts
- cac3 cmp.w #2,d0
- bne cac4
- clr.w fxce2
- move.w #%0000000000000010,d5
- lea chann2reg,a2
- jsr end_fx2p
- rts
-
- cac4 cmp.w #1,d0
- bne cac5
- clr.w fxce1
- move.w #%0000000000000001,d5
- lea chann1reg,a2
- jsr end_fx1p
- cac5 rts
-
-
-
- ;^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
- ch1:
- tst.w fx_disable
- bne test_music1
- tst.l fxr1
- bne ch1j1
-
- tst.l fxc1
- beq test_music1
- bra ch1j3
- ch1j2 jsr run_dummy1
- jsr run_fx1
- bra ch2
- ch1j1
- jsr set_up1
- ch1j3 tst.w music_disable
- beq ch1j2
- jsr run_fx1
- bra ch2
- test_music1
-
- tst.w fxce1
- beq noe1
- jsr run_dummy1
- bra ch2
-
-
- noe1
- tst.w music_disable
- bne ch2
- jsr run_music1
- bra ch2
- ;***********************
-
- ; channel 1 subroutines
-
- run_dummy1
- move.w #1,mode
- lea ch1vars,a0
- lea dummy_reg,a2
- move.w #0,d5
- move.w #0,d1
- jsr sect1
- rts
-
- set_up1
-
- jsr endc_fx1p
-
- move.l fxr1,d0
- add d0,d0
- add d0,d0
- lea fxjump_table-4,A1
- add.l d0,a1
- move.l (a1),currfx1
- clr.l fxr1
- clr.w fxintc1
- rts
-
-
- run_fx1
- move.w #0,mode
-
- lea ch1fxvars,a0
- lea chann1reg,a2
- move.w #%0000000000000001,d5
- move.w #%1000001000000001,d1
- jsr sect1
- rts
-
- run_music1
- move.w #1,mode
-
- lea ch1vars,a0
- lea chann1reg,a2
- move.w #%0000000000000001,d5
- move.w #%1000001000000001,d1
- jsr sect1
- rts
-
- ; **************************
- ch2
- tst.w fx_disable
- bne test_music2
- tst.l fxr2
- bne ch2j1
- tst.l fxc2
- beq test_music2
- bra ch2j3
-
- ch2j2 jsr run_dummy2
- jsr run_fx2
- bra ch3
- ch2j1
- jsr set_up2
- ch2j3 tst.w music_disable
- beq ch2j2
- jsr run_fx2
- bra ch3
-
- test_music2
-
-
- tst.w fxce2
- beq noe2
- jsr run_dummy2
- bra ch3
-
-
- noe2
-
-
- tst.w music_disable
- bne ch3
- jsr run_music2
- bra ch3
- ;***********************
- ; channel 2 subroutines
- run_dummy2
- move.w #1,mode
-
- lea ch2vars,a0
- lea dummy_reg,a2
- move.w #0,d5
- move.w #0,d1
- jsr sect1
- rts
-
- set_up2
-
- jsr endc_fx2p
-
-
- move.l fxr2,d0
- add d0,d0
- add d0,d0
- lea fxjump_table-4,A1
- add.l d0,a1
- move.l (a1),currfx2
- clr.l fxr2
- clr.w fxintc2
- rts
-
-
- run_fx2
- move.w #0,mode
-
- lea ch2fxvars,a0
- lea chann2reg,a2
- move.w #%0000000000000010,d5
- move.w #%1000001000000010,d1
- jsr sect1
- rts
-
- run_music2
- move.w #1,mode
-
- lea ch2vars,a0
- lea chann2reg,a2
- move.w #%0000000000000010,d5
- move.w #%1000001000000010,d1
- jsr sect1
- rts
-
- ; **************************
-
- ch3:
- tst.w fx_disable
- bne test_music3
- tst.l fxr3
- bne ch3j1
- tst.l fxc3
- beq test_music3
- bra ch3j3
- ch3j2 jsr run_dummy3
- jsr run_fx3
- bra ch4
- ch3j1
- jsr set_up3
- ch3j3 tst.w music_disable
- beq ch3j2
- jsr run_fx3
- bra ch4
-
- test_music3
-
-
- tst.w fxce3
- beq noe3
- jsr run_dummy3
- bra ch4
-
-
- noe3
-
-
-
- tst.w music_disable
- bne ch4
- jsr run_music3
- bra ch4
-
- ;***********************
-
- ; channel 3 subroutines
-
- run_dummy3
- move.w #1,mode
-
- lea ch3vars,a0
- lea dummy_reg,a2
- move.w #0,d5
- move.w #0,d1
- jsr sect1
- rts
-
- set_up3
-
- jsr endc_fx3p
-
-
- move.l fxr3,d0
- add d0,d0
- add d0,d0
- lea fxjump_table-4,A1
- add.l d0,a1
- move.l (a1),currfx3
- clr.l fxr3
- clr.w fxintc3
- rts
-
-
- run_fx3
- move.w #0,mode
-
- lea ch3fxvars,a0
- lea chann3reg,a2
- move.w #%0000000000000100,d5
- move.w #%1000001000000100,d1
- jsr sect1
- rts
-
- run_music3
- move.w #1,mode
-
- lea ch3vars,a0
- lea chann3reg,a2
- move.w #%0000000000000100,d5
- move.w #%1000001000000100,d1
- jsr sect1
- rts
-
- ; **************************
-
- ch4:
- tst.w fx_disable
- bne test_music4
- tst.l fxr4
- bne ch4j1
- tst.l fxc4
- beq test_music4
- bra ch4j3
- ch4j2 jsr run_dummy4
- jsr run_fx4
- bra no4
- ch4j1
- jsr set_up4
- ch4j3 tst.w music_disable
- beq ch4j2
- jsr run_fx4
- bra no4
-
- test_music4
-
-
- tst.w fxce4
- beq noe4
- jsr run_dummy4
- bra no4
-
-
- noe4
- tst.w music_disable
- bne no4
- jsr run_music4
- no4
- movem.l (a7)+,d0-d6/a0-a6 ;restore registers
- rts
-
- ;***********************
-
- ; channel 4 subroutines
-
- run_dummy4
- move.w #1,mode
-
- lea ch4vars,a0
- lea dummy_reg,a2
- move.w #0,d5
- move.w #0,d1
- jsr sect1
- rts
-
- set_up4
-
- jsr endc_fx4p
-
-
- move.l fxr4,d0
- add d0,d0
- add d0,d0
- lea fxjump_table-4,A1
- add.l d0,a1
- move.l (a1),currfx4
- clr.l fxr4
- clr.w fxintc4
- rts
-
-
- run_fx4
-
- move.w #0,mode
-
- lea ch4fxvars,a0
- lea chann4reg,a2
- move.w #%0000000000001000,d5
- move.w #%1000001000001000,d1
- jsr sect1
- rts
-
- run_music4
-
- move.w #1,mode
-
- lea ch4vars,a0
- lea chann4reg,a2
- move.w #%0000000000001000,d5
- move.w #%1000001000001000,d1
- jsr sect1
- rts
- ; **************************
-
- sect1:
- ;tst.w 0(a0)
- ;bne s1j1
- ;rts
-
- s1j1: tst.w 2(a0)
- beq sect3
- cmpi.w #1,2(a0)
- beq sect4
-
- cmpi.w #3,4(a0)
- beq part2
-
- mode_switch: subq.w #1,2(a0)
-
- check_effects: clr.w altpf
- move.w 6(a0),d2
- tst.w 8(a0)
- beq check_mod
- tst.w 14(a0)
- beq cont_bend
- subq.w #1,14(a0)
- bra check_mod
- cont_bend: addq.w #1,altpf
- move.w 10(a0),d3
- move.w 12(a0),d4
- cmpi.w #1,8(a0)
- beq pbup
-
- sub.w d3,d2
- cmp.w d2,d4
- bcs check_mod
- bra fbend
-
- pbup: add.w d3,d2
- cmp.w d2,d4
- bcc check_mod
- fbend: move.w d4,d2
- clr.w 8(a0)
- check_mod: tst.w 16(a0)
- beq send_alt_pitch
-
-
- tst.w 58(a0)
- beq st_ok
- subq.w #1,58(a0)
- bra send_alt_pitch
- st_ok:
- tst.w 50(a0)
- beq cont_mod
- subq #1,50(a0)
- bra send_alt_pitch
- cont_mod: move.w 52(a0),50(a0)
- addq #1,altpf
- cmpi #3,16(a0)
- bcc addmod
-
- move.w 56(a0),d3
- sub.w d3,d2
- addq.w #1,16(a0)
- bra send_alt_pitch
- addmod:
-
- move.w 54(a0),d3
- add.w d3,d2
- addq.w #1,16(a0)
- cmpi.w #5,16(a0)
- bne send_alt_pitch
- move.w #1,16(a0)
-
- send_alt_pitch: tst.w altpf
- beq send_env
- move.w d2,6(a0)
- move.w d2,6(a2)
-
- send_env:
-
- do_env_check:
-
- norm_env:
- tst.w mode
- beq fxenv
-
- move.l 18(a0),a1
- cmpi.w #255,(a1)
- beq env_finished
-
- resu clr.l d0
- move.w (a1)+,d0
- sub.w fade,d0
- bcc sete
- move.w #0,d0
- sete move.w d0,8(a2)
- move.l a1,18(a0)
- rts
-
- env_finished:
- subq.l #2,a1
- bra resu
-
- fxenv
- move.l 18(a0),a1
- cmpi.w #255,(a1)
- beq env_finishedx
-
- resux clr.l d0
- move.w (a1)+,d0
- move.w d0,8(a2)
- move.l a1,18(a0)
- rts
-
- env_finishedx:
- subq.l #2,a1
- bra resux
-
-
-
-
-
-
- one_shot_note: move.w #3,4(a0)
- move.l 38(a0),(a2)
- move.w 42(a0),4(a2)
- move.w d1,dmacon
- bra send_env
-
-
- part2:
- move.l 44(a0),(a2)
- move.w 48(a0),4(a2)
- subq.w #1,2(a0)
- move.w #1,4(a0)
- bra check_effects
-
- sect3:
- move.w 0,66(a0)
-
- move.l 22(a0),a1
- control_ret: move.w (a1)+,d0
- cmpi.w #100,d0
- bls sect5
-
- acc_note:
- move.w d0,6(a0)
- move.w d0,6(a2)
- move.w (a1)+,2(a0)
- subq.w #1,2(a0)
- move.l a1,22(a0)
- move.l 34(a0),18(a0)
- move.w 60(a0),58(a0)
-
-
- tst.w 16(a0)
- beq no_mod_res
- move.w #1,16(a0)
- no_mod_res:
- cmpi.w #0,4(a0)
- beq do_loop
- bra one_shot_note
-
-
- do_loop: move.w d1,dmacon
- bra send_env
-
- do_rest:
- move.w (a1)+,2(a0)
- subq.w #1,2(a0)
- move.l a1,22(a0)
- move.l #rest_env,18(a0)
-
- move.w #0,8(a2)
- bra send_env
-
- sect4:
- cmpi.w #0,4(a0)
- beq noof
- move.w d5,dmacon
- noof: subq.w #1,2(a0)
- bra check_effects
-
- sect5: move.l #jump_table,a3
- move.l (a3,d0),a4
- jmp (a4)
-
- jump_table:
- dc.l in_line_data
- dc.l nsound
- dc.l patt_end
- dc.l get_env
- dc.l check_pbend
- dc.l do_mod
- dc.l bend_off
- dc.l mod_off
- dc.l do_rest
- dc.l end_fx
- dc.l end_fx
- dc.l s_f_on
- dc.l s_f_off
- dc.l set_acc
- dc.l rept
- dc.l song_select
-
-
- in_line_data:
-
- nop
- rts
-
- rept:
-
- tst.w (a1)
- bne round_again
-
- add.l #6,a1
- move.l (a1),a1
- bra control_ret
-
- round_again
- subq.w #1,(a1) ;decrease counter
- add.l #2,a1
- move.l (a1),a1
- bra control_ret
-
- s_f_on:
- bclr #1,filter
- bra control_ret
- s_f_off:
- bset #1,filter
- bra control_ret
-
- nsound: move.l (a1)+,a3
- cmpi.w #0,(a3)
- bne one_shot_sound
- move.w (a3)+,4(a0)
- move.l (a3)+,(a2)
- move.w (a3),4(a2)
- jmp control_ret
-
- one_shot_sound:
- move.w (a3)+,4(a0)
- move.l (a3)+,38(a0)
- move.l (a3)+,42(a0)
- move.l (a3),46(a0)
- jmp control_ret
-
- patt_end:
- move.l 26(a0),a1
- cmpi.l #0,(a1)
- beq song_control
- addq.l #4,26(a0)
- move.l (a1),a1
- jmp control_ret
- get_env:
- move.l (a1)+,a4
-
- move.l (a4)+,62(a0)
-
- move.l a4,34(a0)
-
- bra control_ret
-
- check_pbend:
- move.l (a1)+,8(a0)
- move.l (a1)+,12(a0)
- bra control_ret
-
- do_mod: move.w #1,16(a0)
- move.l (a1)+,50(a0)
- move.l (a1)+,54(a0)
- move.l (a1)+,58(a0)
- bra control_ret
-
- bend_off: clr.w 8(a0)
- bra control_ret
-
- mod_off: clr.w 16(a0)
- bra control_ret
-
-
- end_fx:
- cmpi.w #6,(a0)
- beq end_fx4p
-
- cmpi.w #5,(a0)
- beq end_fx3p
-
- cmpi.w #7,(a0)
- beq end_fx2p
-
- cmpi.w #8,(a0)
- beq end_fx1p
- rts
-
- end_fx1p:
- move.w #%0000000000000001,dmacon
- move.w #1,chann1reg+6
- move.w #0,chann1reg+8
- move.l #0,fxc1
- rts
-
- end_fx2p:
- move.w #%0000000000000010,dmacon
- move.w #1,chann2reg+6
- move.w #0,chann2reg+8
- move.l #0,fxc2
- rts
-
-
- end_fx3p:
- move.w #%0000000000000100,dmacon
- move.w #1,chann3reg+6
- move.w #0,chann3reg+8
- move.l #0,fxc3
- rts
-
- end_fx4p:
-
- move.w #%0000000000001000,dmacon
- move.w #1,chann4reg+6
- move.w #0,chann4reg+8
- move.l #0,fxc4
- rts
-
-
- endc_fx1p:
- move.w #%0000000000000001,dmacon
- move.w #1,chann1reg+6
- move.w #0,chann1reg+8
- ;move.l #0,fxc1
- rts
-
- endc_fx2p:
- move.w #%0000000000000010,dmacon
- move.w #1,chann2reg+6
- move.w #0,chann2reg+8
- ;move.l #0,fxc2
- rts
-
-
- endc_fx3p:
- move.w #%0000000000000100,dmacon
- move.w #1,chann3reg+6
- move.w #0,chann3reg+8
- ;move.l #0,fxc3
- rts
-
- endc_fx4p:
-
- move.w #%0000000000001000,dmacon
- move.w #1,chann4reg+6
- move.w #0,chann4reg+8
- ;move.l #0,fxc4
- rts
-
-
-
-
-
-
-
- set_acc: move.w #1,66(a0)
- bra control_ret
-
- song_control: ;these instructions reset the
- addq.l #4,a1
- move.l 30(a0),26(a0) ;song pointers to the start for looping
- move.l 26(a0),a1
- addq.l #4,26(a0)
- move.l (a1),a1
- jmp control_ret ;dont change this
-
-
- ;"""""""""""""""""""""""""""""""""""""""""""""""""
- song_select:
-
- ;A CALL HERE TO A ROUTINE THAT SELECTED
- ;A NEW TUNE/PLACED THE NUMBER IN SONG_BUFFER
- ;AND CALLED select_new_song WOULD START
- ;A DIFFERENT TUNE
-
- ;test code only..replace with your own
-
-
- move.l song_buffer,d0
- addq.l #1,d0
- cmp.l #10,d0 ; 9 tunes in this test
- bne noresx
- move.l #1,d0
- noresx move.l d0,song_buffer
-
- jsr select_new_song ;this call sets up the new tune
-
- rts
-
-
- ;-----------------------------------------------
-
-
-
-
-
-
-
-
-
-
- ;;; DATA
-
- song_table:
-
- dc.l s1,s2,s3,s4 ;hall of m kings
- dc.l s5,s6,s7,s8 ;title tune
- dc.l sbaba1,sbaba2,sbaba3,sbaba4 ;baba yaga
- dc.l sgg1,sgg2,sgg3,sgg4 ;great gates
- dc.l bds1,bds2,bds3,bds4 ;blue danube
- dc.l jalt1,jalt2,jalt3,jalt4 ;alternative to jupiter
- dc.l rvs1,rvs2,rvs3,rvs4 ;ride valkries
- dc.l ssilent,ssilent,ssilent,ssilent ;silent
- dc.l bm1,bm2,bm3,bm4 ;b mountain
- dc.l intro5,intro6,intro7,intro8
-
- ;************************************************************
- gvars:
- ch1vars
- dc.w 0
- dc.w 0,0,0,0,0,0,0,0,0,0
- pattr1: dc.l