Goose slot detection code

This commit is contained in:
Will Scullin 2021-03-08 19:28:52 -08:00
parent b9bd03b958
commit 63e49696b8
No known key found for this signature in database
GPG Key ID: 26DCD1042C6638CD
3 changed files with 12 additions and 2 deletions

View File

@ -11,7 +11,7 @@
import CPU6502 from './cpu6502'; import CPU6502 from './cpu6502';
import { Card, Memory, MemoryPages, TapeData, byte, Restorable } from './types'; import { Card, Memory, MemoryPages, TapeData, byte, Restorable } from './types';
import { debug } from './util'; import { debug, garbage } from './util';
type slot = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; type slot = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
type button = 0 | 1 | 2; type button = 0 | 1 | 2;
@ -364,6 +364,8 @@ export default class Apple2IO implements MemoryPages, Restorable<Apple2IOState>
} }
if (card) { if (card) {
result = card.read(page, off); result = card.read(page, off);
} else {
result = garbage();
} }
break; break;
default: default:

View File

@ -392,17 +392,25 @@ export default class MMU implements Memory, Restorable<MMUState> {
if (this._intcxrom) { if (this._intcxrom) {
for (let idx = 0xc1; idx < 0xd0; idx++) { for (let idx = 0xc1; idx < 0xd0; idx++) {
this._readPages[idx] = this._pages[idx][1]; this._readPages[idx] = this._pages[idx][1];
this._writePages[idx] = this._pages[idx][1];
}
if (this._slot3rom) {
this._readPages[0xc3] = this._pages[0xc3][0];
this._writePages[0xc3] = this._pages[0xc3][0];
} }
} else { } else {
for (let idx = 0xc1; idx < 0xd0; idx++) { for (let idx = 0xc1; idx < 0xd0; idx++) {
this._readPages[idx] = this._pages[idx][0]; this._readPages[idx] = this._pages[idx][0];
this._writePages[idx] = this._pages[idx][0];
} }
if (!this._slot3rom) { if (!this._slot3rom) {
this._readPages[0xc3] = this._pages[0xc3][1]; this._readPages[0xc3] = this._pages[0xc3][1];
this._writePages[0xc3] = this._pages[0xc3][1];
} }
if (this._intc8rom) { if (this._intc8rom) {
for (let idx = 0xc8; idx < 0xd0; idx++) { for (let idx = 0xc8; idx < 0xd0; idx++) {
this._readPages[idx] = this._pages[idx][1]; this._readPages[idx] = this._pages[idx][1];
this._writePages[idx] = this._pages[idx][1];
} }
} }
} }

View File

@ -17,7 +17,7 @@ const hex_digits = '0123456789ABCDEF';
const bin_digits = '01'; const bin_digits = '01';
/** Returns a random byte. */ /** Returns a random byte. */
function garbage(): byte { export function garbage(): byte {
return (Math.random() * 0x100) & 0xff; return (Math.random() * 0x100) & 0xff;
} }