apple2js/js/cards/parallel.ts

48 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-03-01 05:21:18 +00:00
import { debug } from '../util';
import { Card, Restorable, byte } from '../types';
import { rom } from '../roms/cards/parallel';
2016-11-22 05:17:34 +00:00
const LOC = {
IOREG: 0x80
} as const;
export interface ParallelState {}
export interface ParallelOptions {
putChar: (val: byte) => void;
}
2016-11-28 01:28:49 +00:00
export default class Parallel implements Card, Restorable<ParallelState> {
constructor(private cbs: ParallelOptions) {
debug('Parallel card');
}
private access(off: byte, val?: byte) {
switch (off & 0x8f) {
case LOC.IOREG:
if (this.cbs.putChar && val) {
this.cbs.putChar(val);
}
break;
default:
debug('Parallel card unknown softswitch', off);
2016-11-28 01:28:49 +00:00
}
return 0;
}
ioSwitch(off: byte, val?: byte) {
return this.access(off, val);
}
read(_page: byte, off: byte) {
return rom[off];
}
write() {}
getState() {
return {};
2016-11-28 01:28:49 +00:00
}
setState(_state: ParallelState) {}
}