mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-22 14:33:51 +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?
|
// TODO don't need to save ROM?
|
||||||
saveState() {
|
saveState() {
|
||||||
//var s = $.extend(true, {}, this.nes);
|
//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;
|
s.c = s.cpu;
|
||||||
this.copy6502REGvars(s.c);
|
this.copy6502REGvars(s.c);
|
||||||
s.b = s.cpu.mem = s.cpu.mem.slice(0);
|
s.b = s.cpu.mem = s.cpu.mem.slice(0);
|
||||||
|
@ -187,8 +187,8 @@ class VCSPlatform extends BasePlatform {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
fixState(state) {
|
fixState(state) {
|
||||||
var ofs = state.ca.bo || 0;
|
var ofs = (state.ca && state.ca.bo) || 0;
|
||||||
if (state.ca.fo && (state.c.PC & 0xfff) >= 2048)
|
if (state.ca && state.ca.fo && (state.c.PC & 0xfff) >= 2048)
|
||||||
ofs = state.ca.fo; // 3E/3F fixed-slice formats
|
ofs = state.ca.fo; // 3E/3F fixed-slice formats
|
||||||
// TODO: for batari BASIC
|
// TODO: for batari BASIC
|
||||||
state.c.EPC = state.c.PC + ofs; // EPC = effective PC for ROM
|
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 platform = new emu.PLATFORMS[platid](emudiv);
|
||||||
var rec = new recorder.StateRecorderImpl(platform);
|
var rec = new recorder.StateRecorderImpl(platform);
|
||||||
platform.start();
|
platform.start();
|
||||||
|
assert.ok(platform.saveState()); // can save before ROM load?
|
||||||
var rom = fs.readFileSync('./test/roms/' + platid + '/' + romname);
|
var rom = fs.readFileSync('./test/roms/' + platid + '/' + romname);
|
||||||
rom = new Uint8Array(rom);
|
rom = new Uint8Array(rom);
|
||||||
platform.loadROM("ROM", rom);
|
platform.loadROM("ROM", rom);
|
||||||
|
Loading…
Reference in New Issue
Block a user