terriblefire wrote: ↑Fri Dec 27, 2024 4:09 pm
I think you just write a "stuff has changed" flag during the interrupt cycle and then leave it until the cycle is over. Then build a mixed buffer of all the channels... its fine if it gets interrupted while this happens. The new mixed buffer should be double buffered so its only switched in once its built the next time the dma says it needs more data. I dont think a timer is the right approach? surely the DAC has a "fifo getting close to empty" type signal.
Dirty Flag will be much easier to implement that checking what has changed by comparison. I won't need copy register values multiple times over.Dirty flags will just trigger recalculating each channel. It will look at each Channel frequency and volume. Then it will trigger recalculate / merging all channels to output buffer.
Those DACs are really dumb, those have couple of registers only Control Register and data hold registers. There are features to synchronize how often data from hold registers are copied to proper out register (read only), but this is how far as this goes. What you mentioned can be achieved by setting up DMA to peripheral feature. But for this I have to set up rate how often data is being fed to DAC data hold register. This rate can be controlled by timer, software or external line (EXTI interrupt). At least it is my current understanding of this piece of hardware. Never used it beyond generating few basic outputs (always controlled by CPU )
My understating is if I will create buffer of the size of original SCC wavetable (or expand it proportionally ) and will deliver it to DAC at the same (or proportional) rate then I will get similar effect. This way I hope frequency on SCC register should have the same outcome on my device. Volume should be easier to implement.
Action plan (1 Channel + 1 Frequency control)
- Set up DAC/DMA/TIM and buffer as example from the producer website.
- Set up SCC mapper to read and write values to temp memory location.
- Set up dirty flags to check what changes on SCC register writes (frequency/ volume / wavetable data).
- Implement flag handling methods.
- Set up MSX software to provide very simple setup for easier debug.
- listen to weird noise a lot
Arek
Do not trust people. They are capable of greatness.
~ Stanislaw Lem