mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
66f3e04d8e
The major impetus for rewriting in UI, at least. Still some ironing to do, but much nicer than my attempt to do this using the old UI "framework".
78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
import Prefs from './prefs';
|
|
|
|
import { driveLights, initUI, updateUI } from './ui/apple2';
|
|
import Printer from './ui/printer';
|
|
import { MouseUI } from './ui/mouse';
|
|
|
|
import DiskII from './cards/disk2';
|
|
import Parallel from './cards/parallel';
|
|
import RAMFactor from './cards/ramfactor';
|
|
import SmartPort from './cards/smartport';
|
|
import Thunderclock from './cards/thunderclock';
|
|
import Mouse from './cards/mouse';
|
|
|
|
import { Apple2 } from './apple2';
|
|
|
|
const prefs = new Prefs();
|
|
const romVersion = prefs.readPref('computer_type2e');
|
|
let enhanced = false;
|
|
let rom: string;
|
|
let characterRom: string;
|
|
|
|
switch (romVersion) {
|
|
case 'apple2e':
|
|
rom = 'apple2e';
|
|
characterRom = 'apple2e_char';
|
|
break;
|
|
case 'apple2rm':
|
|
rom = 'apple2e';
|
|
characterRom = 'rmfont_char';
|
|
enhanced = true;
|
|
break;
|
|
case 'apple2ex':
|
|
rom = 'apple2ex';
|
|
characterRom = 'apple2enh_char';
|
|
enhanced = true;
|
|
break;
|
|
default:
|
|
rom = 'apple2enh';
|
|
characterRom = 'apple2enh_char';
|
|
enhanced = true;
|
|
}
|
|
|
|
const options = {
|
|
gl: prefs.readPref('gl_canvas', 'true') === 'true',
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
canvas: document.querySelector<HTMLCanvasElement>('#screen')!,
|
|
rom,
|
|
characterRom,
|
|
e: true,
|
|
enhanced,
|
|
tick: updateUI
|
|
};
|
|
|
|
export const apple2 = new Apple2(options);
|
|
apple2.ready.then(() => {
|
|
const io = apple2.getIO();
|
|
const cpu = apple2.getCPU();
|
|
|
|
const printer = new Printer('#printer-modal .paper');
|
|
const mouseUI = new MouseUI(options.canvas);
|
|
|
|
const parallel = new Parallel(printer);
|
|
const slinky = new RAMFactor(1024 * 1024);
|
|
const disk2 = new DiskII(io, driveLights);
|
|
const clock = new Thunderclock();
|
|
const smartport = new SmartPort(cpu, null, { block: !enhanced });
|
|
const mouse = new Mouse(cpu, mouseUI);
|
|
|
|
io.setSlot(1, parallel);
|
|
io.setSlot(2, slinky);
|
|
io.setSlot(4, mouse);
|
|
io.setSlot(5, clock);
|
|
io.setSlot(6, disk2);
|
|
io.setSlot(7, smartport);
|
|
|
|
initUI(apple2, disk2, smartport, printer, options.e);
|
|
}).catch(console.error);
|