mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-25 18:33:11 +00:00
nes/vcs: fix crash if click disassembler before rom loads
This commit is contained in:
parent
eb990dbf1a
commit
96bdc184d8
@ -299,7 +299,13 @@ class JSNESPlatform extends Base6502Platform implements Platform, Probeable {
|
||||
// TODO don't need to save ROM?
|
||||
saveState() {
|
||||
//var s = $.extend(true, {}, this.nes);
|
||||
var s = this.nes.toJSON();
|
||||
var s;
|
||||
if (this.nes.mmap) {
|
||||
s = this.nes.toJSON();
|
||||
} else {
|
||||
console.log("no nes.mmap!");
|
||||
s = { cpu: this.nes.cpu.toJSON(), ppu: this.nes.ppu.toJSON() };
|
||||
}
|
||||
s.c = s.cpu;
|
||||
this.copy6502REGvars(s.c);
|
||||
s.b = s.cpu.mem = s.cpu.mem.slice(0);
|
||||
|
@ -187,8 +187,8 @@ class VCSPlatform extends BasePlatform {
|
||||
return state;
|
||||
}
|
||||
fixState(state) {
|
||||
var ofs = state.ca.bo || 0;
|
||||
if (state.ca.fo && (state.c.PC & 0xfff) >= 2048)
|
||||
var ofs = (state.ca && state.ca.bo) || 0;
|
||||
if (state.ca && state.ca.fo && (state.c.PC & 0xfff) >= 2048)
|
||||
ofs = state.ca.fo; // 3E/3F fixed-slice formats
|
||||
// TODO: for batari BASIC
|
||||
state.c.EPC = state.c.PC + ofs; // EPC = effective PC for ROM
|
||||
|
@ -118,6 +118,7 @@ function testPlatform(platid, romname, maxframes, callback) {
|
||||
var platform = new emu.PLATFORMS[platid](emudiv);
|
||||
var rec = new recorder.StateRecorderImpl(platform);
|
||||
platform.start();
|
||||
assert.ok(platform.saveState()); // can save before ROM load?
|
||||
var rom = fs.readFileSync('./test/roms/' + platid + '/' + romname);
|
||||
rom = new Uint8Array(rom);
|
||||
platform.loadROM("ROM", rom);
|
||||
|
Loading…
Reference in New Issue
Block a user