mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
b4b5d223e2
timers.c — timers_advance(cycles) replaces per-frame timers_tick(). Per-timer fractional accumulator + proper divisors: - Timer 0 dotclock approx (cycles/5) - Timer 1 HBlank clock (cycles/2146, ~263 HBlanks per NTSC frame) - Timer 2 SYSCLK or SYSCLK/8 per mode register bit 8..9 Target/overflow flags fire IRQ when bit 4/5 of mode is set. cdrom.c — cdrom_advance(cycles) replaces per-frame cdrom_tick(). Sector pacing from CPU clock: 451584 cycles at 1x, 225792 at 2x (SetMode bit 7). Whole-sector mode bit 5 prepends a 12-byte BCD-MSF header to the data buffer; SECTOR_BUFFER_SIZE = 12 + 2048. cdrom_trace ring: always-on CDROMTraceEntry[1<<16] capturing every register write, IRQ raise/mask, sector load, and command dispatch with the current func/PC/frame snapshot. Query via the new debug_server commands landed in a later commit. psx_cycles.c — psx_advance_cycles now drives cdrom_advance and timers_advance in addition to sio_advance. interrupts.c — legacy per-frame timers_tick + cdrom_tick now gated behind #ifndef PSX_ENABLE_BLOCK_CYCLES, so block-cycle builds use the cycle-paced path exclusively. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>