KimJorgensen / KungFuFlash

Cartridge for the Commodore 64 that packs a punch
zlib License
394 stars 60 forks source link

Mega65 C64 Core, odd Phi2 values #195

Closed Kugelblitz360 closed 1 month ago

Kugelblitz360 commented 1 month ago

Good morning. The KFF is working MOSTLY, some cartridges like Super Snapshot do not. I tried the diagnostic tool and am getting odd Phi2 values which do not change when I add an offset so I guess the offset is not a 1:1 relation.

When the C64 core is in "Flicker Free Mode" (machine slowed down slightly to lock precisly on 50 Hz), Phi2 is measured at 982756. In this mode, most freezer cartridges will not come up on standard machine reset. FC3 will work after a Reset on the KFF, but has some flicker in the characters which goes away immediately when switching off Flicker Free Mode.

When the C64 core in NOT in "Flicker Free Mode" Phi2 is measured at 985218. FC3 works as it should. Super Snapshot still does not work.

What is your suggested Phi2 offset for these scenarios? Thank you!

Kugelblitz360 commented 1 month ago

Okay, a different user measured different values, but with 1.44 rather than 1.51. I will roll back and see if it makes a difference.

https://github.com/MJoergen/C64MEGA65/issues/146#issuecomment-2226261514

KimJorgensen commented 1 month ago

The Phi2 clock is generated by the C64 hardware and is not affected by the Phi2 offset in any way.

The KFF uses the Phi2 clock to know when to read the address bus, the control signals etc. Adjusting the offset will change when to read these signals.

Note that the KFF is not a precision instrument and variations between two different cartridges can be expected, see https://github.com/KimJorgensen/KungFuFlash/issues/89#issuecomment-923126640

So if the Phi2 clock is off you need to fix that in the Mega65 C64 Core

Kugelblitz360 commented 1 month ago

Yeah - issue is under discussion over there. Question is if you have a suggestion on setting the offset with the values I posted. (For reference: I am trying to troubleshoot why Super Snapshot is not working on my machine but does so on other Mega65s).

Thanks, Boris!

KimJorgensen commented 1 month ago

There is no relationship between the phi2 clock frequency and the phi2 offset a C64 may require. It is dependent on the timing requirements of the hardware in the specific C64.

Sorry but I don't own a Mega65 so I can't offer you much advise. You can try increasing or decreasing the offset by one at a time, but I don't know if adjusting the offset would even solve your problem

Kugelblitz360 commented 1 month ago

The root cause was something totally different: The combination of JaffyDOS, KFF and the Mega65 does not work properly. Switching to original JiffyDOS all problems go away.