Skip to content

Stop stepping past end of completed program - #115

Merged
JumpLink merged 2 commits into
mainfrom
fix/109-stepping-out-of-bounds
Jun 10, 2026
Merged

Stop stepping past end of completed program#115
JumpLink merged 2 commits into
mainfrom
fix/109-stepping-out-of-bounds

Conversation

@JumpLink

Copy link
Copy Markdown
Owner

Fixes #109

Problem

Stepping is done via the simulator's debugExecStep, which executes with debugging mode set to true and bypasses the codeRunning check. Because of this, the program end (BRK) was never detected while single-stepping: debugExecStep even cleared the _programCompleted flag and kept executing, so the user could silently step past the end of the program into uninitialized memory.

Changes

Core (packages/6502)

  • BRK and unknown opcodes now explicitly mark the program as completed, so completion is detected in debug mode too — stepping over the final BRK now logs Program completed at PC=$… and transitions to COMPLETED state.
  • debugExecStep refuses to step a completed program and emits an info message (Program completed. Reset to step through the program again.) instead of clearing the flag. This protects all platforms, including the web app which uses the simulator directly.
  • The state getter gives COMPLETED precedence over the stepper flag so the UI reflects completion while debugging.

common-ui

  • The step action is disabled in COMPLETED state; the user has to reset or run again (the main button switches to Reset).
  • The event bridge dispatches a program-completed notification when execution finishes, prompting users who are watching the GUI debugger.

Apps

  • GNOME and Android show a Program completed toast for the new notification key.

Translations

  • New strings extracted to the pot and translated in all 15 languages.

Verification

  • yarn formatyarn check:formatyarn build all pass.
  • Runtime-verified against the built core package: stepping over BRKCOMPLETED + stop event; a further step is refused (PC unchanged) with the info message; after reset, stepping works again; normal run mode still ends in COMPLETED as before.

JumpLink added 2 commits June 10, 2026 09:12
BRK and unknown opcodes now mark the program as completed even in
debug mode, so single-stepping ends at the program end instead of
running on through uninitialized memory. debugExecStep refuses to
step a completed program and informs the user; the step action is
disabled in COMPLETED state and a program-completed notification
is shown on all platforms.

Fixes #109
Add the new toast title "Program completed" and the stepper info
message to the pot and all language files.
@JumpLink
JumpLink merged commit 26e2c43 into main Jun 10, 2026
3 checks passed
@JumpLink
JumpLink deleted the fix/109-stepping-out-of-bounds branch June 10, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stepping out of bounds

1 participant