pvbemu/app/Debugger.js

55 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-08-30 02:14:06 +00:00
"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;
2021-09-02 00:16:22 +00:00
// Memory window
2021-08-30 02:14:06 +00:00
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);
2021-09-02 00:16:22 +00:00
// 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);
2021-08-30 02:14:06 +00:00
}
///////////////////////////// Package Methods /////////////////////////////
// Message received from emulation thread
message(msg) {
switch (msg.debug) {
2021-09-02 00:16:22 +00:00
case "CPU" : this.cpu .message(msg); break;
2021-08-30 02:14:06 +00:00
case "Memory": this.memory.message(msg); break;
}
}
// Reload all output
refresh() {
2021-09-02 00:16:22 +00:00
this.cpu .refresh();
2021-08-30 02:14:06 +00:00
this.memory.refresh();
}
};