Timer B + DMA at once

GFA, ASM, STOS, ...

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

mikro
Hardware Guru
Hardware Guru
Posts: 2034
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Timer B + DMA at once

Postby mikro » Sat Aug 17, 2019 2:26 pm

I'm posting this out of a total despair. :) My idea about DMA (sample playback for instance) has been the following: it does its job independently from the CPU, if DMA is active, CPU has to wait. That seems pretty straightforward.

However now I have Timer B interrupts all over the place, how does this work together? I would imagine that DMA takes higher priority, i.e. if CPU triggers an interrupt and has to fetch its instruction / data words, it is halted. What is something I seem to be experiencing - Timer B interrupts changing colours and video base address get visual artefacts and jumping lines occasionally. As I'm not using Timer A or anything else (I even killed Timer C/D and all the other interrupts), I can't imagine any other source of interference. Especially because when the sample playback stops, the artefacts are gone, too.

Now... how on earth do all those fullscreen effects for the STE work then? DHS uses sample streaming all the time and their demo screens are super solid and awesome. How one can achieve this? I have thought that one cannot "override" the DMA?

evil
Captain Atari
Captain Atari
Posts: 184
Joined: Sun Nov 12, 2006 8:03 pm

Re: Timer B + DMA at once

Postby evil » Sat Aug 17, 2019 2:56 pm

DHS fullscreen demos doesn't load while in hardsync, they refill buffers between screens.
Also from experience playing YM samples on MFP interrupt and doing ACSI DMA loads can disturb the sample interrupt to audible levels, so I'm not surprised to hear that Timer B HBL events are not perfectly stable.

There are ways around it, as proven by ppera and cyg's video player (https://demozoo.org/productions/112682/). It does come with drawbacks as the data must be within the first gig of the drive and it uses it's own internal harddisk driver. Not something I would like to run from my main harddrive. I guess they manage to control the DMA to run before and after the spec512 scanlines.

mikro
Hardware Guru
Hardware Guru
Posts: 2034
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Timer B + DMA at once

Postby mikro » Sat Aug 17, 2019 3:09 pm

Ah, now I see I should have been more specific - I'm talking purely about DMA playback, no disk access at all.

So you're saying that as soon as you load your sample buffer during VBL, you don't have to care about anything else, you just let it play and do whatever you want in Timer B handlers?

User avatar
Arne
Atari Super Hero
Atari Super Hero
Posts: 529
Joined: Thu Nov 01, 2007 10:01 am

Re: Timer B + DMA at once

Postby Arne » Sat Aug 17, 2019 3:19 pm

Mikro, you've got a quite interesting inventory of questions regarding computer architecture :D I love them :mrgreen:

Anyway... if I'm not totally mistaken and understand your question correctly then you are wondering how a timely IRQ can be handled while DMA is hogging the bus?
If so: does DMA Sound have a FIFO? Might it be the case that the ISR is short enough that the DMA can play from FIFO while ISR's code is executed. So when ISR is finished DMA takes over again refilling the FIFO? Just an idea...
Image

mikro
Hardware Guru
Hardware Guru
Posts: 2034
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Timer B + DMA at once

Postby mikro » Sat Aug 17, 2019 3:29 pm

Arne: you have understood it correctly. I'm pretty sure the SDMA does have some kind of buffer, yes.

However it's entirely possible that the behaviour / hardware implementation has changed between STE and Falcon - because yes, I'm seeing this artefacts on Falcon and if this is the case, i.e. that it works flawlessly on STE and not on Falcon, then I'm pretty much f***ed, because I have to cripple my precious "fullscreen" effect back to 256px width (for which it worked better).

User avatar
Arne
Atari Super Hero
Atari Super Hero
Posts: 529
Joined: Thu Nov 01, 2007 10:01 am

Re: Timer B + DMA at once

Postby Arne » Sat Aug 17, 2019 3:35 pm

F030's DMA sound is not that compatible with STE (TT). IIRC one sampling frequency is not supported on the F030 which lacks the LMC1992 anyway. So DMA Sound might be compatible seen from the application programmers view but not the system programmer.
But I never delved into F030 DMA Sound anyway.
Regarding FIFO: I was thinking of the LMC1992 as you did not specifically mentioned the Falcon in your first post. I think I read somewhere that the LMC does have an 8 (?) Octet FIFO.

Besides: can the 68000 force a DMA transfer to be interrupted via BR/BG/BGACK to get control over the bus again?
Image

ijor
Hardware Guru
Hardware Guru
Posts: 3814
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: Timer B + DMA at once

Postby ijor » Sat Aug 17, 2019 3:52 pm

STe sound DMA (as opposed to Blitter DMA, or to ACSI DMA) is completely transparent and non intrusive. It works the same as screen Shifter DMA. It doesn't affect and doesn't steal any CPU cycles at all.
Fx Cast: Atari St cycle accurate fpga core

slingshot
Atari God
Atari God
Posts: 1257
Joined: Mon Aug 06, 2018 3:05 pm

Re: Timer B + DMA at once

Postby slingshot » Sat Aug 17, 2019 3:56 pm

Do you think about STe DMA sound? That uses the shifter RAM cycle during DE off, and doesn't interact the CPU any way. Disk and blitter DMA which grabs the CPU bus, and halts the 68000.

mikro
Hardware Guru
Hardware Guru
Posts: 2034
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Timer B + DMA at once

Postby mikro » Sat Aug 17, 2019 3:57 pm

Oh-oh. In that case Falcon must work a bit differently although I can't imagine how or why.

slingshot
Atari God
Atari God
Posts: 1257
Joined: Mon Aug 06, 2018 3:05 pm

Re: Timer B + DMA at once

Postby slingshot » Sat Aug 17, 2019 4:01 pm

I'm not familiar with the Falcon, but AFAIK the Shifter (or Videl) can steal cycles from the CPU there.

ijor
Hardware Guru
Hardware Guru
Posts: 3814
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: Timer B + DMA at once

Postby ijor » Sat Aug 17, 2019 4:07 pm

slingshot wrote:I'm not familiar with the Falcon, but AFAIK the Shifter (or Videl) can steal cycles from the CPU there.


No idea with the Falcon/Videl either, but Shifter doesn't steal any CPU cycles. It is MMU which might steal CPU cycles if the CPU attempt a bus access at a slot that it's not its own. But this MMU slot enforcement happens regardless if the slot is actually needed by video or sound DMA.

In other words, enabling sound DMA doesn't steal any cycles. If some cycles are stolen from the CPU, it will happen with or without sound DMA.
Fx Cast: Atari St cycle accurate fpga core

mikro
Hardware Guru
Hardware Guru
Posts: 2034
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Timer B + DMA at once

Postby mikro » Sat Aug 17, 2019 4:12 pm

ijor, now I wish you had time to study Falcon ICs in a similar depth as you did with ST ICs. ;-)

But that at least confirms something, i.e. that one shouldn't expect any additional work on STE when samples are played. Now the funny thing will be to investigate what is happening on Falcon.

Isn't coding with strict deadlines and already delayed release date fun? ;-)

czietz
Hardware Guru
Hardware Guru
Posts: 1012
Joined: Tue May 24, 2016 6:47 pm

Re: Timer B + DMA at once

Postby czietz » Sat Aug 17, 2019 4:32 pm

Prefix: The Falcon is the one Atari that I do not own. Thus, I'm not fully familiar with it. (Also, if I had one I would simply test my theories by measuring the signals on the bus.)

But as you surely know better than me, sound DMA is handled differently in the Falcon than in the STE. As ijor and slingshot already explained -- in the STE sound samples are transferred in separate bus cycles that the CPU does not use anyway (therefore the CPU is not slowed down by sound DMA). In the Falcon, the DMA chip also takes care of backwards-compatible sound DMA. It does in fact use bus arbitration and can thus block the CPU from accessing the bus. I don't know how long the bursts are where the DMA reads sound data.

evil
Captain Atari
Captain Atari
Posts: 184
Joined: Sun Nov 12, 2006 8:03 pm

Re: Timer B + DMA at once

Postby evil » Sat Aug 17, 2019 4:38 pm

mikro wrote:Ah, now I see I should have been more specific - I'm talking purely about DMA playback, no disk access at all.

So you're saying that as soon as you load your sample buffer during VBL, you don't have to care about anything else, you just let it play and do whatever you want in Timer B handlers?


Late to the party, but yes that's how it is. I know there were talks before that if you play at maximum rate (50 kHz stereo) if could affect very far right pixels in overscan. But I've not seen that myself and I doubt it.

About the Falcon, to my knowledge it's the SDMA chip that handles the audio DMA not the Videl. The Falcon audio DMA is a lot more demanding than the STe/TT as well, from about 98kB/s to 1536kB/s (that's eight 49170 Hz 16-bit channels in and out simultaneously).

Timer-B effects on Falcon are few due to obvious problems with short borders and fast horizontal refresh on VGA screens and the infamous Videl "snow" bug. Could it be that the demos which do use Timer B HBL effects are using modplayers on DSP that outputs directly to DAC without DMA?

mikro
Hardware Guru
Hardware Guru
Posts: 2034
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Timer B + DMA at once

Postby mikro » Sat Aug 17, 2019 4:43 pm

czietz: since you are far more versed in hardware in general than I am, I have no reason to doubt your explanation. I sounds very plausible.

So Atari not only made the Videl with many bugs but they also botched the nice SDMA concept from its predecessor, great.

evil: the incredible irony is that I have overcome those bugs, the snow, everything. I really have a fullscreen effect up and working, yes, even on VGA. Up until the point I have enabled sound... :)

As one of the options I'm also thinking of using the DSP for this task (can you imagine... using DSP... for copying samples) but this is just... argh.

mikro
Hardware Guru
Hardware Guru
Posts: 2034
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Timer B + DMA at once

Postby mikro » Sat Aug 17, 2019 7:03 pm

czietz wrote:In the Falcon, the DMA chip also takes care of backwards-compatible sound DMA. It does in fact use bus arbitration and can thus block the CPU from accessing the bus.

Christian, yet once again you have shown how greatly you understand hardware schematics, even for devices which you have never used. :-) Rodolphe Czuba has confirmed this - the SDMA is indeed a standalone IC, with bus arbitration and all. No special treatment as in the case of STE. :-(

User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 1734
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: Timer B + DMA at once

Postby Cyprian » Sat Aug 17, 2019 7:18 pm

mikro wrote:
czietz wrote:In the Falcon, the DMA chip also takes care of backwards-compatible sound DMA. It does in fact use bus arbitration and can thus block the CPU from accessing the bus.

Christian, yet once again you have shown how greatly you understand hardware schematics, even for devices which you have never used. :-) Rodolphe Czuba has confirmed this - the SDMA is indeed a standalone IC, with bus arbitration and all. No special treatment as in the case of STE. :-(


just to summarize.
The ST/TT series use a different memory access scheme than the Falcon.
In ST/TT memory access slots are split into even and odd cycles. Even - used by the CPU, the BLiTTER (ST only) and HDD/FDD drive DMA, and odd - used by MMU (Shifter and Sound DMA) and memory refresh. It means there is no way to disturb CPU code by the video mode or DMA sound. But the BLiTTER (ST only) and HDD/FDD drive DMA can delay the CPU code.
In case of Falcon, all memory access slots are shared between all devices: CPU, Videl, the BLiTTER, Sound DMA, HDD/FDD drive DMA and memory refresh.
Lynx II / Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/

User avatar
leonard
Moderator
Moderator
Posts: 658
Joined: Thu May 23, 2002 10:48 pm
Contact:

Re: Timer B + DMA at once

Postby leonard » Sat Aug 24, 2019 1:38 pm

I confirm the STE DMA sounnd playback does not take any cycle to the CPU or video decoding. The "We Were @" rely on that to display fullscreen effects with sampled music ( the sampled "free" playing sound is one of the great STE feature :) )
Leonard/OXYGENE.


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 4 guests