mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 18:25:35 -04:00
2767018b46
Root cause: BIOS pad handler polls I_STAT bit 7 waiting for SIO ACK IRQ. sio_tick() was only called from psx_check_interrupts and SIO register accesses, but I_STAT reads go through memory.c which never called sio_tick(). The IRQ countdown was stuck during the polling loop, causing the BIOS to time out and report "no pad found" (0xFF). Additionally, sio_tick() in psx_check_interrupts fired the IRQ too early — during BIOS delay loops BEFORE I_STAT bit 7 was cleared — so the BIOS cleared it and never saw it re-appear. Fixes: - memory.c: Call sio_tick() on I_STAT reads (32/16/8-bit paths) - interrupts.c: Remove sio_tick() from psx_check_interrupts - debug_server.c: Don't clear input override on TCP disconnect (was wiping override before next VBlank could read it) - debug_server.c: sio_state reports real pad_buttons via getter - sio.c/sio.h: Add sio_get_pad_buttons() for debug server - seeds: Add 20 new seeds for shell input and CARD driver functions Result: Pad buffer at 0x80083E30 shows status=0x00 (pad found), type=0x41 (digital), buttons reflect keyboard/override state. Only 5 COP2/GTE dispatch misses remain (Phase 5). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
40 lines
1.0 KiB
C
40 lines
1.0 KiB
C
#ifndef PSXRECOMP_V4_SIO_H
|
|
#define PSXRECOMP_V4_SIO_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* SIO0 register base: 0x1F801040 */
|
|
#define SIO_BASE 0x1F801040
|
|
|
|
void sio_init(void);
|
|
|
|
/* MMIO read/write (0x1F801040-0x1F80104E) */
|
|
uint32_t sio_read(uint32_t addr);
|
|
void sio_write(uint32_t addr, uint32_t value);
|
|
|
|
/* Advance SIO timing by one step. Called from psx_check_interrupts().
|
|
* Fires pending IRQ7 after the transfer delay expires. */
|
|
void sio_tick(void);
|
|
|
|
/* Update pad button state. Buttons use PS1 convention: 0=pressed, 1=released.
|
|
Bit layout: SELECT, L3, R3, START, UP, RIGHT, DOWN, LEFT,
|
|
L2, R2, L1, R1, TRIANGLE, CIRCLE, CROSS, SQUARE */
|
|
void sio_set_pad_state(uint16_t buttons);
|
|
|
|
/* Connect a pad to a slot (0=port1, 1=port2). By default no pads are
|
|
* connected during initial BIOS boot. */
|
|
void sio_connect_pad(int slot);
|
|
|
|
/* Return current pad button state (for debug server). */
|
|
uint16_t sio_get_pad_buttons(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PSXRECOMP_V4_SIO_H */
|