Closed Yazwh0 closed 1 year ago
Yeah, looking at a datasheet for the 6522, I'm not sure why Box16 implementation only respects bits 0 and 3, and then only under certain circumstances regarding the PCR.
Reading was appears to be a datasheet for an original C64's 6522, I think the idea comes from a table that only lists means of clearing IRQ flags by interacting with the chip subcomponent that fired the IRQ:
This interpretation is supported by the documentation created by the person who wrote the current VIA implementation: https://ayce.dev/emptyx16.html#dh---ifr---interrupt-flags-register-rw
This datasheet for the Rockwell 6522, however, specifically documents the ability to clear bits directly on the IFR register:
And certainly, MAME's implementation appears to be the Rockwell interpretation. Your screencap also suggests the Rockwell version.
So yeah, talking with the guy who implemented it, sounds like the implementation may be a misinterpretation of the docs.
@Yazwh0 Just to be clear: The photo of the expected behavior is real hardware, right? Do you know the specific model of 6522 that's using? Or does it come from an official prototype board?
When writing to IFR, it should clear any bits that are set in the write. (bar bit 7, which should be preserved)
This disables VIA interrupts, and then should clear the bits.
10 poke $9f0e, $7f 20 a=peek($9f0d) 30 print a 40 poke $9f0d, a 50 print peek($9f0d)
expected:
Emulator: