Is your feature request related to a problem? Please describe.
The VIDC should trigger sound DMA events to simulate proper machine behaviour.
Describe the solution you'd like
The VIDC should trigger sound DMA events at appropriate intervals.
Describe alternatives you've considered
None
Additional context
The VIDC is clocked at 24Mhz giving a VIDC tick time of 41.666ns.
Given:
The emulator uses nanoseconds for time advancement notifications.
The basic recipe is to take a chip's clock frequency and multiply it by the amount of time that has passed to give us
the number of ticks that have passed.
E.g. 250ns * 24Mhz = 6 ticks.
However, (10^-9)(10^6)=10^-3 so 250 24 gives us 6000 * (10^-3) milliticks = (6 ticks).
So by "dropping" the units we can get an 'accuracy' to 1000ths of a tick by just using simple integer arithmetic.
Then:
The VTI documentation doesn't say that much about sound DMA timing.
If you want a sample period of N microseconds you should write N-1 to the sound frequency register.
The Sound FIFO is 16-bytes and one presumes that all samples are 8-bit (see the 255µlaw description in the manual) and therefore it takes:
16 * N microseconds to drain the buffer or,
16 * 1000 * Nnanoseconds to drain the buffer
Then using the calculation from above gives
VIDC_Clock_Frequency (Mhz) * 16 * 1000 * N milliticks
between sound DMA requests.
Since VIDC_Sound_Frequency = N - 1 => N = VIDC_Sound_Freqency + 1 the period in ticks is then
Is your feature request related to a problem? Please describe. The VIDC should trigger sound DMA events to simulate proper machine behaviour.
Describe the solution you'd like The VIDC should trigger sound DMA events at appropriate intervals.
Describe alternatives you've considered None
Additional context The VIDC is clocked at 24Mhz giving a VIDC tick time of 41.666ns.
Given:
Then: The VTI documentation doesn't say that much about sound DMA timing.
If you want a sample period of N microseconds you should write N-1 to the sound frequency register.
The Sound FIFO is 16-bytes and one presumes that all samples are 8-bit (see the 255µlaw description in the manual) and therefore it takes:
16 * N
microseconds to drain the buffer or,16 * 1000 * N
nanoseconds to drain the bufferThen using the calculation from above gives
between sound DMA requests.
Since
VIDC_Sound_Frequency = N - 1
=> N =VIDC_Sound_Freqency + 1
the period in ticks is then