mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-27 10:38:46 -04:00
711d22cff3
The SIO model had a single global mc_state shared between both card slots, which caused 100% probe abort rate when the BIOS alternates between slot 0 and slot 1: each new 0x81 probe on the other slot would abort the in-flight state from the previous slot. Changes: - Per-slot McSlotState saved/restored on slot switch via mc_save_slot/mc_load_slot - 0x01 (pad select) preserves card state instead of aborting it - SIO_IRQ_DELAY split into PAD (4) and CARD (8) — card delay tuned so the SIO chain walker can dispatch func_00004D6C before next idle path tick clears the protocol counter Diagnostic tooling: - I_MASK[7] trace ring buffer with bit-7 set/clear counts and caller info - Counter (0x7514) field added to SIO trace so card protocol state machine progress is visible - check_card.py inspects card directory contents Runtime evidence: mc_aborts went from 100% → 0% (when slots don't overlap). mc_max_state advanced from 1 (only MC_CMD) to 8 (MC_READ_DATA). dispatch_check confirms _new_card AND its body 0x5688 are dispatched. Detection callback (func_00005D94 at BFC15894) verified to clear v0=0 before return — continue path of func_00004D6C IS being taken (133 I_MASK[7] sets observed). Remaining: 0x7550 stays NULL despite _new_card being dispatched. Either shell passes NULL buffer or early-return path of _new_card triggers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>