17 Commits
Author SHA1 Message Date
Thomas MartinandClaude Opus 5.5 52ac66bb36 libs: Libraries::dmaStarted, a port told when the game starts a DMA channel
The I/O library completes a channel the game starts (CHCR with STR) at once: no DMA, no VIF, no GIF. A port that
needs to know what the game sent can now read the transfer there: dmaStarted(channel, its registers) is called as
the channel starts, before the library completes it; unset, nothing changes. JC2 uses it to follow the GS image
transfers in its VIF1 and GIF chains (which RAM went to which texture page), for the effects whose texture records
are their own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 16:33:52 +01:00
ArzarothandClaude Opus 5.5 72f7447704 [sc3/io-scratchpad-copy] feat(io): a scratchpad channel's start by register copies, as sceDmaSendN and sceDmaRecvN do
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 23:55:02 +01:00
ArzarothandClaude Opus 5.5 33b3480ca7 [sc3/io-siglblid] feat(io): the IPU's registers read at rest, IPU_CTRL takes stores
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 23:49:37 +01:00
ArzarothandClaude Opus 5.5 49d6ad009f [sc3/io-siglblid] feat(io): the scratchpad channels' SADR reads back
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 23:42:22 +01:00
ArzarothandClaude Opus 5.5 d157a1bacb [sc3/io-siglblid] feat(io): GS SIGLBLID takes stores with no effect
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 23:41:56 +01:00
Marc-Etienne Barrut 0f358e0226 Merge pull request #58 from TheBozos/sc3/io-observed
Acknowledge GIF and VIF status, their masks and GS IMR
2026-11-06 23:32:15 +01:00
ArzarothandClaude Opus 5.5 7505b1e5cb [sc3/io-observed] feat(io): GIF and VIF status read idle, their mode and error masks and GS IMR take stores with no effect
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 23:18:25 +01:00
ArzarothandClaude Opus 5.5 59b835ecf9 [sc3/libs] feat(dma): sceDmaGetChan, receives, scratchpad copies at the call, pause and restart
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 21:40:43 +01:00
ArzarothandClaude Opus 5.5 c0fe894d52 [sc3/kernel-syscalls] feat(io): timers 1-3 and the compare registers answered from the EE clock
Tn_COUNT is the count written last plus the periods since, as T0's already was,
with the horizontal blank as a clock source; T3 counts horizontal blanks from
boot, which is what SC3's frame-budget calibration measures T0 against. Both
share the EE clock, so the ratio it computes is the console's. Nothing counts
between reads and no timer interrupt is raised.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 20:58:56 +01:00
ArzarothandClaude Opus 5.5 14b1635a6a [sc3/kernel-syscalls] refactor(io): timer 0's state as the first of four timers
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 20:50:04 +01:00
Thomas Martin 5030dbbe43 Replace native graphics device state with SDK services 2026-11-06 12:57:31 +01:00
Thomas Martin 11cb6df323 Add reusable native image, compiled-library and port services 2026-11-06 02:47:13 +01:00
Thomas MartinandCodex 52461cf5de Finish native timing diagnostics and heat haze default
Enable the original game's heat distortion by default, retaining BOZO_HEAT_HAZE=0 for comparisons.
Measure movie cadence, correct the FMAC overflow tests, and keep temporary-context timer/checkpoint accounting
separate from the running thread. Pin recursive events at their exact recorded cycle/checkpoint when the
reference's context pc retains an inner caller. Add Windows and Linux CI for the native test suite.

Co-Authored-By: Codex <[email protected]>
2026-11-05 22:47:44 +01:00
Thomas MartinandClaude Opus 5.5 4d362485ea Native libraries from the stage runs (phase 4 M5): libmpeg's demux counts a picture read ahead from its first header (the Suburbs movie stops at 0xd000 bytes, stage-level0 #11640007); sceSifCallRpc writes the server data's packet address, reply mode and id (0) too (a level load had overwritten them, #13052622); a T0 write by the game keeps the last read, as the port's does (#13062314: read 0, wrote 0, read 0 is a poll)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 18:56:55 +01:00
Thomas MartinandClaude Opus 5.5 7e2135c6f5 Phase 4 M0: match1p --pinned matches with TMB's overrides native (16000 of 16000 frames, every record)
What match1p's overrides reached that only ran inside them before, each settled on its record:
- kernel.md 3b: a call that blocks inside an override leaves it right after the call (#16897525, the thread going on at
  its return address); a recursive call's return leaves it (#17531043, texmInit's _M_erase); where the reference's
  override left with the transfer flag is pinned at the first checkpoint at its pc once every traced call was made and,
  unless a timed call inside took a time the log lacks, at its end cycle; a timed call inside waits when its traced
  entry blocked.
- Generated code: the check after each call also leaves when ctx->leaving (a call that blocked at its own return
  address); a recursive call's return inside an override calls bozo_leave.
- VU0: a result below the smallest normal is zero without the U flag (the reference never sets U: #41542199,
  vu0MulMatrix3x3's mul; the capture samples still match).
- I/O: CPCOND0 counts completions from the last FlushCache (#17540836, hierCheckVifComplete; only with the port's
  overrides native in bozo-run); a port's own T0 write keeps the last read (#34736003); the EE time a port charges
  takes the pending poll cycles (#17538393, #17541951); a port's store patch leaves the store an out-call without its
  effect (#62516600, TMB's dialog kick).
- GS: sceGsExecStoreImage reads zeros (no GS memory; TMB's flares outside a match, frame 13736); the H formats' image
  tags (#16897863).
- The free host's watchdog (no frame for 600 fields ends the run, saying where the loop waits).

Docs: kernel.md 3b, libraries.md 5 and 11, r5900.md Q11, tools/run/README, phase4-m0-notes.md, PLAN phase 4 status.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 12:12:48 +01:00
Thomas MartinandClaude Opus 5.5 60a8d50e1f Phase 4 M0: a port's overrides run natively (bozo/port.h), the free host, the renderer's game side and the packs moved
TMB_Recomp's runtime builds on BozoEngine (its branch bozo/m0, cmake -DTMB_BOZO=ON): its overrides run natively, each
call checked against the reference's log (tmb-check), and with no log at all (tmb-headless).

- Port API (runtime/include/bozo/port.h, bozo_port): Registry::registerFunction, BOZO_PORT, the startup check that
  every registered override is an external of the generated code (port::undeclared), and what overrides use: the
  kernel (changePriority, rotateReadyQueue, transfer), the EE clock (now, accountCycles), vblankCount, the hardware
  registers (ioRead32 / ioWrite32: a port's own access), frameEnd, callLibrary, scratchpad, libraries, deterministic,
  realTime, setStorePatch. A port::Host is behind them.
- Overrides that run guest code (kernel.md section 3b): checkpoints charge, no event is taken in place; an event due,
  a call that blocks, a jump through a register, an inner call's return and a recursive call's return make guest code
  leave the override there, the stop deferred to its end (Dispatcher::beginOutcall / leave / takeDeferredStop); the
  override's own code runs on, as the reference's did; no exception goes through it. Every rule settled on a record.
- Generated code: bozo::checkpoint and bozo::innerReturn return true when guest code leaves, the check after each
  call tests ctx->leaving, a recursive call's return inside an override calls bozo_leave; ctx->outcall,
  ctx->leaving; the externals table (<prefix>_external_table); "store 0xADDR" externals (the store sets ctx->pc first).
- bozo-externals (tools/externals): the --externals list from the ELF's symbols BozoEngine answers, a port's stub names
  and its override list; --check compares the stubs with a call log's.
- bozo-run as a library (bozo_run, run_main.h): a port's checker links it with its generated code and overrides,
  which run natively (--overrides native|log); LogHost checks each call (context words, memory runs, traced calls, the
  operations and frame end inside, where it left) and pins where the reference's override left and whether a timed
  call inside it waited. The renderer's draw lists fill the record's draws (reported).
- The free host (runtime/host/free_host.cpp, bozo_host): every out-call native, libraries bound by the ELF's symbols,
  free timing, a watchdog when no frame ends.
- Moved from the team's fork code (phase4-inventory.md 2.1, MIT headers): the renderer's game side
  (bozo/render/renderer.h, renderer.cpp: headless, recording the published lists and their hash), Texture,
  the texture and mesh packs, mesh_draw, the movie picture hook, the FramePacer (unpaced off real time) and
  determinism.h (settable by the host).
- Libraries, from what only ran inside overrides before: sceGsExecLoadImage (0, no upload), T8H/T4HL/T4HH image tags as
  32-bit texels, the GS CSR's FIELD, sceSifSetDma raising SIF0's DMAC interrupt, CPCOND0 counting completions from
  the last FlushCache, a port's own register accesses, RotateThreadReadyQueue returning 0, libmpeg calling the movie
  picture hook, PadState::multitap.
- BOZO_BUILD_TOOLS (zlib-free configure for a port), the tests only when top level.

Results: TMB boot --pinned with every override native, 3000 of 3000 frames and 4,650,558 of 4,650,558 records (ram,
scratchpad, calls, threads); match1p: see docs/phase4-m0-notes.md. bozo-run without a port still matches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 11:02:09 +01:00
Thomas MartinandClaude Opus 5.5 5159769969 Native libraries: the hardware registers TMB still touches (phase 3, batch B1 3)
Every io-load and io-store of the logs answered by a model of only what the game observes (io.h, io.cpp): timer 0
(the count from EE time, a poll that reads the same count again leaves a period pending), the DMA channels (VIF0, VIF1
and GIF transfers complete at once with their D_STAT bit and DMAC interrupt; a GIF chain that draws is dropped as the
reference drops it; IPU_TO completes at the game's first store after libmpeg's decoder took it, and stops when STR is
cleared), D_CTRL, D_STAT, D_PCR (CPCOND0), D_ENABLER (0) and D_ENABLEW, and the GS's privileged registers (kept for
the renderer). The kernel's EnableDmac question (is D_STAT still set) is answered by the model.

Two points still live inside calls the logs answer whole and are followed: timer 0 restarted inside the port's frame
boundary (re-based on the log's next count), and the IPU's completion following libmpeg's nodata callbacks.

boot: 855,098 accesses native, match1p: 17,605,351, 0 divergences; both match on every frame and record.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 18:57:30 +01:00