cardiograph - Move display-drawing so that it nests nicely inside a console.group()
This commit is contained in:
parent
37bb92f296
commit
d9212ab620
|
|
@ -19,7 +19,6 @@ cpu.loadMemory(assemblerOutput.machineCode);
|
|||
cpu.loadSourceInfo(assemblerOutput.debugInfo);
|
||||
|
||||
cpu.onCycleEnd(tick);
|
||||
cpu.onCycleEnd(logDisplay);
|
||||
cpu.onCycleEnd(logCPUState);
|
||||
|
||||
cpu.start();
|
||||
|
|
@ -36,13 +35,11 @@ async function tick() {
|
|||
}
|
||||
}
|
||||
|
||||
function logDisplay() {
|
||||
io.showDisplay(cpu.memory, true); // FIXME - display - allow printing hex as well as pretty-printing
|
||||
}
|
||||
|
||||
function logCPUState() {
|
||||
let lineInfo = cpu.dbg.sourceInfo[cpu.dbg.previousIP];
|
||||
console.group(`Step ${cpu.dbg.cycleCounter}`);
|
||||
console.log();
|
||||
io.showDisplay(cpu.memory, true); // FIXME - display - allow printing hex as well as pretty-printing
|
||||
console.log();
|
||||
if (lineInfo) {
|
||||
console.log(`Line ${lineInfo.lineNumber}: ${lineInfo.source}`);
|
||||
|
|
|
|||
Loading…
Reference in New Issue