commanderx16 / x16-rom

Other
153 stars 44 forks source link

What's our VIA & Timer story #265

Open mist64 opened 2 years ago

mist64 commented 2 years ago

Currently, we do this:

akumanatt commented 2 years ago

From the current VERA's source, it doesn't have PAL composite mode. But it does have different VBlank frequency between interlaced and progressive modes due to different dots per line count, for some reason.

Excerpt from my docs:

Progressive Line Rate   31.25000kHz (25MHz/800)
Interlaced Line Rate    15.74307kHz (25MHz/(794*2))
Progressive Frame Rate  59.523810Hz (25MHz/(525*800))
Interlaced Frame Rate   29.986805Hz (25MHz/(525*794*2))

Also, YM2151 its own timer IRQs but it's not useful here since it's too slow to be read at 8 MHz.

I think the solution here is to use VIA 1 Timer 1 for 122.06 Hz IRQ (as that's the maximum period at 8 MHz) or 240Hz, the counting range would still be enough for PRNG seed anyway.

mist64 commented 2 years ago

VIA 1 Timers are no good for the 60 Hz interrupt, because VIA 1 can only do NMIs, and the 60 Hz interrupt should be maskable. The serial code relies on this, for example.

akumanatt commented 2 years ago

I see, so there's no other choice but to use VIA 2

mist64 commented 2 years ago

I'm leaning towards leaving it as is. We have a real RTC, so the wall clock (TI$) will always be accurate. It's just the 24bit 60Hz counter that will drift a little when in composite mode, which is okay.

mooinglemur commented 1 year ago

VIA1 now uses IRQ