diff --git a/packages/app-android/app/views/main.ts b/packages/app-android/app/views/main.ts index 179c036b..3301bd5f 100644 --- a/packages/app-android/app/views/main.ts +++ b/packages/app-android/app/views/main.ts @@ -128,9 +128,6 @@ export class MainController implements MainView { showNotification: (key) => { notificationService.showNotification({ title: _(NOTIFICATION_TITLES[key] || key), timeout: 2 }); }, - updateDebugInfo: (simulator) => { - debuggerView.updateDebugInfo(simulator); - }, }); this.mainBridge = new MainEventBridge({ diff --git a/packages/app-gnome/src/views/main.window.ts b/packages/app-gnome/src/views/main.window.ts index a1bd83f5..1eafff68 100644 --- a/packages/app-gnome/src/views/main.window.ts +++ b/packages/app-gnome/src/views/main.window.ts @@ -712,12 +712,6 @@ export class MainWindow extends Adw.ApplicationWindow implements MainView { timeout: 2, }); }, - updateDebugInfo: (simulator) => { - // If stepper is enabled, update full debugger; otherwise just debug info - if (this._gameConsole.simulator.stepperEnabled) { - this.updateDebugger(); - } - }, }); this.gameConsoleBridge.connect(); } diff --git a/packages/app-web/src/app/main-window.ts b/packages/app-web/src/app/main-window.ts index 9a5efd9a..df56208b 100644 --- a/packages/app-web/src/app/main-window.ts +++ b/packages/app-web/src/app/main-window.ts @@ -400,9 +400,6 @@ export class MainWindow implements MainView { }, updateUiState: () => this.updateRunActions(this.simulator.state), showNotification: (key) => this.showToast(NOTIFICATION_TITLES[key] ?? key), - updateDebugInfo: () => { - if (this.simulator.stepperEnabled) this.updateDebugger(); - }, }); this.bridge.connect(); diff --git a/packages/common-ui/src/controller/game-console-event-bridge.ts b/packages/common-ui/src/controller/game-console-event-bridge.ts index 4a69fdc0..e3ea8a01 100644 --- a/packages/common-ui/src/controller/game-console-event-bridge.ts +++ b/packages/common-ui/src/controller/game-console-event-bridge.ts @@ -1,5 +1,5 @@ import { SimulatorState, _ } from "@learn6502/core"; -import type { Assembler, Simulator } from "@learn6502/core"; +import type { Assembler } from "@learn6502/core"; import { gameConsoleController } from "./game-console-controller.ts"; import { debuggerController } from "./debugger-controller.ts"; @@ -27,9 +27,6 @@ export interface GameConsoleEventBridgeCallbacks { /** Show a notification with a translatable key. */ showNotification(key: string): void; - - /** Called when a step/multistep/goto occurs and debugger may need update. */ - updateDebugInfo(simulator: Simulator): void; } type EventUnsubscriber = () => void; @@ -125,8 +122,15 @@ export class GameConsoleEventBridge { if (signal.message) { this.callbacks.formatAndLog(signal.message, signal.params); } - if (signal.simulator) { - this.callbacks.updateDebugInfo(signal.simulator); + // "step" is not the Step button: Simulator.execute() emits it for every + // executed instruction, and a free run runs execute() 97 times per + // multiExecute() tick. Refreshing the debugger here is therefore only + // affordable while the stepper is on — multiExecute() then returns + // early, so one event is one press of Step, and the memory monitor has + // to be redrawn or the step leaves stale bytes on screen. A free run is + // covered by the "multistep" handler below, whose update is throttled. + if (signal.simulator.stepperEnabled) { + this.callbacks.updateDebugger(); } });