MEGA65 / mega65-core

MEGA65 FPGA core
Other
245 stars 88 forks source link

CIA Oneshot timer handled incorrectly #821

Closed lydon42 closed 3 months ago

lydon42 commented 3 months ago

It seems that in oneshot mode the timer is not reset to the latched value but stays at ffff.

AmokPhaze101 found this: that's what should indeed happen according to Magic Disk 64 CIA course : Bit3 (ONE-SHOT/CONTINOUS)

@gurcei is working on it already in cia_oneshot branch (see discord).

lydon42 commented 3 months ago

Note to myself: squash merge the branch so the issue tag can be added.

Rhialto commented 3 months ago

My proposal would again be: copy as much as possible from the C64 core, which is known to be pretty good.

What makes this less than 100% trivial is the fact that apparently register access happens here at full speed while at least the timers run at original ~1 MHz speed (which is bound to produce a difference in behaviour), and the extra hypervisor-only registers.

I looked at doing it myself and had both versions in editors next to each other, but unfortunately the C64 version is Verlilog, not VHDL, and it's structured differently. If I had more VHDL experience I would be more likely to "see through" these difference, but I don't.

gurcei commented 3 months ago

I probably won't have the appetite (or the skillset as yet) to port verilog to vhdl, still have a lot to learn in both, but if there are others out there that want to do such a port across from c64-core, it's fine by me.

Till then, I'm content with any little wins we can have by addressing little issues like this as we find them.

gurcei commented 3 months ago

I tried testing various programs on the intro disks to see if my cia-oneshot fix broke anything. I tried a few demos, games and tools, seems to behave ok, I reckon it's fine to merge in.

lydon42 commented 3 months ago

merged cia_oneshot branch.