mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-06-02 12:41:30 +00:00
made EmuHalt class for NES trap
This commit is contained in:
parent
f41d181aab
commit
7e2bf32a6f
|
@ -91,12 +91,13 @@ TODO:
|
||||||
- profiler restarts when paused
|
- profiler restarts when paused
|
||||||
- it's pretty easy to add a new file named like a library file (bcd.c)
|
- it's pretty easy to add a new file named like a library file (bcd.c)
|
||||||
- put globals into view/controller objects
|
- put globals into view/controller objects
|
||||||
- cr/lf in files
|
- cr/lf in uploaded files?
|
||||||
- upload binary files doesn't do what's expected, changing pulldown and whatnot
|
- upload binary files doesn't do what's expected, changing pulldown and whatnot
|
||||||
- chrome autostart audio: https://github.com/processing/p5.js-sound/issues/249
|
- chrome autostart audio: https://github.com/processing/p5.js-sound/issues/249
|
||||||
- show player controls for each platform, allow touch support, navigator.getGamepads
|
- show player controls for each platform, allow touch support, navigator.getGamepads
|
||||||
- better undo/diff for mistakes?
|
- better undo/diff for mistakes?
|
||||||
- get rid of "illegal PC" instruction, replace with status msg
|
- get rid of "illegal PC" instruction, replace with status msg
|
||||||
|
- ide bug/feature visualizer for sponsors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
13
src/emu.ts
13
src/emu.ts
|
@ -215,6 +215,9 @@ export class RAM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class EmuHalt extends Error {
|
||||||
|
}
|
||||||
|
|
||||||
export class AnimationTimer {
|
export class AnimationTimer {
|
||||||
|
|
||||||
callback;
|
callback;
|
||||||
|
@ -234,7 +237,15 @@ export class AnimationTimer {
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduleFrame(msec:number) {
|
scheduleFrame(msec:number) {
|
||||||
var fn = () => { this.nextFrame(); }
|
var fn = () => {
|
||||||
|
try {
|
||||||
|
this.nextFrame();
|
||||||
|
} catch (e) {
|
||||||
|
this.running = false;
|
||||||
|
this.pulsing = false;
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (this.useReqAnimFrame)
|
if (this.useReqAnimFrame)
|
||||||
window.requestAnimationFrame(fn);
|
window.requestAnimationFrame(fn);
|
||||||
else
|
else
|
||||||
|
|
|
@ -662,6 +662,7 @@ export class PixelTextDataNode extends PixelNode {
|
||||||
}
|
}
|
||||||
updateRight() {
|
updateRight() {
|
||||||
var datastr = this.text.substring(this.start, this.end);
|
var datastr = this.text.substring(this.start, this.end);
|
||||||
|
datastr = convertToHexStatements(datastr); // TODO?
|
||||||
var words = parseHexWords(datastr);
|
var words = parseHexWords(datastr);
|
||||||
this.output = new Uint8Array(words); // TODO: 16/32?
|
this.output = new Uint8Array(words); // TODO: 16/32?
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
import { Platform, Base6502Platform, BaseMAMEPlatform, getOpcodeMetadata_6502, cpuStateToLongString_6502, getToolForFilename_6502, dumpStackToString, ProfilerOutput } from "../baseplatform";
|
import { Platform, Base6502Platform, BaseMAMEPlatform, getOpcodeMetadata_6502, cpuStateToLongString_6502, getToolForFilename_6502, dumpStackToString, ProfilerOutput } from "../baseplatform";
|
||||||
import { PLATFORMS, RAM, newAddressDecoder, padBytes, noise, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap, dumpRAM, KeyFlags } from "../emu";
|
import { PLATFORMS, RAM, newAddressDecoder, padBytes, noise, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap, dumpRAM, KeyFlags, EmuHalt } from "../emu";
|
||||||
import { hex, lpad, lzgmini, byteArrayToString } from "../util";
|
import { hex, lpad, lzgmini, byteArrayToString } from "../util";
|
||||||
import { CodeAnalyzer_nes } from "../analysis";
|
import { CodeAnalyzer_nes } from "../analysis";
|
||||||
import { SampleAudio } from "../audio";
|
import { SampleAudio } from "../audio";
|
||||||
|
@ -126,9 +126,8 @@ const _JSNESPlatform = function(mainElement) {
|
||||||
//nes.ppu.clipToTvSize = false;
|
//nes.ppu.clipToTvSize = false;
|
||||||
nes.stop = () => {
|
nes.stop = () => {
|
||||||
// TODO: trigger breakpoint
|
// TODO: trigger breakpoint
|
||||||
this.pause();
|
|
||||||
console.log(nes.cpu.toJSON());
|
console.log(nes.cpu.toJSON());
|
||||||
throw ("CPU STOPPED @ PC $" + hex(nes.cpu.REG_PC));
|
throw new EmuHalt("CPU STOPPED @ PC $" + hex(nes.cpu.REG_PC));
|
||||||
};
|
};
|
||||||
// insert debug hook
|
// insert debug hook
|
||||||
nes.cpu._emulate = nes.cpu.emulate;
|
nes.cpu._emulate = nes.cpu.emulate;
|
||||||
|
@ -148,14 +147,7 @@ const _JSNESPlatform = function(mainElement) {
|
||||||
}
|
}
|
||||||
|
|
||||||
advance(novideo : boolean) {
|
advance(novideo : boolean) {
|
||||||
try {
|
nes.frame();
|
||||||
nes.frame();
|
|
||||||
} catch (e) {
|
|
||||||
// TODO?
|
|
||||||
alert(e);
|
|
||||||
console.log(e);
|
|
||||||
this.breakpointHit(this.debugClock);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDebugViews() {
|
updateDebugViews() {
|
||||||
|
|
20
src/ui.ts
20
src/ui.ts
|
@ -8,7 +8,7 @@ import { CodeProject } from "./project";
|
||||||
import { WorkerResult, WorkerOutput, VerilogOutput, SourceFile, WorkerError, FileData } from "./workertypes";
|
import { WorkerResult, WorkerOutput, VerilogOutput, SourceFile, WorkerError, FileData } from "./workertypes";
|
||||||
import { ProjectWindows } from "./windows";
|
import { ProjectWindows } from "./windows";
|
||||||
import { Platform, Preset, DebugSymbols, DebugEvalCondition } from "./baseplatform";
|
import { Platform, Preset, DebugSymbols, DebugEvalCondition } from "./baseplatform";
|
||||||
import { PLATFORMS } from "./emu";
|
import { PLATFORMS, EmuHalt } from "./emu";
|
||||||
import * as Views from "./views";
|
import * as Views from "./views";
|
||||||
import { createNewPersistentStore } from "./store";
|
import { createNewPersistentStore } from "./store";
|
||||||
import { getFilenameForPath, getFilenamePrefix, highlightDifferences, invertMap, byteArrayToString, compressLZG,
|
import { getFilenameForPath, getFilenamePrefix, highlightDifferences, invertMap, byteArrayToString, compressLZG,
|
||||||
|
@ -1292,13 +1292,17 @@ var qs = (function (a : string[]) {
|
||||||
function installErrorHandler() {
|
function installErrorHandler() {
|
||||||
if (typeof window.onerror == "object") {
|
if (typeof window.onerror == "object") {
|
||||||
window.onerror = function (msgevent, url, line, col, error) {
|
window.onerror = function (msgevent, url, line, col, error) {
|
||||||
console.log(msgevent, url, line, col);
|
var msgstr = msgevent+"";
|
||||||
console.log(error);
|
console.log(msgevent, url, line, col, error);
|
||||||
ga('send', 'exception', {
|
if (error instanceof EmuHalt || msgstr.indexOf("CPU STOP") >= 0) {
|
||||||
'exDescription': msgevent + " " + url + " " + " " + line + ":" + col + ", " + error,
|
showErrorAlert([ {msg:msgstr, line:0} ]);
|
||||||
'exFatal': true
|
} else {
|
||||||
});
|
ga('send', 'exception', {
|
||||||
alert(msgevent+"");
|
'exDescription': msgevent + " " + url + " " + " " + line + ":" + col + ", " + error,
|
||||||
|
'exFatal': true
|
||||||
|
});
|
||||||
|
alert(msgevent+"");
|
||||||
|
}
|
||||||
_pause();
|
_pause();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user