STe DMA Sound interrupts

All 680x0 related coding posts in this section please.

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

nanard
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 110
Joined: Mon Apr 04, 2016 2:11 pm

STe DMA Sound interrupts

Postby nanard » Sat Apr 16, 2016 10:49 pm

I've made a small sound player for STe https://github.com/miniupnp/AtariST/tree/master/steauply
That's my 1st 68k asm code :wink:
It is currently using a looping double-buffer and polling the dma registers $FFFF8909 / FFFF890B / FFFF890D to know when to refill it.

I want to improve by using interrupts to avoid the polling.
I experimented a bit, but it looks like I'm missing something about MFP interrupts on the ST. I guess I should acknowledge the interrupt, but I don't know how.

Code: Select all

   ; MFP interrupt
   pea       dmasoundcomplete   ; vector
   move.w    #15,-(sp)      ; Mono monitor detect / DMA sound complete
   move.w    #13,-(sp)      ; Mfpint
   trap      #14         ; Call XBIOS
   addq.l    #8,sp

   move.w   #15,-(sp)   ; Mono monitor detect / DMA sound complete
   move.w    #27,-(sp)      ; Jenabint
   trap      #14         ; Call XBIOS
   addq.l    #4,sp
...
dmasoundcomplete:
   move.w   #$0F0B,$FFFF8240   ; RED / purple
   rte


From what I see the interupt is called once, but then keyboard input doesn't work anymore.

I also read somewhere that DMA sound also triggers timer A interrupt. Is that when sample buffer is complete or for every sample ? It isn't very clear how both INT are working with DMA sound.
http://atari-ste.anvil-soft.com/html/devdocu4.htm
4MB STE + CosmosEx /|\ MegaST4 + MegaFile 44

User avatar
Cyprian
Atari God
Atari God
Posts: 1405
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: STe DMA Sound interrupts

Postby Cyprian » Sun Apr 17, 2016 9:39 am

below code is needed when you use TOS compatible MFP interrupts:
Timer A:

Code: Select all

bclr    #5,$FFFFFA0F.w      ; Interrupt In-service A - Timer A done


Mono:

Code: Select all

bclr    #7,$FFFFFA0F.w      ; Interrupt In-service A - Mono done


put it before RTE instruction.
Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Aranym / Steem / Saint
http://260ste.appspot.com/

nanard
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 110
Joined: Mon Apr 04, 2016 2:11 pm

Re: STe DMA Sound interrupts

Postby nanard » Sun Apr 17, 2016 9:36 pm

thank you, that is exactly what I need !
From what I see only Mono detect interrupt is triggered.

edit:
Ok, I've seen there are infos in The atari-compendium :
http://www.yardley.cc/atari/compendium/ ... .htm#sound
Xbtimer() is the right way to set Timer A
4MB STE + CosmosEx /|\ MegaST4 + MegaFile 44

User avatar
Foxie
Atariator
Atariator
Posts: 24
Joined: Wed Feb 03, 2016 7:12 pm

Re: STe DMA Sound interrupts

Postby Foxie » Mon Apr 18, 2016 11:29 pm

Not sure if this is helpful, but you might not need to use DMA sound interrupts at all. In fact in some cases you definitely don't want to use DMA sound interrupts (such as if you want stable rasters or sync-locked code).

Instead, you can poll the playback position in the VBL interrupt. Typically something like 501 samples elapse between VBLs at 50Hz, but by measuring how much the playback position has moved since the last VBL, you can effectively support any frame rate (NTSC / mono systems).

The advantage with using the VBL is that you can be sure there are no interrupts triggering during the active-scan portion of the display - which is usually the most time-critical part of the video cycle.

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 953
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: STe DMA Sound interrupts

Postby FedePede04 » Sat Oct 14, 2017 9:19 pm

Cyprian wrote:below code is needed when you use TOS compatible MFP interrupts:
Timer A:

Code: Select all

bclr    #5,$FFFFFA0F.w      ; Interrupt In-service A - Timer A done


Mono:

Code: Select all

bclr    #7,$FFFFFA0F.w      ; Interrupt In-service A - Mono done


put it before RTE instruction.


hi friend could you please explain what the "Mono done" means.. does it trigger an interrupt?
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 953
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: STe DMA Sound interrupts

Postby FedePede04 » Sat Oct 14, 2017 10:30 pm

FedePede04 wrote:
Cyprian wrote:below code is needed when you use TOS compatible MFP interrupts:
Timer A:

Code: Select all

bclr    #5,$FFFFFA0F.w      ; Interrupt In-service A - Timer A done


Mono:

Code: Select all

bclr    #7,$FFFFFA0F.w      ; Interrupt In-service A - Mono done


put it before RTE instruction.


hi friend could you please explain what the "Mono done" means.. does it trigger an interrupt?



ok that was hard, i have been breaking for the last hour :lol:
this was exactly what i need, so many thx, i owe you one :cheers:
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 3 guests