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.
|2400AD||RealSID||Raster Interrupt enabled|
|Amazing Discoveries||RealSID||T1B and T2A active. Raster enabled|
|A waste of space||RealSID||Same as Amazing Discovers|
|Hi Fi Sky||RealSID||Same,|
|$11 Heaven||PlaySID||Raster Interrupt enabled|
|Crystal Dawn||PlaySID||Raster Interrupt enabled|
|Echofied 6581||RealSID||Raster Interrupt enabled, 1A,1B and 2A active.|
|Haven||PlaySID||4x, 1A configured as IRQ source (4x as fast)|
|Rotten Soul||PlaySID||6x. 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:
- Generic PSID only use the standard Raster Interrupt.
- PSIDs with anomalous speed, disable Raster and instead use the CIA timer at a custom interval.
- 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!