mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-11 17:50:57 +00:00
show >8 bit arrays in debug, check for non-typed arrays in state, fix embed iframe
This commit is contained in:
parent
6acaa3f81d
commit
2e27b0d2bb
@ -192,6 +192,7 @@ TODO:
|
||||
- copy to gen/ directory (allowJs is weird)
|
||||
- can we debug first frame via replay?
|
||||
- ca65 line numbers are not aligned with source code
|
||||
- segments not read properly
|
||||
- Debug Browser
|
||||
- hex viewer
|
||||
- show 16/32 typed arrays
|
||||
|
@ -17,7 +17,7 @@
|
||||
flex-grow: 1;
|
||||
}
|
||||
.emuvideo {
|
||||
width:90%;
|
||||
width: calc(100% - 70px);
|
||||
border-radius:20px;
|
||||
border: 4px solid #222;
|
||||
outline-color: #666;
|
||||
|
2
jsnes
2
jsnes
@ -1 +1 @@
|
||||
Subproject commit 03614b82158dabc4fc78c728be0b6a847538b957
|
||||
Subproject commit a6a026b698f9a68372cc94b46182e3abedc26672
|
@ -305,15 +305,17 @@ export class AnimationTimer {
|
||||
|
||||
// TODO: move to util?
|
||||
|
||||
export function dumpRAM(ram:Uint8Array|number[], ramofs:number, ramlen:number) : string {
|
||||
export function dumpRAM(ram:ArrayLike<number>, ramofs:number, ramlen:number) : string {
|
||||
var s = "";
|
||||
var bpel = ram['BYTES_PER_ELEMENT'] || 1;
|
||||
var perline = Math.ceil(16 / bpel);
|
||||
// TODO: show scrollable RAM for other platforms
|
||||
for (var ofs=0; ofs<ramlen; ofs+=0x10) {
|
||||
for (var ofs=0; ofs<ramlen; ofs+=perline) {
|
||||
s += '$' + hex(ofs+ramofs) + ':';
|
||||
for (var i=0; i<0x10; i++) {
|
||||
for (var i=0; i<perline; i++) {
|
||||
if (ofs+i < ram.length) {
|
||||
if (i == 8) s += " ";
|
||||
s += " " + hex(ram[ofs+i]);
|
||||
if (i == perline/2) s += " ";
|
||||
s += " " + hex(ram[ofs+i], bpel*2);
|
||||
}
|
||||
}
|
||||
s += "\n";
|
||||
|
@ -224,6 +224,7 @@ export class ProbeRecorder implements ProbeAll {
|
||||
if (this.singleFrame) this.reset();
|
||||
}
|
||||
logExecute(address:number, SP:number) {
|
||||
// TODO? record stack pushes (not all platforms use logExecute)
|
||||
if (this.cur_sp !== SP) {
|
||||
if (SP < this.cur_sp) {
|
||||
this.log(ProbeFlags.SP_PUSH | (this.cur_sp - SP));
|
||||
|
@ -1161,6 +1161,7 @@ export class RasterPCHeatMapView extends ProbeBitmapViewBase implements ProjectV
|
||||
}
|
||||
}
|
||||
|
||||
// TODO?
|
||||
export class RasterStackMapView extends ProbeBitmapViewBase implements ProjectView {
|
||||
pcstack = [];
|
||||
pushed = false;
|
||||
@ -1401,8 +1402,8 @@ class TreeNode {
|
||||
text = obj;
|
||||
else
|
||||
text = obj.substring(0, MAX_STRING_LEN) + "...";
|
||||
// byte array (TODO: other kinds)
|
||||
} else if (obj instanceof Uint8Array && obj.length <= MAX_CHILDREN) {
|
||||
// typed byte array (TODO: other kinds)
|
||||
} else if (obj.buffer && obj.length <= MAX_CHILDREN) {
|
||||
text = dumpRAM(obj, 0, obj.length);
|
||||
// recurse into object? (or function)
|
||||
} else if (typeof obj == 'object' || typeof obj == 'function') {
|
||||
|
@ -8,9 +8,10 @@ const cpuFrequency = 1023000;
|
||||
const cpuCyclesPerLine = 65; // approx: http://www.cs.columbia.edu/~sedwards/apple2fpga/
|
||||
const cpuCyclesPerFrame = 65*262;
|
||||
|
||||
// TODO: read prodos/ca65 header?
|
||||
const VM_BASE = 0x803; // where to JMP after pr#6
|
||||
const LOAD_BASE = VM_BASE; //0x7c9; // where to load ROM
|
||||
const PGM_BASE = VM_BASE; //0x800; // where to load ROM
|
||||
const LOAD_BASE = VM_BASE;
|
||||
const PGM_BASE = VM_BASE;
|
||||
const HDR_SIZE = PGM_BASE - LOAD_BASE;
|
||||
|
||||
interface AppleIIStateBase {
|
||||
|
@ -117,6 +117,17 @@ global.Mousetrap = function() {
|
||||
|
||||
//
|
||||
|
||||
function checkForBigNonTypedArrays(obj, path='') {
|
||||
if (typeof obj != 'object' || obj == null) return;
|
||||
Object.entries(obj).forEach((entry) => {
|
||||
if (entry[1] instanceof Array && entry[1].length > 200) {
|
||||
if (typeof entry[1][0] == 'number' && entry[1].buffer == null)
|
||||
throw new Error("array in save state not typed: " + path + '/' + entry[0]);
|
||||
}
|
||||
checkForBigNonTypedArrays(entry[1], path + '/' + entry[0]);
|
||||
});
|
||||
}
|
||||
|
||||
async function testPlatform(platid, romname, maxframes, callback) {
|
||||
var platform = new emu.PLATFORMS[platid](emudiv);
|
||||
await platform.start();
|
||||
@ -127,6 +138,7 @@ async function testPlatform(platid, romname, maxframes, callback) {
|
||||
rom = new Uint8Array(rom);
|
||||
platform.loadROM("ROM", rom);
|
||||
var state0a = platform.saveState();
|
||||
checkForBigNonTypedArrays(state0a);
|
||||
platform.reset(); // reset again
|
||||
var state0b = platform.saveState();
|
||||
//TODO: vcs fails assert.deepEqual(state0a, state0b);
|
||||
@ -152,6 +164,7 @@ async function testPlatform(platid, romname, maxframes, callback) {
|
||||
assert.equal(maxframes, rec.loadFrame(maxframes));
|
||||
var state2 = platform.saveState();
|
||||
assert.deepEqual(state1, state2);
|
||||
checkForBigNonTypedArrays(state2);
|
||||
// test memory reads not clearing stuff
|
||||
for (var i=0; i<=0xffff; i++)
|
||||
if (platform.readAddress) platform.readAddress(i);
|
||||
|
Loading…
Reference in New Issue
Block a user