mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 18:25:35 -04:00
b3833aa253
Root cause: the recompiler split the kernel exception handler at the jalr $s1 (chain handler dispatch) into func_00000C80 and func_00000E10. The chain-walker continuation at BFC10910 never executed — only the first handler in chain 0 was ever called. I_STAT bits 0 (VBlank) and 2 (CDROM) were never acknowledged, causing an interrupt livelock. Fixes: - Emitter jalr/jal safety-net: when the return address falls outside the current function, emit a continuation psx_dispatch call after the jalr dispatch. This bridges split functions at indirect calls. - Merged exception handler: removed BFC10910 seed so the chain walker continuation is part of func_00000C80 (C fall-through after jalr). - 0xBFC10910 dispatch special case in psx_unknown_dispatch: chain handlers return to $ra=BFC10910 via jr $ra (compiled as `return;`); the dispatch loop picks up the $ra value — handled as a no-op since the continuation already ran via C fall-through. - Post-exception adaptive cooldown: if the handler didn't clear any I_STAT bits, give main code 500 blocks before re-firing. Prevents VBlank livelock when no handler claims the interrupt. - SIO byte write handler in mmio_write8 (was missing, caused crash). - GPU→RAM DMA ch2 stub: fills target with zeros, completes transfer. - Dispatch trace (debug_server_trace_dispatch) added to emitter template so it survives regeneration. Result: shell device detection completes, StartPad dispatched, chain E014 populated, GPU actively rendering the Memory Card / CD-ROM screen. VSync counter still 0 (handler installed but not yet incrementing — next investigation). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
562 B
Python
27 lines
562 B
Python
#!/usr/bin/env python3
|
|
"""Raw TCP test for dispatch_tail."""
|
|
import socket, json, time
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
s.settimeout(5)
|
|
s.connect(('127.0.0.1', 4370))
|
|
s.sendall(b'{"cmd":"dispatch_tail","count":"8"}\n')
|
|
time.sleep(0.5)
|
|
buf = b''
|
|
while True:
|
|
try:
|
|
chunk = s.recv(65536)
|
|
if not chunk:
|
|
break
|
|
buf += chunk
|
|
if b']}\n' in buf:
|
|
break
|
|
except:
|
|
break
|
|
s.close()
|
|
print(repr(buf))
|
|
print("---")
|
|
# Find the JSON
|
|
text = buf.decode(errors='replace').strip()
|
|
print(text)
|