Close

Revisiting interrupts

A project log for SIDman player

A project about playing C64-era "SIDtunes" with a Teensy4, a 6502 processor and a SID (clone) chip

foxhoodFoxHood 05/16/2023 at 20:260 Comments

So based on the past two logs, i decided to revisit the Debugger and take a closer look at the C64 Schematics. To figure out the relationship of the CIA timers and the VIC-II

In the schematic i can indeed see that the IRQ input has three potential sources: The CIA1 chip, the VIC-II chip and the Expansion slot. So it would seem that the Vertical Blanking Interval is used at times as a Interrupt source.

I went into the debugger and started running a variety of SID files and note the interrupt configurations.

NAMETYPENOTES
2400ADRealSIDRaster Interrupt enabled
Amazing Discoveries
RealSIDT1B and T2A active. Raster enabled
A waste of space
RealSIDSame as Amazing Discovers
Hi Fi SkyRealSIDSame,
My Life
RealSIDSame
$11 Heaven
PlaySIDRaster Interrupt enabled
Crystal Dawn
PlaySIDRaster Interrupt enabled
Echofied 6581
RealSIDRaster Interrupt enabled, 1A,1B and 2A active.
HavenPlaySID4x, 1A configured as IRQ source (4x as fast)
Rotten Soul
PlaySID6x. 1A configured as IRQ source. (6x as fast)
Age We Aceed
PlaySID  
4x. 1A configured as IRQ source (4x as fast).

So. Turns out that during my initial looking into behaviour, i did not pay attention to the VIC-II's behaviour and just assumed everything was done via the timers. It was not. Apparantly depending on the SID file used. One can expect either:

  1. Generic PSID only use the standard Raster Interrupt.
  2. PSIDs with anomalous speed, disable Raster and instead use the CIA timer at a custom interval.
  3. RSIDs may use either or even both at their own discretion.

This complicates things a little. As it means besides the CIA timers. The VIC's Raster interrupt needs to be handled as well.

Brief look at the VIC IRQ.

In practice. Without looking to actually output video. The Raster Interrupt can be seen as another timer. Though compared to others. This timer just runs non-stop up to 0x0137 (311) with the IRQ output turned on/off as needed.

Messing with the specific raster interrupt number while it is running in a debugger does not seem to cause any odd behaviour outside of graphics shifting and no active reading of the raster value has been noted for music itself. So it does not appear to require cycle exact behaviour, Functioning mostly as a periodic interval timer whose exact timing changes depending on the video format (NTSC/PAL).

In regards of knowing which one to activate. The SID format file specifies "Default" settings for both PSID and RSID, which combined with the header can allow for accurately configuring a player in advance. Any modifications are expected to be performed by the SID file itself during initialization.


Good thing this was figured out sooner, rather than later. Could have been a major headache later on!

Discussions