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 LanguageCard from './cards/langcard';
|
|
|
|
import Parallel from './cards/parallel';
|
|
|
|
import RAMFactor from './cards/ramfactor';
|
2020-09-13 02:42:18 +00:00
|
|
|
import SmartPort from './cards/smartport';
|
2019-03-01 05:21:18 +00:00
|
|
|
import Thunderclock from './cards/thunderclock';
|
2019-12-27 23:04:07 +00:00
|
|
|
import VideoTerm from './cards/videoterm';
|
2019-03-01 05:21:18 +00:00
|
|
|
|
|
|
|
import apple2_charset from './roms/apple2_char';
|
2019-03-01 18:15:17 +00:00
|
|
|
import apple2j_charset from './roms/apple2j_char';
|
|
|
|
import apple2lc_charset from './roms/apple2lc_char';
|
|
|
|
import pigfont_charset from './roms/pigfont_char';
|
2019-03-01 05:21:18 +00:00
|
|
|
|
|
|
|
import Apple2ROM from './roms/fpbasic';
|
2020-11-24 16:48:14 +00:00
|
|
|
import Apple2jROM from './roms/apple2j';
|
2019-03-01 05:21:18 +00:00
|
|
|
import IntBASIC from './roms/intbasic';
|
|
|
|
import OriginalROM from './roms/original';
|
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
import { Apple2 } from './apple2';
|
2016-11-22 05:17:34 +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_type2');
|
2016-11-28 01:28:49 +00:00
|
|
|
var rom;
|
2019-12-27 23:04:07 +00:00
|
|
|
var characterRom = apple2_charset;
|
2020-07-19 21:53:01 +00:00
|
|
|
var sectors = 16;
|
2019-12-27 23:04:07 +00:00
|
|
|
|
2017-09-23 04:42:57 +00:00
|
|
|
switch (romVersion) {
|
2020-11-26 01:28:37 +00:00
|
|
|
case 'apple2':
|
|
|
|
rom = new IntBASIC();
|
|
|
|
break;
|
|
|
|
case 'apple213':
|
|
|
|
rom = new IntBASIC();
|
|
|
|
sectors = 13;
|
|
|
|
break;
|
|
|
|
case 'original':
|
|
|
|
rom = new OriginalROM();
|
|
|
|
break;
|
|
|
|
case 'apple2jplus':
|
|
|
|
rom = new Apple2jROM();
|
|
|
|
characterRom = apple2j_charset;
|
|
|
|
break;
|
|
|
|
case 'apple2pig':
|
|
|
|
rom = new Apple2ROM();
|
|
|
|
characterRom = pigfont_charset;
|
|
|
|
break;
|
|
|
|
case 'apple2lc':
|
|
|
|
rom = new Apple2ROM();
|
|
|
|
characterRom = apple2lc_charset;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rom = new Apple2ROM();
|
2016-11-28 01:28:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
var options = {
|
2021-02-22 02:38:21 +00:00
|
|
|
canvas: document.getElementById('screen'),
|
|
|
|
gl: prefs.readPref('gl_canvas', 'true') === 'true',
|
2019-12-27 23:04:07 +00:00
|
|
|
screen: [],
|
|
|
|
rom: rom,
|
|
|
|
characterRom: characterRom,
|
|
|
|
e: false,
|
|
|
|
enhanced: false,
|
|
|
|
cards: [],
|
|
|
|
tick: updateUI
|
|
|
|
};
|
2017-12-03 04:45:02 +00:00
|
|
|
|
2021-03-12 06:03:05 +00:00
|
|
|
export var apple2 = new Apple2(options);
|
2019-12-27 23:04:07 +00:00
|
|
|
var cpu = apple2.getCPU();
|
|
|
|
var io = apple2.getIO();
|
2017-09-23 04:42:57 +00:00
|
|
|
|
2019-03-13 04:11:00 +00:00
|
|
|
var printer = new Printer('#printer-modal .paper');
|
2019-02-19 04:42:50 +00:00
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
var lc = new LanguageCard(io, rom);
|
|
|
|
var parallel = new Parallel(io, printer);
|
2021-02-22 02:38:21 +00:00
|
|
|
var videoTerm = new VideoTerm(io);
|
2019-12-27 23:04:07 +00:00
|
|
|
var slinky = new RAMFactor(io, 1024 * 1024);
|
2020-07-19 21:53:01 +00:00
|
|
|
var disk2 = new DiskII(io, driveLights, sectors);
|
2019-12-27 23:04:07 +00:00
|
|
|
var clock = new Thunderclock(io);
|
2020-09-13 02:42:18 +00:00
|
|
|
var smartport = new SmartPort(io, cpu, { block: true });
|
2016-11-22 05:17:34 +00:00
|
|
|
|
2020-10-11 15:48:16 +00:00
|
|
|
initUI(apple2, disk2, smartport, printer, false);
|
2016-11-28 01:28:49 +00:00
|
|
|
|
2016-12-06 05:16:21 +00:00
|
|
|
io.setSlot(0, lc);
|
|
|
|
io.setSlot(1, parallel);
|
|
|
|
io.setSlot(2, slinky);
|
2019-12-27 23:04:07 +00:00
|
|
|
io.setSlot(4, clock);
|
|
|
|
io.setSlot(3, videoTerm);
|
2016-12-06 05:16:21 +00:00
|
|
|
io.setSlot(6, disk2);
|
2020-09-13 02:42:18 +00:00
|
|
|
io.setSlot(7, smartport);
|
2016-11-22 05:17:34 +00:00
|
|
|
|
2019-12-27 23:04:07 +00:00
|
|
|
cpu.addPageHandler(lc);
|