2019-03-01 05:21:18 +00:00
|
|
|
import Prefs from './prefs';
|
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
import { driveLights, initUI, updateUI } from './ui/apple2';
|
2019-03-01 05:21:18 +00:00
|
|
|
import Printer from './ui/printer';
|
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
import DiskII from './cards/disk2';
|
2019-03-01 05:21:18 +00:00
|
|
|
import Parallel from './cards/parallel';
|
|
|
|
import RAMFactor from './cards/ramfactor';
|
|
|
|
import Thunderclock from './cards/thunderclock';
|
|
|
|
|
|
|
|
import apple2e_charset from './roms/apple2e_char';
|
|
|
|
import apple2enh_charset from './roms/apple2enh_char';
|
2019-03-01 18:15:17 +00:00
|
|
|
import rmfont_charset from './roms/rmfont_char';
|
2019-03-01 05:21:18 +00:00
|
|
|
|
|
|
|
import Apple2eROM from './roms/apple2e';
|
|
|
|
import Apple2eEnhancedROM from './roms/apple2enh';
|
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
import { Apple2 } from './apple2';
|
2019-02-19 04:42:50 +00:00
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
export * from './ui/apple2';
|
2016-11-22 05:17:34 +00:00
|
|
|
|
|
|
|
var prefs = new Prefs();
|
2017-09-23 04:42:57 +00:00
|
|
|
var romVersion = prefs.readPref('computer_type2e');
|
|
|
|
var enhanced = false;
|
|
|
|
var rom;
|
2019-12-27 23:04:07 +00:00
|
|
|
var characterRom = apple2e_charset;
|
|
|
|
|
2017-09-23 04:42:57 +00:00
|
|
|
switch (romVersion) {
|
|
|
|
case 'apple2e':
|
|
|
|
rom = new Apple2eROM();
|
|
|
|
break;
|
|
|
|
case 'apple2rm':
|
|
|
|
rom = new Apple2eEnhancedROM();
|
2019-12-27 23:04:07 +00:00
|
|
|
characterRom = rmfont_charset;
|
2017-09-23 04:42:57 +00:00
|
|
|
enhanced = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rom = new Apple2eEnhancedROM();
|
2019-12-27 23:04:07 +00:00
|
|
|
characterRom = apple2enh_charset;
|
2017-09-23 04:42:57 +00:00
|
|
|
enhanced = true;
|
|
|
|
}
|
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
var options = {
|
|
|
|
screen: [],
|
|
|
|
multiScreen: false,
|
|
|
|
rom: rom,
|
|
|
|
characterRom: characterRom,
|
|
|
|
e: true,
|
|
|
|
enhanced: enhanced,
|
|
|
|
cards: [],
|
|
|
|
tick: updateUI
|
|
|
|
};
|
2017-09-23 04:42:57 +00:00
|
|
|
|
|
|
|
var canvas1 = document.getElementById('screen');
|
|
|
|
var canvas2 = document.getElementById('screen2');
|
|
|
|
var canvas3 = document.getElementById('screen3');
|
|
|
|
var canvas4 = document.getElementById('screen4');
|
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
options.screen[0] = canvas1.getContext('2d');
|
2017-09-23 04:42:57 +00:00
|
|
|
if (canvas4) {
|
2019-12-27 23:04:07 +00:00
|
|
|
options.multiScreen = true;
|
|
|
|
options.screen[1] = canvas2.getContext('2d');
|
|
|
|
options.screen[2] = canvas3.getContext('2d');
|
|
|
|
options.screen[3] = canvas4.getContext('2d');
|
2017-09-23 04:42:57 +00:00
|
|
|
} else if (canvas2) {
|
2019-12-27 23:04:07 +00:00
|
|
|
options.multiScreen = true;
|
|
|
|
options.screen[1] = options.screen[0];
|
|
|
|
options.screen[2] = canvas2.getContext('2d');
|
|
|
|
options.screen[3] = options.screen[2];
|
2016-11-22 05:17:34 +00:00
|
|
|
} else {
|
2019-12-27 23:04:07 +00:00
|
|
|
options.screen[1] = options.screen[0];
|
|
|
|
options.screen[2] = options.screen[0];
|
|
|
|
options.screen[3] = options.screen[0];
|
2016-11-22 05:17:34 +00:00
|
|
|
}
|
2016-11-28 01:28:49 +00:00
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
var apple2 = new Apple2(options);
|
|
|
|
var io = apple2.getIO();
|
2016-11-22 05:17:34 +00:00
|
|
|
|
2019-03-13 04:11:00 +00:00
|
|
|
var printer = new Printer('#printer-modal .paper');
|
2016-11-22 05:17:34 +00:00
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
var parallel = new Parallel(io, printer);
|
|
|
|
var slinky = new RAMFactor(io, 1024 * 1024);
|
|
|
|
var disk2 = new DiskII(io, driveLights);
|
|
|
|
var clock = new Thunderclock(io);
|
2016-11-22 05:17:34 +00:00
|
|
|
|
2020-01-02 18:57:26 +00:00
|
|
|
initUI(apple2, disk2, options.e);
|
2016-11-22 05:17:34 +00:00
|
|
|
|
2016-12-06 05:16:21 +00:00
|
|
|
io.setSlot(1, parallel);
|
|
|
|
io.setSlot(2, slinky);
|
2019-12-27 23:04:07 +00:00
|
|
|
io.setSlot(4, clock);
|
2016-12-06 05:16:21 +00:00
|
|
|
io.setSlot(6, disk2);
|
2016-11-22 05:17:34 +00:00
|
|
|
|
|
|
|
|