atari8: fixed bug in debug tree

This commit is contained in:
Steven Hugg 2023-07-09 23:35:02 -05:00
parent 5a93bc8b75
commit 37633d8875
2 changed files with 15 additions and 6 deletions

View File

@ -106,6 +106,14 @@ class TreeNode {
}
obj = newobj;
}
// is it a Map? if so, convert to dictionary
if (obj instanceof Map) {
let newobj = {};
for (let [key, value] of obj.entries()) {
newobj[key] = value;
}
obj = newobj;
}
// get object keys
let names = obj instanceof Array ? Array.from(obj.keys()) : Object.getOwnPropertyNames(obj);
if (names.length > MAX_CHILDREN) { // max # of child objects

View File

@ -417,13 +417,13 @@ export class Atari800 extends BasicScanlineMachine implements AcceptsPaddleInput
pc = ((pc + 1) & 0x3ff) | (pc & ~0x3ff);
return b;
}
let dlist = {};
let dlist = [];
let y = 0;
for (let i=0; i<256 && y<240; i++) {
let pc0 = pc;
let op = nextInsn(); // get mode
let mode = op & 0xf;
let debugmsg = ""; // op=" + hex(op);
let debugmsg = "" // "op=" + hex(op);
let jmp = false;
let lines;
if (mode == 0) {
@ -435,18 +435,19 @@ export class Atari800 extends BasicScanlineMachine implements AcceptsPaddleInput
debugmsg += " lines=" + lines;
jmp = (op & ~0x40) == 0x01; // JMP insn?
let lms = (op & 0x40) != 0 && (op & 0xf) != 0; // LMS insn?
if (op & 0x10) { debugmsg += " HSCROL"; }
if (op & 0x20) { debugmsg += " VSCROL"; }
if (op & 0x80) { debugmsg += " DLI"; }
if (jmp && (op & 0x40)) { debugmsg += " JVB"; }
else if (jmp) debugmsg += " JMP";
else if (lms) debugmsg += " LMS";
if (this.antic.isPlayfieldDMAEnabled() && (jmp || lms)) {
if (jmp || lms) {
let dlarg_lo = nextInsn();
let dlarg_hi = nextInsn();
debugmsg += " $" + hex(dlarg_hi) + "" + hex(dlarg_lo);
}
if (op & 0x10) { debugmsg += " HSCROL"; }
if (op & 0x20) { debugmsg += " VSCROL"; }
}
dlist["$"+hex(pc0) + " y=" + y] = debugmsg;
dlist.push("$"+hex(pc0) + " y=" + y + " " + debugmsg);
if (jmp) break;
y += lines;
}