Warning: There are flashing images below, do not scroll down if you are sensitive to them!
According to various sources (for example this for the Plus/4), both the C64 and Plus/4 have a "jiffy" clock, which ticks approximately every 1/60 sec. However, when I tried to use the jiffy clock in code, I found it strangely correlated with the screen refresh on Plus/4. Take this ASM example in CA65 dialect, which changes the border color on every jiffy change (then changes it back after a short while):
.ifdef __C64__ border_color = $d020 jiffy_lsb = $a2 ; Jiffy clock LSB .endif .ifdef __PLUS4__ border_color = $ff19 jiffy_lsb = $a5 ; Jiffy clock LSB .endif loop: lda jiffy_lsb wait4jiffy: cmp jiffy_lsb beq wait4jiffy inc border_color ldx #$ff simulate_workload: dex bne simulate_workload dec border_color jmp loop
I tested this in the VICE emulator. On a PAL C64, the placement of the colored range changes erratically (as expected), because the jiffy clock is 60Hz and the PAL screen refresh is 50Hz. The following screen recording is slowed down to reduce flashing and to make the pattern more visible:
On an NTSC C64, the colored bar moves slowly and fluently (as expected), because the jiffy clock and the NTSC screen refresh are both around 60Hz, but are not exactly the same. The following screen recording is approximately real speed:
However, on a Plus/4, regardless of PAL/NTSC, the colored bar is completely stationary (apart from a tiny jitter). The following screen recordings are approximately real speed:
How is this possible?
- Did I overlook something?
- Is this a bug in the VICE emulator?
- Is the jiffy clock tied to the screen refresh in the Plus/4 (making it 50Hz in the PAL model instead of the stated 60Hz)?