Fix some edge cases

This commit is contained in:
Will Scullin 2021-02-21 21:26:07 -08:00
parent be35aa9315
commit 3004aa99f2
No known key found for this signature in database
GPG Key ID: 26DCD1042C6638CD
3 changed files with 5 additions and 11 deletions

View File

@ -775,7 +775,7 @@ export class HiresPage2D implements HiresPage {
this._refreshing = true;
const bb: bank = bank ? 0 : 1;
for (let rr = addr - 1; rr <= addr + 1; rr++) {
const vv = this._buffer[bb][rr - 0x2000 * this.page];
const vv = this._buffer[bb][rr & 0x1FFF];
this._write(rr >> 8, rr & 0xff, vv, bb);
}
this._refreshing = false;

View File

@ -839,6 +839,7 @@ export default class CPU6502 {
this.readByte(this.pc);
const oldPage = this.pc >> 8;
this.pc += off > 127 ? off - 256 : off;
this.pc &= 0xffff;
const newPage = this.pc >> 8;
const newOff = this.pc & 0xff;
if (newPage != oldPage) this.readByte(oldPage << 8 | newOff);
@ -851,6 +852,7 @@ export default class CPU6502 {
this.readByte(this.pc);
const oldPage = this.pc >> 8;
this.pc += off > 127 ? off - 256 : off;
this.pc &= 0xffff;
const newPage = this.pc >> 8;
const newOff = this.pc & 0xff;
if (newPage != oldPage) this.readByte(oldPage << 8 | newOff);
@ -870,6 +872,7 @@ export default class CPU6502 {
const oldPage = oldPc >> 8;
this.readByte(oldPc);
this.pc += off > 127 ? off - 256 : off;
this.pc &= 0xffff;
const newPage = this.pc >> 8;
if (oldPage != newPage) {
this.readByte(oldPc);
@ -888,6 +891,7 @@ export default class CPU6502 {
const oldPage = oldPc >> 8;
this.readByte(oldPc);
this.pc += off > 127 ? off - 256 : off;
this.pc &= 0xffff;
const newPage = this.pc >> 8;
if (oldPage != newPage) {
this.readByte(oldPc);

View File

@ -572,16 +572,6 @@ export class HiresPageGL implements Memory, Restorable<GraphicsState> {
bits >>= 1;
}
}
if (!this._refreshing) {
this._refreshing = true;
const bb: bank = bank ? 0 : 1;
for (let rr = addr - 1; rr <= addr + 1; rr++) {
const vv = this._buffer[bb][rr - 0x2000 * this.page];
this._write(rr >> 8, rr & 0xff, vv, bb);
}
this._refreshing = false;
}
} else {
val = this._buffer[0][base];
const hbs = val & 0x80;