pvbemu/app/Debugger.js

55 lines
1.3 KiB
JavaScript

"use strict";
// Debugging UI manager
globalThis.Debugger = class Debugger {
// Object constructor
constructor(app, sim) {
// Configure instance fields
this.app = app;
this.core = app.core;
this.gui = app.gui;
this.sim = sim;
// Memory window
this.memory = new MemoryWindow(this, {
title : "{sim}{memory._}",
height : 300,
visible: false,
width : 400
});
this.memory.addCloseListener(e=>this.memory.setVisible(false));
app.desktop.add(this.memory);
// CPU window
this.cpu = new CPUWindow(this, {
title : "{sim}{cpu._}",
height : 300,
visible: false,
width : 400
});
this.cpu.addCloseListener(e=>this.cpu.setVisible(false));
app.desktop.add(this.cpu);
}
///////////////////////////// Package Methods /////////////////////////////
// Message received from emulation thread
message(msg) {
switch (msg.debug) {
case "CPU" : this.cpu .message(msg); break;
case "Memory": this.memory.message(msg); break;
}
}
// Reload all output
refresh() {
this.cpu .refresh();
this.memory.refresh();
}
};