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
this.visible = true;
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
@ -538,12 +547,12 @@ class App extends Toolkit.App {
}
// Perform a Run Next command on one of the simulations
runNext(index, options) {
runToNext(index, options) {
let debugs = [ this.debug[index] ];
if (this.dualMode)
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=>{
for (let x = 0; x < debugs.length; x++)

View File

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

View File

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

View File

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

View File

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