|
|
Atari coding BBS
Re: DMA sound + timer A |
Posted by: Laurent / Thadoss
|
Dec,21.2013-00:06
|
Hi all,
Sorry to disturb again, but I still encounter a problem ;)
My DMA sound plays correctly under Hatari,but not on the real hardware.
Under hatari, I get :
- 1st sound plays
- at the end, timer_A triggers and launch the second sound
Under the Falcon, I can't hear the first sound, the second one starts immediatly, as if the Timer-A triggers immediatly the end of the first sound.
Any idea ?
Regards
Laurent
; Stop interrupts
move.w sr,d7 ; Save SR
move.w #$2700,sr ; Ints off
; Set the Falcon crossbar matrix to play the sounds
move.w #$00,$ffff8900.w ; Stop all sounds
clr.b $ffff8920.w ; play track0 ; monitor track0
move.b #$40,$ffff8921.w ; 16 bits stereo
move.w #$1,$ffff8930.w
move.w #$0,$ffff8932.w
move.b #$05,$ffff8935.w ; 16 Khz / 25 Mzh clock
; Save the Timer_A vector address ($134)
lea.l save_timer_a(pc),a0
move.l $134.w,(a0)
; Save the MFP Timer_A state
lea.l save_MFP_timer_a(pc),a0
move.b $fffffa13.w,(a0)+ ; Timer-A Interrupt Mask A
move.b $fffffa0f.w,(a0)+ ; Timer-A Interrupt in service
move.b $fffffa0b.w,(a0)+ ; Timer-A Interrupt pending
move.b $fffffa07.w,(a0)+ ; Timer-A Interrupt Enable
move.b $fffffa1f.w,(a0)+ ; Timer-A Data (activate after counting 1 event)
move.b $fffffa19.w,(a0)+ ; Timer-A Event count mode
move.b $fffffa17.w,(a0)+ ; Automatic End-Interrupt ON
; Set and start the MFP Timer-a interrupt
bclr #3,$fffffa17.w ; Automatic End-Interrupt ON
and.b #$df,$fffffa13.w ; Timer-A Interrupt Mask A
and.b #$df,$fffffa0b.w ; Timer-A Interrupt pending
and.b #$df,$fffffa0f.w ; Timer-A Interrupt in service
and.b #$df,$fffffa07.w ; Timer-A Interrupt Enable
move.b #$01,$fffffa1f.w ; Timer-A Data (activate after counting 1 event)
lea.l intro_timer_a(pc),a0
move.l a0,$134.w ; Set the new Timer-A vector on our Timer-A interrupt code
; Set the new VBL vector
lea.l intro_vbl(pc),a0
move.l a0,$70
; Restart interrupts
move.w d7,sr ; Restore SR
[...] ; Later in the code
; Load the Start engine sound into the DMA
move.l sound_1(pc),d6
move.l #158752,d7 ; sound 1 end
bsr.w setsound
; Start the Timer_A
move.b #$08,$fffffa19.w ; Timer-A Event count mode
and.b #$df,$fffffa0b.w ; Timer-A Interrupt pending
or.b #$20,$fffffa07.w ; Timer-A Interrupt Enable
or.b #$20,$fffffa13.w ; Timer-A Interrupt Mask A
; Play the sound1 ; Timer_A interrupt at end of sample
move.w #$401,$ffff8900.w
; Wait for the engine sound to switch to 2nd sound
; The second sound is started during the pause
Pause 200
[...]
setsound: ; Set sound begin / sound end to the DMA
clr.w $ffff8900.w ; Stop all sounds
add.l d6,d7
move.b d6,$ffff8907.w
lsr.l #8,d6
move.b d6,$ffff8905.w
lsr.l #8,d6
move.b d6,$ffff8903.w
move.b d7,$ffff8913.w
lsr.l #8,d7
move.b d7,$ffff8911.w
lsr.l #8,d7
move.b d7,$ffff890f.w
rts
intro_timer_a: movem.l d6-d7,-(sp)
move.l sound_2(pc),d6
move.l #42268,d7 ; 2nd sound end
bsr.w setsound
move.w #$003,$ffff8900.w ; Play the sound in loop mode ; No Timer_A int at end of sample
movem.l (sp)+,d6-d7
rte
|
[All messages in this thread] [Start new thread]
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|
|
|