Repository navigation
Threaded UI, idle-loop fast-forward, keep-awake, locked recovery points - #4
Open
knuckleslee wants to merge 3 commits into
Open
knuckleslee wants to merge 3 commits into
knuckleslee wants to merge 3 commits into
Conversation
The number was taken from the entry's position in the table, which is only right when the name search starts at the first descriptor. On the edition this was measured on, the first descriptor carries a broken name pointer, so the run starts at the second one and every name from there on shifts by one (the home and home-field screens were swapped, the download screen was reported under its neighbour's name). The number is written in the descriptor at +8 and is now read there. The field is located as the one that fits in 16 bits and increases most often from one entry to the next, the same way table_scenes_probe finds it, so the probe and the interface cannot disagree. A perfectly increasing run is not required: the table ends with a sentinel and an edition may have inserted a screen. The base walks back only when the descriptors it uncovers carry the numbers that would precede, so a misidentified field cannot shift the table the other way. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d recovery points Threaded interface: the machine runs on its own thread and the interface draws from a mirror of it (src/fil.rs), so a slow frame no longer slows the console. Anything that needs the machine directly (inspection panel, open menu, serial link, local server) stops the worker and takes the machine back, which keeps the original single-threaded path as the fallback. Idle-loop fast-forward: a short backward branch with no store and registers identical to the previous pass is skipped by advancing the clock while the peripherals are still serviced at their usual granularity; WFI is handled the same way. This changes the default behaviour: events are noticed up to a bounded number of cycles later, in exchange for a much lower CPU load. It is switched off automatically while a serial link is open, and Cpu::step_exact() turns it off for tests and tools. Keep awake: clears the firmware's idle count once a second of console time (what a button press does, without the press) so the console does not decide to shut itself down. Off by default, saved with the game. Recovery points: written by a separate thread, so taking one no longer stops the console; a point can be locked so that pruning and the age limit leave it alone. Indexes written by earlier versions load with nothing locked. The rewind history snapshots every two seconds of console time instead of twice a second, which removes a regular hitch. Also adds PartialEq/Eq on Registers (used by the loop detector) and a few hot-path adjustments in the Thumb decoders. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
FEATURES.md describes the worker thread, the idle-loop fast-forward (and how to get step-exact behaviour), keep-awake, locked recovery points and scene numbering. tests/features_tests.rs checks that the fast-forward ends in the same registers as the step-exact core on a polling loop, that it still leaves the loop when the polled value changes, that keep-awake clears the idle count within a second, and that a locked recovery point survives reopening the journal and restores. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 16, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Runtime performance and usability work for the emulation loop and the interface (3 commits, see
FEATURES.mdfor the user-facing description):src/fil.rs). Anything that needs the machine directly (inspection panel, open menu, serial link, local server) stops the worker and takes the machine back, so the original single-threaded path stays as the fallback.WFIis handled the same way.PUSH/POP/LDM/STMuse one region test when the burst fits in SRAM;RegistersderivesPartialEq/Eq.Behaviour change (please read)
The fast-forward is on by default and changes default behaviour. The program reaches the same states, but the moment at which the firmware notices an event can shift by up to the maximum skip length, so step-count-driven headless runs will no longer match older logs step for step. In exchange the CPU load while idle drops a lot.
Step-exact behaviour is still available: it is disabled automatically while a serial link is open (a transfer protocol counting milliseconds needs it), and
Cpu::step_exact()turns it off for tests and tools. There is no environment variable and no new setting.I could not run a firmware regression for this branch against the upstream binary (no firmware in CI); the evidence is the test suites below plus
tests/features_tests.rs, which compares the fast-forward core with the step-exact core on a polling loop.How to test
cargo test --release: 17 + 17 + 66 + 4 + 3 tests pass;cargo build --release --all-targetsbuilds;cargo build --release --bin capybarabuilds. New:tests/features_tests.rs(fast-forward ends in the same registers as the step-exact core and still leaves a loop whose polled value changes; keep-awake clears the idle count within a second; a locked recovery point survives reopening the journal and restores).Risk / dependencies
Medium: touches
app.rs,emulator/mod.rsand the CPU loop. Independent of #2 and #3 (it should merge without conflict with #3, which only touches labels and the UART1 data register inmmu/mod.rs; I did not rebase onto it). The keep-awake address is the one measured on one edition; other editions may count elsewhere.🤖 Generated with Claude Code