Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 1x 7x 7x 7x 7x 7x 7x 7x 4x 3x 1x 7x 7x 7x 7x 32x 7x 2000x | import { hd } from "../hex.js";
import { debounce } from "../debounce.js";
import { PagedView } from "../paging.js";
const LastAddress = 0xffff;
/**
* The debugging surface the wiki documents, put on `target` (window in the
* app). The bench/profile calls are debounced so that they can be safely run
* from the JS console in firefox.
*/
export function exposeConsoleSurface(target, { loop, processor, video, audioHandler, dbgr }) {
target.benchmarkCpu = debounce((numCycles) => loop.benchmarkCpu(numCycles), 1);
target.profileCpu = debounce((arg) => loop.profileCpu(arg), 1);
target.benchmarkVideo = debounce((numCycles) => loop.benchmarkVideo(numCycles), 1);
target.profileVideo = debounce((arg) => loop.profileVideo(arg), 1);
target.go = () => loop.go();
target.stop = (debug) => loop.stop(debug);
target.whoWrote = (address) => {
if (!Number.isInteger(address) || address < 0 || address > LastAddress)
throw new Error(`whoWrote takes an address from 0 to 0xffff, not ${address}`);
return dbgr.whoWrote(address, PagedView);
};
target.soundChip = audioHandler.soundChip;
target.processor = processor;
target.video = video;
target.hd = (start, end) => {
console.log(hd((x) => processor.peekmem(x), start, end));
};
target.m7dump = () => {
console.log(hd((x) => processor.peekmem(x) & 0x7f, 0x7c00, 0x7fe8, { width: 40, gap: false }));
};
}
|