Skip to content

[FEATURE] VIDC should trigger sound DMA events #12

@RichardBrown384

Description

@RichardBrown384

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:

  1. The emulator uses nanoseconds for time advancement notifications.
  2. 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.
  3. E.g. 250ns * 24Mhz = 6 ticks.
  4. However, (10^-9)*(10^6)=10^-3 so 250 * 24 gives us 6000 * (10^-3) milliticks = (6 ticks).
  5. 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 * N nanoseconds 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

VIDC_Clock_Frequency (Mhz) * 16 * 1000 * (VIDC_Sound_Freqency + 1) milliticks

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions