RAM-execution trace and inventory; route narshe_to_world_map (refs #8) #23

Merged
Gatchan merged 6 commits from ram-exec into main 2026-10-29 16:47:09 +00:00
Owner

Inventory of the code FF6 executes from RAM, measured with a trace built into the core, on a route library that now reaches the first world map. US v1.0 and JP v1.0.

Changes

  • RAM-execution trace in the debug API (ff6_debug_ram_trace_*, core/port/ram_trace.c), fed by the single instruction-hook dispatcher of core/port/port.c (ports first, then the trace). Exposed as ff6cli --trace-ram <tsv> and the drive-server trace start|stop|write. Usage and format: docs/ram_trace.md.
  • tools/ram_trace_report.py: merges addresses into ranges, resolves them with the .dbg of the version, exits 3 when code ran outside the RAM map [[code]] images.
  • RAM map: route variables for the Narshe escape (targetable monsters, max HP, Magitek cursor, world brightness, event flags, world_party_pixel). ram_map_check 0 errors.
  • New route narshe_to_world_map (mines, Whelk, Arvis, Terra's flight, moogle defence, first world map with the player in control), with FieldGrid navigation from tile properties. Movies US/JP and ctests route/movie/route_ports_on.

Measured (committed movies, from power-on)

Route Frames US / JP NMIs via $1500 US / JP IRQs via $1504 US / JP
title_to_first_battle_win 10 253 / - 9 458 / - 7 670 / -
field_menu_tour 10 897 / 10 202 10 008 / 9 315 7 702 / 7 326
narshe_to_world_map 79 761 / 80 670 75 687 / 76 477 37 224 / 35 474
Mode NMI US / JP IRQ US / JP
Field FieldNMI $C0:0182 / same FieldIRQ $C0:0262 / same
Title, opening CutsceneNMI $7E:7233 / $7E:71BF (RAM) not entered
Battle BattleNMI $C1:0BA7 / $C1:0B8A not entered
Menu (field menu, name entry) MenuNMI $C3:1387 / $C3:13F2 not entered
World map, walking WorldNMI $EE:A728 / $EE:A71F WorldIRQ $EE:A93A / $EE:A931

RAM code executed: only the trampolines $00:1500/$1504 and the cutscene program ($7E:5000-7B42 US, $7E:5000-7AE4 JP). 0 unexpected addresses in every mode reached, so no finding.

Out of reach (The End, ending, World of Ruin cutscene, vehicles and their raster IRQs, the battle-exit rtl): #22, which proposes late-game start points (route-produced SRAM or an SRAM synthesiser).

Validation

  • Builds without warnings: debug, clang, mingw (--no-test); release --fast: 13/13.
  • ctest -L slow (release): 21/21 passed, including route/movie/route_ports_on of narshe_to_world_map on US and JP (about 15 min each).

Refs #8 (the remaining part is in #22)

🤖 Generated with Claude Code

Inventory of the code FF6 executes from RAM, measured with a trace built into the core, on a route library that now reaches the first world map. US v1.0 and JP v1.0. ## Changes - **RAM-execution trace** in the debug API (`ff6_debug_ram_trace_*`, `core/port/ram_trace.c`), fed by the single instruction-hook dispatcher of `core/port/port.c` (ports first, then the trace). Exposed as `ff6cli --trace-ram <tsv>` and the drive-server `trace start|stop|write`. Usage and format: `docs/ram_trace.md`. - `tools/ram_trace_report.py`: merges addresses into ranges, resolves them with the `.dbg` of the version, exits 3 when code ran outside the RAM map `[[code]]` images. - RAM map: route variables for the Narshe escape (targetable monsters, max HP, Magitek cursor, world brightness, event flags, `world_party_pixel`). `ram_map_check` 0 errors. - New route **`narshe_to_world_map`** (mines, Whelk, Arvis, Terra's flight, moogle defence, first world map with the player in control), with `FieldGrid` navigation from tile properties. Movies US/JP and ctests `route`/`movie`/`route_ports_on`. ## Measured (committed movies, from power-on) | Route | Frames US / JP | NMIs via `$1500` US / JP | IRQs via `$1504` US / JP | |---|---|---|---| | title_to_first_battle_win | 10 253 / - | 9 458 / - | 7 670 / - | | field_menu_tour | 10 897 / 10 202 | 10 008 / 9 315 | 7 702 / 7 326 | | narshe_to_world_map | 79 761 / 80 670 | 75 687 / 76 477 | 37 224 / 35 474 | | Mode | NMI US / JP | IRQ US / JP | |---|---|---| | Field | FieldNMI `$C0:0182` / same | FieldIRQ `$C0:0262` / same | | Title, opening | CutsceneNMI `$7E:7233` / `$7E:71BF` (RAM) | not entered | | Battle | BattleNMI `$C1:0BA7` / `$C1:0B8A` | not entered | | Menu (field menu, name entry) | MenuNMI `$C3:1387` / `$C3:13F2` | not entered | | World map, walking | WorldNMI `$EE:A728` / `$EE:A71F` | WorldIRQ `$EE:A93A` / `$EE:A931` | RAM code executed: only the trampolines `$00:1500/$1504` and the cutscene program (`$7E:5000-7B42` US, `$7E:5000-7AE4` JP). **0 unexpected addresses** in every mode reached, so no finding. Out of reach (The End, ending, World of Ruin cutscene, vehicles and their raster IRQs, the battle-exit `rtl`): #22, which proposes late-game start points (route-produced SRAM or an SRAM synthesiser). ## Validation - Builds without warnings: debug, clang, mingw (`--no-test`); `release --fast`: 13/13. - `ctest -L slow` (release): **21/21 passed**, including route/movie/route_ports_on of `narshe_to_world_map` on US and JP (about 15 min each). Refs #8 (the remaining part is in #22) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
One instruction-hook dispatcher in port.c: the port registry runs first, then the
trace records the instruction that really executes (one flag test when off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
US 79761 frames, JP 80670 frames from power-on (start: end of title_to_first_battle_win).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Gatchan/FF6Portage!23
No description provided.