;*********************************************************************** ;*********** *********** ;*********** *********** ;*********** DSP-Replay MegaTracker v1.1 *********** ;*********** *********** ;*********** *********** ;*********** by Simplet / FATAL DESIGN *********** ;*********** *********** ;*********************************************************************** ; The circular sample buffer must begin to an address multiple ; of the the first power of 2 greater than its size ; If you want an 50Hz VBL/Timer as maximum frequency, ; The size must be greater than : ; 2*984 for 49.1Khz, 2*656 for 32.8KHz, 2*492 for 24.5KHz, etc... PBC equ $ffe0 ; Port B Control Register PCC equ $ffe1 ; Port C Control register HCR equ $ffe8 ; Host Control Register HSR equ $ffe9 ; Host Status Register HRX equ $ffeb ; Host Receive Register HTX equ $ffeb ; Host Transmit Register CRA equ $ffec ; SSI Control Register A CRB equ $ffed ; SSI Control Register B SSISR equ $ffee ; SSI Status Register TX equ $ffef ; SSI Serial Transmit data/shift register BCR equ $fffe ; Port A Bus Control Register IPR equ $ffff ; Interrupt Priority Register ; Host Control Register Bit Flags HCIE equ 2 ; Host Command Interrupt Enable ; Host Status Register Bit Flags HRDF equ 0 ; Host Receive Data Full HTDE equ 1 ; Host Transmit Data Empty org p:$0 jmp >Start org p:$10 jsr >Spl_Out org p:$12 jsr >Spl_Out org p:$26 jsr >SoundTrack_Rout org p:$28 jsr >Clear_Sample_Buffer ; Interrupt Routine that plays the sound with the SSI org p:$40 Spl_Out jset #<2,X:<2048,x0 ; Warning Modulo ! add x0,a Length_Ok move a,X:(r0)+ ; Sample Length ; Gets the Master Volumes move #>$0000ff,x1 move #>$008000,y1 Get_MVol jclr #1024,x0 mpy x0,y0,a #>2,b add y0,b a0,x0 ; b = Nb Voies + 2 voies FX move #>1,a andi #<$fe,ccr ; Cancel Carry Bit Rep #<24 div x0,a ; a0 = 1 / (1024 * Nb Voices) move a0,X:(r0) ; Clears the sample-buffer before mixing clr a X:Calc_Adr,r6 move X:Length,x0 Do x0,Clear_Sample move a,L:(r6)+ Clear_Sample ; Mix All Voices move #Voices_Frac,r1 Do b,Mix_All_Voices_Loop ; Calls the 030 Request jclr #$0000ff,x1 move #>$000080,y0 move #>$008000,y1 Receive_Pan jclr #2,y0 move X:2,x0 move X:2,x0 move r0,b move X:(r1),b0 ; Frac Do X:$000080,x1 move X:1,x0 sub x0,b X:$008000,y1 move r6,r2 move #$008000,y1 move r6,r2 move #$7fffff,y0 move X:-(r6),x0 Do X:Length,Treat_030_8_Bits_Stereo_Voice_Loop jclr #$ff0000,x1 move #>1,a addr a,b #3,n0 Do b,Receive_X_Loop_8 Receive_X_Sample_8 jclr #1,a add a,b #Sample,r0 Do b,Receive_X_Loop_16 Receive_X_Sample_16 jclr #$ff0000,x1 move #>1,a addr a,b #3,n0 Do b,Receive_Y_Loop_8 Receive_Y_Sample_8 jclr #1,a add a,b #Sample,r0 Do b,Receive_Y_Loop_16 Receive_Y_Sample_16 jclr #$ff0000,x1 move #>1,a add a,b #Sample,r0 Do b,Receive_Stereo_Loop_8 Receive_Stereo_Sample_8 jclr #1,a add a,b #Sample,r0 Do b,Receive_Stereo_Loop_16 Receive_Left_Sample_16 jclr #