CIA ICR bug when switching serial port direction
C64/Amiga emulator with shader and runAhead
Brought to you by:
piciji
See new test added here: https://sourceforge.net/p/vice-emu/bugs/1219/?page=3#5c25
The new test passes in Denise if the following is added as the very first statement in cia/base.cpp:Base::switchSerialDirection
if ((sdrShiftCount > 1 && sdrShiftCount < 15) ||
(sdrShiftCount == 15 && !(delay & CIA_CNT2)) {
events.add( &finishSdr, 2, Emulator::SystemTimer::Action::UpdateExisting );
}
Based on the tests run on real hardware with both old and new CIA chips in the thread above, I suggest to correct the code following the code above in cia/base.cpp:Base::switchSerialDirection as follows (currently Denise fails several cia-sdr-icr tests for -cia-6526):
if (input) {
if (0 /* This code path is for the outlier CIA chips marked 6526 4485 */)
sdrForceFinish = (delay & CIA_CNT) != CIA_CNT;
else
sdrForceFinish = (delay & CIA_CNT_NEW) != CIA_CNT_NEW;
Anonymous
Thank you, that works well and I've added it.
I just noticed that the testbench has been changed so that "4485" is no longer set as the default for old CIA serial direction change tests.
I think that's good, since "4485" is the exception.
A few years ago, I considered offering a third CIA option for 4485 in the UI. But I guess it's not worth the effort.
Thanks, I've adjusted that as well.