Tying up some loose ends

This commit is contained in:
Guy Perfect 2023-03-11 16:43:01 -06:00
parent b77f2a5ab1
commit 1cc268e5d0
5 changed files with 28 additions and 19 deletions

View File

@ -121,6 +121,15 @@ class App extends Toolkit.App {
// Reveal the application // Reveal the application
this.visible = true; this.visible = true;
this.restoreFocus(); this.restoreFocus();
console.log(
"CPU window shortcuts:\n" +
" F11 Single step\n" +
" F10 Run to next\n" +
" Ctrl+B Toggle bytes column\n" +
" Ctrl+F Fit columns\n" +
" Ctrl+G Goto"
);
} }
// Initialize File menu // Initialize File menu
@ -538,12 +547,12 @@ class App extends Toolkit.App {
} }
// Perform a Run Next command on one of the simulations // Perform a Run Next command on one of the simulations
runNext(index, options) { runToNext(index, options) {
let debugs = [ this.debug[index] ]; let debugs = [ this.debug[index] ];
if (this.dualMode) if (this.dualMode)
debugs.push(this.debug[index ^ 1]); debugs.push(this.debug[index ^ 1]);
let ret = this.core.runNext(debugs.map(d=>d.sim), options); let ret = this.core.runToNext(debugs.map(d=>d.sim), options);
if (ret instanceof Promise) ret.then(msg=>{ if (ret instanceof Promise) ret.then(msg=>{
for (let x = 0; x < debugs.length; x++) for (let x = 0; x < debugs.length; x++)

View File

@ -191,9 +191,9 @@ class Core {
} }
// Execute until the next current instruction // Execute until the next current instruction
runNext(sims, options) { runToNext(sims, options) {
return this.message({ return this.message({
command: "runNext", command: "runToNext",
sims : Array.isArray(sims) ? sims : Array.isArray(sims) ?
sims.map(s=>s.pointer) : [ sims.pointer ] sims.map(s=>s.pointer) : [ sims.pointer ]
}, [], options); }, [], options);

View File

@ -210,11 +210,11 @@ class CoreThread {
} }
// Execute until the next current instruction // Execute until the next current instruction
runNext(msg) { runToNext(msg) {
let sims = this.malloc(msg.sims.length, true); let sims = this.malloc(msg.sims.length, true);
for (let x = 0; x < msg.sims.length; x++) for (let x = 0; x < msg.sims.length; x++)
sims[x] = msg.sims[x]; sims[x] = msg.sims[x];
this.RunNext(sims.pointer, msg.sims.length); this.RunToNext(sims.pointer, msg.sims.length);
this.free(sims); this.free(sims);
let pcs = new Array(msg.sims.length); let pcs = new Array(msg.sims.length);

View File

@ -41,19 +41,19 @@ EMSCRIPTEN_KEEPALIVE int PointerSize() {
////////////////////////////// Debugger Commands ////////////////////////////// ////////////////////////////// Debugger Commands //////////////////////////////
// Execute until the following instruction // Execute until the following instruction
static uint32_t RunNextAddress; static uint32_t RunToNextAddress;
static int RunNextFetch(VB *sim, int fetch, VBAccess *access) { static int RunToNextFetch(VB *sim, int fetch, VBAccess *access) {
return access->address == RunNextAddress; return access->address == RunToNextAddress;
} }
static int RunNextExecute(VB *sim, VBInstruction *inst) { static int RunToNextExecute(VB *sim, VBInstruction *inst) {
RunNextAddress = inst->address + inst->size; RunToNextAddress = inst->address + inst->size;
vbSetCallback(sim, VB_ONEXECUTE, NULL); vbSetCallback(sim, VB_ONEXECUTE, NULL);
vbSetCallback(sim, VB_ONFETCH, &RunNextFetch); vbSetCallback(sim, VB_ONFETCH, &RunToNextFetch);
return 0; return 0;
} }
EMSCRIPTEN_KEEPALIVE void RunNext(VB **sims, int count) { EMSCRIPTEN_KEEPALIVE void RunToNext(VB **sims, int count) {
uint32_t clocks = 20000000; // 1s uint32_t clocks = 20000000; // 1s
vbSetCallback(sims[0], VB_ONEXECUTE, &RunNextExecute); vbSetCallback(sims[0], VB_ONEXECUTE, &RunToNextExecute);
vbEmulateEx (sims, count, &clocks); vbEmulateEx (sims, count, &clocks);
vbSetCallback(sims[0], VB_ONEXECUTE, NULL); vbSetCallback(sims[0], VB_ONEXECUTE, NULL);
vbSetCallback(sims[0], VB_ONFETCH , NULL); vbSetCallback(sims[0], VB_ONFETCH , NULL);

View File

@ -77,7 +77,7 @@ class CPU extends Toolkit.Window {
// Processing by key: CTRL up // Processing by key: CTRL up
else switch (e.key) { else switch (e.key) {
case "F10": case "F10":
this.debug.app.runNext(this.index, { refresh: true }); this.debug.app.runToNext(this.index, { refresh: true });
break; break;
case "F11": case "F11":
this.debug.app.singleStep(this.index, { refresh: true }); this.debug.app.singleStep(this.index, { refresh: true });
@ -431,7 +431,7 @@ class DisassemblerPane extends Toolkit.ScrollPane {
// Ensure PC is visible in the view // Ensure PC is visible in the view
followPC(pc = null) { followPC(pc = null) {
let tall = this.tall(false); let tall = this.tall(true);
let count = !this.dasm ? 0 : Math.min(this.dasm.length - 10, tall); let count = !this.dasm ? 0 : Math.min(this.dasm.length - 10, tall);
// Determine whether PC already is visible // Determine whether PC already is visible
@ -563,7 +563,7 @@ class DisassemblerPane extends Toolkit.ScrollPane {
// Configure layout // Configure layout
this.view.element.style.gridTemplateColumns = this.view.element.style.gridTemplateColumns =
"repeat(" + (showBytes + 3) + ", max-content)";// auto"; "repeat(" + (showBytes + 3) + ", max-content)";
} }
// Stop receiving updates from the simulation // Stop receiving updates from the simulation
@ -1249,7 +1249,7 @@ class RegisterPane extends Toolkit.SplitPane {
this.scrSystem = new Toolkit.ScrollPane(cpu.debug.app, { this.scrSystem = new Toolkit.ScrollPane(cpu.debug.app, {
class : "tk scroll-pane scr-system", class : "tk scroll-pane scr-system",
overflowX: "auto", overflowX: "auto",
overflowY: "scroll", overflowY: "auto",
view : this.lstSystem, view : this.lstSystem,
style : { style : {
position: "relative" position: "relative"
@ -1271,7 +1271,7 @@ class RegisterPane extends Toolkit.SplitPane {
this.scrProgram = new Toolkit.ScrollPane(cpu.debug.app, { this.scrProgram = new Toolkit.ScrollPane(cpu.debug.app, {
class : "tk scroll-pane scr-program", class : "tk scroll-pane scr-program",
overflowX: "auto", overflowX: "auto",
overflowY: "scroll", overflowY: "auto",
view : this.lstProgram view : this.lstProgram
}); });
this.secondary = this.scrProgram; this.secondary = this.scrProgram;