Menu

#126 CIA ICR bug when switching serial port direction

closed
PiCiJi
None
C64
Linux
2026-03-07
2026-01-18
Dag Lem
No

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;

Discussion

  • PiCiJi

    PiCiJi - 2026-01-18
    if ((sdrShiftCount > 1 && sdrShiftCount < 15) ||
        (sdrShiftCount == 15 && !(delay & CIA_CNT2)) {
        events.add( &finishSdr, 2, Emulator::SystemTimer::Action::UpdateExisting );
    }
    

    Thank you, that works well and I've added it.

     if (0 /* This code path is for the outlier CIA chips marked 6526 4485 */)
    

    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.

     
    👍
    1
  • PiCiJi

    PiCiJi - 2026-03-07
    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB