mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Convert to webpack first pass.
This commit is contained in:
parent
b8261252e3
commit
573f36510d
@ -20,7 +20,11 @@
|
||||
"env": {
|
||||
"builtin": true,
|
||||
"browser": true,
|
||||
"jquery": true
|
||||
"jquery": true,
|
||||
"es6": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.*~
|
||||
.checked-*.js
|
||||
node_modules
|
||||
/dist
|
||||
/node_modules
|
||||
|
@ -44,32 +44,6 @@
|
||||
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js">
|
||||
</script>
|
||||
|
||||
<!-- Emulator Scripts -->
|
||||
<script type="text/javascript" src="js/util.js"></script>
|
||||
<script type="text/javascript" src="js/prefs.js"></script>
|
||||
<script type="text/javascript" src="js/ram.js"></script>
|
||||
<script type="text/javascript" src="js/applesoft/decompiler.js"></script>
|
||||
<script type="text/javascript" src="js/intbasic/decompiler.js"></script>
|
||||
<script type="text/javascript" src="js/canvas.js"></script>
|
||||
<script type="text/javascript" src="js/apple2io.js"></script>
|
||||
<script type="text/javascript" src="js/cards/langcard.js"></script>
|
||||
<script type="text/javascript" src="js/cards/parallel.js"></script>
|
||||
<script type="text/javascript" src="js/cards/videoterm.js"></script>
|
||||
<script type="text/javascript" src="js/cards/disk2.js"></script>
|
||||
<script type="text/javascript" src="js/cards/ramfactor.js"></script>
|
||||
<script type="text/javascript" src="js/cards/thunderclock.js"></script>
|
||||
<script type="text/javascript" src="js/cpu6502.js"></script>
|
||||
<script type="text/javascript" src="js/base64.js"></script>
|
||||
<script type="text/javascript" src="js/roms/fpbasic.js"></script>
|
||||
<script type="text/javascript" src="js/roms/intbasic.js"></script>
|
||||
<script type="text/javascript" src="js/roms/original.js"></script>
|
||||
<script type="text/javascript" src="js/roms/apple2_char.js"></script>
|
||||
<script type="text/javascript" src="js/ui/audio.js"></script>
|
||||
<script type="text/javascript" src="js/ui/keyboard.js"></script>
|
||||
<script type="text/javascript" src="js/ui/gamepad.js"></script>
|
||||
<script type="text/javascript" src="js/ui/printer.js"></script>
|
||||
<script type="text/javascript" src="js/ui/tape.js"></script>
|
||||
|
||||
<!-- Disk Index -->
|
||||
<script type="text/javascript" src="json/disks/index.js"></script>
|
||||
|
||||
@ -310,6 +284,6 @@
|
||||
<div class="paper">
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/main2.js"></script>
|
||||
<script src="dist/main2.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright 2010-2016 Will Scullin <scullin@scullinsteel.com>
|
||||
Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -44,31 +44,6 @@
|
||||
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js">
|
||||
</script>
|
||||
|
||||
<!-- Emulator Scripts -->
|
||||
<script type="text/javascript" src="js/util.js"></script>
|
||||
<script type="text/javascript" src="js/prefs.js"></script>
|
||||
<script type="text/javascript" src="js/ram.js"></script>
|
||||
<script type="text/javascript" src="js/mmu.js"></script>
|
||||
<script type="text/javascript" src="js/applesoft/decompiler.js"></script>
|
||||
<script type="text/javascript" src="js/intbasic/decompiler.js"></script>
|
||||
<script type="text/javascript" src="js/canvas.js"></script>
|
||||
<script type="text/javascript" src="js/apple2io.js"></script>
|
||||
<script type="text/javascript" src="js/cards/parallel.js"></script>
|
||||
<script type="text/javascript" src="js/cards/disk2.js"></script>
|
||||
<script type="text/javascript" src="js/cards/ramfactor.js"></script>
|
||||
<script type="text/javascript" src="js/cards/thunderclock.js"></script>
|
||||
<script type="text/javascript" src="js/cpu6502.js"></script>
|
||||
<script type="text/javascript" src="js/base64.js"></script>
|
||||
<script type="text/javascript" src="js/roms/apple2e.js"></script>
|
||||
<script type="text/javascript" src="js/roms/apple2enh.js"></script>
|
||||
<script type="text/javascript" src="js/roms/apple2e_char.js"></script>
|
||||
<script type="text/javascript" src="js/roms/apple2enh_char.js"></script>
|
||||
<script type="text/javascript" src="js/ui/audio.js"></script>
|
||||
<script type="text/javascript" src="js/ui/keyboard.js"></script>
|
||||
<script type="text/javascript" src="js/ui/gamepad.js"></script>
|
||||
<script type="text/javascript" src="js/ui/printer.js"></script>
|
||||
<script type="text/javascript" src="js/ui/tape.js"></script>
|
||||
|
||||
<!-- Disk Index -->
|
||||
<script type="text/javascript" src="json/disks/index.js"></script>
|
||||
|
||||
@ -287,6 +262,6 @@
|
||||
<div class="paper">
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/main2e.js"></script>
|
||||
<script type="text/javascript" src="dist/main2e.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2016 Will Scullin */
|
||||
/* Copyright 2010-2019 Will Scullin */
|
||||
|
||||
#header {
|
||||
width: 580px;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
var LOG = false;
|
||||
|
||||
function Test6502() {
|
||||
export default function Test6502() {
|
||||
var data = [
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
var LOG = false;
|
||||
|
||||
function Test65C02() {
|
||||
export default function Test65C02() {
|
||||
var data = [
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,13 +9,10 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*globals debug: false */
|
||||
/*exported Apple2IO */
|
||||
import { debug } from './util';
|
||||
|
||||
function Apple2IO(cpu, callbacks)
|
||||
export default function Apple2IO(cpu, callbacks)
|
||||
{
|
||||
'use strict';
|
||||
|
||||
var _slot = [];
|
||||
var _auxRom = null;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*exported ApplesoftDump */
|
||||
/*global debug */
|
||||
import { debug } from '../util';
|
||||
|
||||
function ApplesoftDump(mem)
|
||||
export default function ApplesoftDump(mem)
|
||||
{
|
||||
var _mem = mem;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*exported base64_encode, base64_decode */
|
||||
|
||||
function base64_encode (data) {
|
||||
export function base64_encode (data) {
|
||||
// Twacked by Will Scullin to handle arrays of "bytes"
|
||||
|
||||
// http://kevin.vanzonneveld.net
|
||||
@ -57,7 +57,7 @@ function base64_encode (data) {
|
||||
return enc;
|
||||
}
|
||||
|
||||
function base64_decode(data) {
|
||||
export function base64_decode(data) {
|
||||
// Twacked by Will Scullin to handle arrays of "bytes"
|
||||
|
||||
// http://kevin.vanzonneveld.net
|
||||
|
21
js/canvas.js
21
js/canvas.js
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,11 +9,10 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*globals allocMemPages: false, debug: false,
|
||||
base64_encode: false, base64_decode: false,
|
||||
enhanced: false */
|
||||
/*exported LoresPage, HiresPage, VideoModes, scanlines, multiScreen */
|
||||
import { base64_decode, base64_encode } from './base64';
|
||||
import { allocMemPages, debug } from './util';
|
||||
|
||||
var enhanced = false;
|
||||
var multiScreen = false;
|
||||
var textMode = true;
|
||||
var mixedMode = false;
|
||||
@ -52,7 +51,7 @@ var blackCol = [0x00, 0x00, 0x00];
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
function LoresPage(page, charset, e, context)
|
||||
export function LoresPage(page, charset, e, context)
|
||||
{
|
||||
'use strict';
|
||||
|
||||
@ -479,7 +478,7 @@ function LoresPage(page, charset, e, context)
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
function HiresPage(page, context)
|
||||
export function HiresPage(page, context)
|
||||
{
|
||||
'use strict';
|
||||
|
||||
@ -912,7 +911,7 @@ function HiresPage(page, context)
|
||||
};
|
||||
}
|
||||
|
||||
function VideoModes(gr, hgr, gr2, hgr2, e) {
|
||||
export function VideoModes(gr, hgr, gr2, hgr2, e) {
|
||||
var _grs = [gr, gr2];
|
||||
var _hgrs = [hgr, hgr2];
|
||||
var _seq = '';
|
||||
@ -1052,6 +1051,12 @@ function VideoModes(gr, hgr, gr2, hgr2, e) {
|
||||
_refresh();
|
||||
}
|
||||
},
|
||||
enhanced: function(on) {
|
||||
enhanced = on;
|
||||
},
|
||||
multiScreen: function(on) {
|
||||
multiScreen = on;
|
||||
},
|
||||
isText: function() {
|
||||
return textMode;
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,16 +9,11 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported DiskII */
|
||||
/*globals bytify: false, debug: false
|
||||
base64_decode: false, base64_encode: false
|
||||
Uint8Array: false
|
||||
*/
|
||||
import { base64_decode, base64_encode } from '../base64';
|
||||
import { bytify, debug } from '../util';
|
||||
|
||||
function DiskII(io, slot, callbacks)
|
||||
export default function DiskII(io, slot, callbacks)
|
||||
{
|
||||
'use strict';
|
||||
|
||||
slot = slot || 6;
|
||||
var _drives = [
|
||||
{ // Drive 1
|
||||
@ -791,6 +786,22 @@ function DiskII(io, slot, callbacks)
|
||||
var s = _drives[disk - 1].fmt == 'po' ? _PO[sector] : _DO[sector];
|
||||
return _readSector(disk, track, s);
|
||||
},
|
||||
getMetadata: function disk_getMetadata(driveNo) {
|
||||
var drive = _drives[driveNo - 1];
|
||||
if (drive.tracks.length) {
|
||||
return {
|
||||
format: drive.format,
|
||||
volume: drive.volume,
|
||||
track: drive.track,
|
||||
head: drive.head,
|
||||
phase: drive.phase,
|
||||
readOnly: drive.readOnly,
|
||||
dirty: drive.dirty
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
setDisk: function disk2_setDisk(drive, disk) {
|
||||
var fmt = disk.type, readOnly = disk.readOnly;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,13 +9,10 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported LanguageCard */
|
||||
/*globals debug: false
|
||||
RAM: false */
|
||||
|
||||
function LanguageCard(io, slot, rom) {
|
||||
'use strict';
|
||||
import RAM from '../ram';
|
||||
import { debug } from '../util';
|
||||
|
||||
export default function LanguageCard(io, slot, rom) {
|
||||
var _rom = rom;
|
||||
var _bank1 = null;
|
||||
var _bank2 = null;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,12 +9,9 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported Parallel */
|
||||
/*globals debug: false */
|
||||
|
||||
function Parallel(io, slot, cbs) {
|
||||
'use strict';
|
||||
import { debug } from '../util';
|
||||
|
||||
export default function Parallel(io, slot, cbs) {
|
||||
slot = slot || 1;
|
||||
|
||||
debug('Parallel card in slot', slot);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,13 +9,10 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported RAMFactor */
|
||||
/*globals allocMem: false, bytify: false, debug: false,
|
||||
base64_encode: false, base64_decode: false
|
||||
*/
|
||||
function RAMFactor(io, slot, size) {
|
||||
'use strict';
|
||||
import { base64_decode, base64_encode } from '../base64';
|
||||
import { allocMem, bytify, debug } from '../util';
|
||||
|
||||
export default function RAMFactor(io, slot, size) {
|
||||
var rom = [
|
||||
0x43,0x4f,0x50,0x59,0x52,0x49,0x47,0x48,
|
||||
0x54,0x20,0x28,0x43,0x29,0x20,0x31,0x39,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,13 +9,10 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported Thunderclock */
|
||||
/*global debug: false */
|
||||
import { debug } from '../util';
|
||||
|
||||
function Thunderclock(io, slot)
|
||||
export default function Thunderclock(io, slot)
|
||||
{
|
||||
'use strict';
|
||||
|
||||
var rom = [
|
||||
0x08,0x78,0x28,0x2c,0x58,0xff,0x70,0x05, // 00
|
||||
0x38,0xb0,0x01,0x18,0xb8,0x08,0x78,0x48,
|
||||
|
@ -9,12 +9,9 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported Videoterm */
|
||||
/*globals debug: false, allocMemPages: false */
|
||||
|
||||
function Videoterm(io, slot, context) {
|
||||
'use strict';
|
||||
import { allocMemPages, debug } from '../util';
|
||||
|
||||
export default function Videoterm(io, slot, context) {
|
||||
slot = slot || 3;
|
||||
|
||||
debug('Videx Videoterm card in slot', slot);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -10,10 +10,9 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported CPU6502 */
|
||||
/*globals debug: false, toHex: false */
|
||||
import { debug, toHex } from './util';
|
||||
|
||||
function CPU6502(options)
|
||||
export default function CPU6502(options)
|
||||
{
|
||||
'use strict';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*exported IntBasicDump */
|
||||
|
||||
function IntBasicDump(mem)
|
||||
export default function IntBasicDump(mem)
|
||||
{
|
||||
var _mem = mem;
|
||||
|
||||
|
153
js/main2.js
153
js/main2.js
@ -1,38 +1,31 @@
|
||||
/* globals debug: false, gup: false, hup: false, toHex: false,
|
||||
CPU6502: false,
|
||||
RAM: false,
|
||||
Apple2ROM: false, IntBASIC: false, OriginalROM: false,
|
||||
Apple2jROM: false,
|
||||
apple2_charset: false, apple2j_charset: false,
|
||||
pigfont_charset: false, apple2lc_charset: false,
|
||||
Apple2IO: false
|
||||
LoresPage: false, HiresPage: false, VideoModes: false,
|
||||
KeyBoard: false,
|
||||
Parallel: false,
|
||||
Videoterm: false,
|
||||
DiskII: false,
|
||||
Printer: false,
|
||||
LanguageCard: false,
|
||||
RAMFactor: false,
|
||||
Thunderclock: false,
|
||||
Prefs: false,
|
||||
disk_index: false,
|
||||
Audio: false,
|
||||
initGamepad: false, processGamepad: false, gamepad: false,
|
||||
Tape: false,
|
||||
ApplesoftDump: false, SYMBOLS: false,
|
||||
multiScreen: true
|
||||
*/
|
||||
/* exported openLoad, openSave, doDelete, handleDragOver, handleDragEnd, handleDrop,
|
||||
selectCategory, selectDisk, clickDisk,
|
||||
multiScreen,
|
||||
updateJoystick,
|
||||
pauseRun, step,
|
||||
toggleSound,
|
||||
restoreState, saveState,
|
||||
dumpProgram, PageDebug,
|
||||
enhanced
|
||||
*/
|
||||
import Apple2IO from './apple2io';
|
||||
import ApplesoftDump from './applesoft/decompiler';
|
||||
import { HiresPage, LoresPage, VideoModes, multiScreen } from './canvas';
|
||||
import CPU6502 from './cpu6502';
|
||||
import Prefs from './prefs';
|
||||
import RAM from './ram';
|
||||
import { debug, gup, hup } from './util';
|
||||
|
||||
import Audio from './ui/audio';
|
||||
import { gamepad, initGamepad, processGamepad } from './ui/gamepad';
|
||||
import KeyBoard from './ui/keyboard';
|
||||
import Printer from './ui/printer';
|
||||
import Tape from './ui/tape';
|
||||
|
||||
import DiskII from './cards/disk2';
|
||||
import LanguageCard from './cards/langcard';
|
||||
import Parallel from './cards/parallel';
|
||||
import RAMFactor from './cards/ramfactor';
|
||||
import Thunderclock from './cards/thunderclock';
|
||||
import Videoterm from './cards/videoterm';
|
||||
|
||||
import apple2_charset from './roms/apple2_char';
|
||||
|
||||
import Apple2ROM from './roms/fpbasic';
|
||||
import IntBASIC from './roms/intbasic';
|
||||
import OriginalROM from './roms/original';
|
||||
|
||||
import SYMBOLS from './symbols';
|
||||
|
||||
var kHz = 1023;
|
||||
|
||||
@ -53,6 +46,7 @@ var trace = [];
|
||||
* Page viewer
|
||||
*/
|
||||
|
||||
/*
|
||||
function PageDebug(page)
|
||||
{
|
||||
var _page = page;
|
||||
@ -84,6 +78,7 @@ function PageDebug(page)
|
||||
}
|
||||
};
|
||||
}
|
||||
*/
|
||||
|
||||
var disk_categories = {'Local Saves': []};
|
||||
var disk_sets = {};
|
||||
@ -129,7 +124,7 @@ var TAPE_TYPES = ['wav','aiff','aif','mp3','m4a'];
|
||||
|
||||
var _currentDrive = 1;
|
||||
|
||||
function openLoad(drive, event)
|
||||
window.openLoad = function(drive, event)
|
||||
{
|
||||
_currentDrive = parseInt(drive, 10);
|
||||
if (event.metaKey) {
|
||||
@ -140,9 +135,9 @@ function openLoad(drive, event)
|
||||
}
|
||||
$('#load').dialog('open');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function openSave(drive, event)
|
||||
window.openSave = function(drive, event)
|
||||
{
|
||||
_currentDrive = parseInt(drive, 10);
|
||||
|
||||
@ -160,14 +155,14 @@ function openSave(drive, event)
|
||||
$('#save_name').val(drivelights.label(drive));
|
||||
$('#save').dialog('open');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function handleDragOver(drive, event) {
|
||||
window.handleDragOver = function(drive, event) {
|
||||
event.preventDefault();
|
||||
event.dataTransfer.dropEffect = 'copy';
|
||||
}
|
||||
};
|
||||
|
||||
function handleDragEnd(drive, event) {
|
||||
window.handleDragEnd = function(drive, event) {
|
||||
var dt = event.dataTransfer;
|
||||
if (dt.items) {
|
||||
for (var i = 0; i < dt.items.length; i++) {
|
||||
@ -176,9 +171,9 @@ function handleDragEnd(drive, event) {
|
||||
} else {
|
||||
event.dataTransfer.clearData();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function handleDrop(drive, event) {
|
||||
window.handleDrop = function(drive, event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
@ -208,7 +203,7 @@ function handleDrop(drive, event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var loading = false;
|
||||
|
||||
@ -282,11 +277,11 @@ function doSave() {
|
||||
$('#save').dialog('close');
|
||||
}
|
||||
|
||||
function doDelete(name) {
|
||||
window.doDelete = function(name) {
|
||||
if (window.confirm('Delete ' + name + '?')) {
|
||||
deleteLocalStorage(name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function doLoadLocal(drive, file) {
|
||||
var parts = file.name.split('.');
|
||||
@ -352,7 +347,7 @@ function openManage() {
|
||||
|
||||
var prefs = new Prefs();
|
||||
var romVersion = prefs.readPref('computer_type2');
|
||||
var enhanced = false;
|
||||
export var enhanced = false;
|
||||
var rom;
|
||||
var char_rom = apple2_charset;
|
||||
switch (romVersion) {
|
||||
@ -362,18 +357,18 @@ case 'apple2':
|
||||
case'original':
|
||||
rom = new OriginalROM();
|
||||
break;
|
||||
case 'apple2jplus':
|
||||
rom = new Apple2jROM();
|
||||
char_rom = apple2j_charset;
|
||||
break;
|
||||
case 'apple2pig':
|
||||
rom = new Apple2ROM();
|
||||
char_rom = pigfont_charset;
|
||||
break;
|
||||
case 'apple2lc':
|
||||
rom = new Apple2ROM();
|
||||
char_rom = apple2lc_charset;
|
||||
break;
|
||||
// case 'apple2jplus':
|
||||
// rom = new Apple2jROM();
|
||||
// char_rom = apple2j_charset;
|
||||
// break;
|
||||
// case 'apple2pig':
|
||||
// rom = new Apple2ROM();
|
||||
// char_rom = pigfont_charset;
|
||||
// break;
|
||||
// case 'apple2lc':
|
||||
// rom = new Apple2ROM();
|
||||
// char_rom = apple2lc_charset;
|
||||
// break;
|
||||
default:
|
||||
rom = new Apple2ROM();
|
||||
}
|
||||
@ -420,7 +415,7 @@ var dumper = new ApplesoftDump(cpu);
|
||||
|
||||
var drivelights = new DriveLights();
|
||||
var io = new Apple2IO(cpu, vm);
|
||||
var keyboard = new KeyBoard(io);
|
||||
var keyboard = new KeyBoard(cpu, io);
|
||||
var audio = new Audio(io);
|
||||
var tape = new Tape(io);
|
||||
var printer = new Printer($('#printer .paper'));
|
||||
@ -492,16 +487,16 @@ function dumpDisk(drive) {
|
||||
wind.document.close();
|
||||
}
|
||||
|
||||
function dumpProgram() {
|
||||
window.dumpProgram = function() {
|
||||
var wind = window.open('', '_blank');
|
||||
wind.document.title = 'Program Listing';
|
||||
wind.document.write('<pre>');
|
||||
wind.document.write(dumper.toString());
|
||||
wind.document.write('</pre>');
|
||||
wind.document.close();
|
||||
}
|
||||
};
|
||||
|
||||
function step()
|
||||
window.step = function()
|
||||
{
|
||||
if (runTimer) {
|
||||
clearInterval(runTimer);
|
||||
@ -512,7 +507,7 @@ function step()
|
||||
debug(cpu.dumpRegisters());
|
||||
debug(cpu.dumpPC());
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var accelerated = false;
|
||||
|
||||
@ -685,7 +680,7 @@ function loadBinary(bin) {
|
||||
run(bin.start);
|
||||
}
|
||||
|
||||
function selectCategory() {
|
||||
window.selectCategory = function() {
|
||||
$('#disk_select').empty();
|
||||
var cat = disk_categories[$('#category_select').val()];
|
||||
if (cat) {
|
||||
@ -701,15 +696,15 @@ function selectCategory() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function selectDisk() {
|
||||
window.selectDisk = function() {
|
||||
$('#local_file').val('');
|
||||
}
|
||||
};
|
||||
|
||||
function clickDisk() {
|
||||
window.clickDisk = function() {
|
||||
doLoad();
|
||||
}
|
||||
};
|
||||
|
||||
function loadDisk(drive, disk) {
|
||||
var name = disk.name;
|
||||
@ -888,7 +883,7 @@ var flipX = false;
|
||||
var flipY = false;
|
||||
var swapXY = false;
|
||||
|
||||
function updateJoystick() {
|
||||
window.updateJoystick = function() {
|
||||
disableMouseJoystick = $('#disable_mouse').prop('checked');
|
||||
flipX = $('#flip_x').prop('checked');
|
||||
flipY = $('#flip_y').prop('checked');
|
||||
@ -899,7 +894,7 @@ function updateJoystick() {
|
||||
io.paddle(1, 0.5);
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function _mousemove(evt) {
|
||||
if (gamepad || disableMouseJoystick) {
|
||||
@ -921,7 +916,7 @@ function _mousemove(evt) {
|
||||
io.paddle(1, flipY ? 1 - y : y);
|
||||
}
|
||||
|
||||
function pauseRun() {
|
||||
window.pauseRun = function() {
|
||||
var label = $('#pause-run i');
|
||||
if (paused) {
|
||||
run();
|
||||
@ -931,13 +926,13 @@ function pauseRun() {
|
||||
label.removeClass('fa-pause').addClass('fa-play');
|
||||
}
|
||||
paused = !paused;
|
||||
}
|
||||
};
|
||||
|
||||
function toggleSound() {
|
||||
window.toggleSound = function() {
|
||||
var enableSound = $('#enable_sound');
|
||||
enableSound.prop('checked', !enableSound.prop('checked'));
|
||||
updateSound();
|
||||
}
|
||||
};
|
||||
|
||||
$(function() {
|
||||
hashtag = document.location.hash;
|
||||
@ -1052,8 +1047,8 @@ $(function() {
|
||||
}
|
||||
|
||||
var oldcat = '';
|
||||
for (var idx = 0; idx < disk_index.length; idx++) {
|
||||
var file = disk_index[idx];
|
||||
for (var idx = 0; idx < window.disk_index.length; idx++) {
|
||||
var file = window.disk_index[idx];
|
||||
var cat = file.category;
|
||||
var name = file.name, disk = file.disk;
|
||||
if (file.e) {
|
||||
|
155
js/main2e.js
155
js/main2e.js
@ -1,35 +1,29 @@
|
||||
/* globals debug: false, gup: false, hup: false, toHex: false,
|
||||
CPU6502: false,
|
||||
Apple2eROM: false, Apple2eEnhancedROM: false,
|
||||
apple2e_charset: false, rmfont_charset: false,
|
||||
apple2enh_charset: false,
|
||||
Apple2IO: false
|
||||
LoresPage: false, HiresPage: false, VideoModes: false,
|
||||
KeyBoard: false,
|
||||
Parallel: false,
|
||||
DiskII: false,
|
||||
Printer: false,
|
||||
MMU: false,
|
||||
RAMFactor: false,
|
||||
Thunderclock: false,
|
||||
Prefs: false,
|
||||
disk_index: false,
|
||||
Audio: false,
|
||||
initGamepad: false, processGamepad: false, gamepad: false,
|
||||
Tape: false,
|
||||
ApplesoftDump: false, SYMBOLS: false,
|
||||
multiScreen: true
|
||||
*/
|
||||
/* exported openLoad, openSave, doDelete, handleDragOver, handleDragEnd, handleDrop,
|
||||
selectCategory, selectDisk, clickDisk,
|
||||
multiScreen,
|
||||
updateJoystick,
|
||||
pauseRun, step,
|
||||
toggleSound,
|
||||
restoreState, saveState,
|
||||
dumpProgram, PageDebug,
|
||||
enhanced
|
||||
*/
|
||||
import Apple2IO from './apple2io';
|
||||
import ApplesoftDump from './applesoft/decompiler';
|
||||
import { HiresPage, LoresPage, VideoModes } from './canvas';
|
||||
import CPU6502 from './cpu6502';
|
||||
import MMU from './mmu';
|
||||
import Prefs from './prefs';
|
||||
import { debug, gup, hup } from './util';
|
||||
|
||||
import Audio from './ui/audio';
|
||||
import { gamepad, initGamepad, processGamepad } from './ui/gamepad';
|
||||
import KeyBoard from './ui/keyboard';
|
||||
import Printer from './ui/printer';
|
||||
import Tape from './ui/tape';
|
||||
|
||||
import DiskII from './cards/disk2';
|
||||
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';
|
||||
|
||||
import Apple2eROM from './roms/apple2e';
|
||||
import Apple2eEnhancedROM from './roms/apple2enh';
|
||||
|
||||
import SYMBOLS from './symbols';
|
||||
|
||||
var kHz = 1023;
|
||||
|
||||
@ -50,6 +44,7 @@ var trace = [];
|
||||
* Page viewer
|
||||
*/
|
||||
|
||||
/*
|
||||
function PageDebug(page)
|
||||
{
|
||||
var _page = page;
|
||||
@ -81,6 +76,7 @@ function PageDebug(page)
|
||||
}
|
||||
};
|
||||
}
|
||||
*/
|
||||
|
||||
var disk_categories = {'Local Saves': []};
|
||||
var disk_sets = {};
|
||||
@ -126,7 +122,7 @@ var TAPE_TYPES = ['wav','aiff','aif','mp3','m4a'];
|
||||
|
||||
var _currentDrive = 1;
|
||||
|
||||
function openLoad(drive, event)
|
||||
window.openLoad = function(drive, event)
|
||||
{
|
||||
_currentDrive = parseInt(drive, 10);
|
||||
if (event.metaKey) {
|
||||
@ -137,9 +133,9 @@ function openLoad(drive, event)
|
||||
}
|
||||
$('#load').dialog('open');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function openSave(drive, event)
|
||||
window.openSave = function(drive, event)
|
||||
{
|
||||
_currentDrive = parseInt(drive, 10);
|
||||
|
||||
@ -157,14 +153,14 @@ function openSave(drive, event)
|
||||
$('#save_name').val(drivelights.label(drive));
|
||||
$('#save').dialog('open');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function handleDragOver(drive, event) {
|
||||
window.handleDragOver = function(drive, event) {
|
||||
event.preventDefault();
|
||||
event.dataTransfer.dropEffect = 'copy';
|
||||
}
|
||||
};
|
||||
|
||||
function handleDragEnd(drive, event) {
|
||||
window.handleDragEnd = function(drive, event) {
|
||||
var dt = event.dataTransfer;
|
||||
if (dt.items) {
|
||||
for (var i = 0; i < dt.items.length; i++) {
|
||||
@ -173,9 +169,9 @@ function handleDragEnd(drive, event) {
|
||||
} else {
|
||||
event.dataTransfer.clearData();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function handleDrop(drive, event) {
|
||||
window.handleDrop = function(drive, event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
@ -195,7 +191,7 @@ function handleDrop(drive, event) {
|
||||
doLoadLocal(1, dt.files[0]);
|
||||
doLoadLocal(2, dt.files[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var loading = false;
|
||||
|
||||
@ -269,11 +265,11 @@ function doSave() {
|
||||
$('#save').dialog('close');
|
||||
}
|
||||
|
||||
function doDelete(name) {
|
||||
window.doDelete = function(name) {
|
||||
if (window.confirm('Delete ' + name + '?')) {
|
||||
deleteLocalStorage(name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function doLoadLocal(drive, file) {
|
||||
var parts = file.name.split('.');
|
||||
@ -340,17 +336,18 @@ function openManage() {
|
||||
var prefs = new Prefs();
|
||||
var romVersion = prefs.readPref('computer_type2e');
|
||||
var enhanced = false;
|
||||
var multiScreen = false;
|
||||
var rom;
|
||||
var char_rom = apple2e_charset;
|
||||
switch (romVersion) {
|
||||
case 'apple2e':
|
||||
rom = new Apple2eROM();
|
||||
break;
|
||||
case 'apple2rm':
|
||||
rom = new Apple2eEnhancedROM();
|
||||
char_rom = rmfont_charset;
|
||||
enhanced = true;
|
||||
break;
|
||||
// case 'apple2rm':
|
||||
// rom = new Apple2eEnhancedROM();
|
||||
// char_rom = rmfont_charset;
|
||||
// enhanced = true;
|
||||
// break;
|
||||
default:
|
||||
rom = new Apple2eEnhancedROM();
|
||||
char_rom =apple2enh_charset;
|
||||
@ -390,11 +387,13 @@ var hgr = new HiresPage(1, context3);
|
||||
var hgr2 = new HiresPage(2, context4);
|
||||
|
||||
var vm = new VideoModes(gr, hgr, gr2, hgr2, true);
|
||||
vm.enhanced(enhanced);
|
||||
vm.multiScreen(multiScreen);
|
||||
var dumper = new ApplesoftDump(cpu);
|
||||
|
||||
var drivelights = new DriveLights();
|
||||
var io = new Apple2IO(cpu, vm);
|
||||
var keyboard = new KeyBoard(io, true);
|
||||
var keyboard = new KeyBoard(cpu, io, true);
|
||||
var audio = new Audio(io);
|
||||
var tape = new Tape(io);
|
||||
var printer = new Printer($('#printer .paper'));
|
||||
@ -436,7 +435,7 @@ function updateKHz() {
|
||||
lastFrames = renderedFrames;
|
||||
}
|
||||
|
||||
function updateSound() {
|
||||
window.updateSound = function() {
|
||||
var on = $('#enable_sound').prop('checked');
|
||||
var label = $('#toggle-sound i');
|
||||
audio.enable(on);
|
||||
@ -445,7 +444,7 @@ function updateSound() {
|
||||
} else {
|
||||
label.removeClass('fa-volume-up').addClass('fa-volume-off');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function dumpDisk(drive) {
|
||||
var wind = window.open('', '_blank');
|
||||
@ -456,16 +455,16 @@ function dumpDisk(drive) {
|
||||
wind.document.close();
|
||||
}
|
||||
|
||||
function dumpProgram() {
|
||||
window.dumpProgram = function() {
|
||||
var wind = window.open('', '_blank');
|
||||
wind.document.title = 'Program Listing';
|
||||
wind.document.write('<pre>');
|
||||
wind.document.write(dumper.toString());
|
||||
wind.document.write('</pre>');
|
||||
wind.document.close();
|
||||
}
|
||||
};
|
||||
|
||||
function step()
|
||||
window.step = function()
|
||||
{
|
||||
if (runTimer) {
|
||||
clearInterval(runTimer);
|
||||
@ -476,11 +475,11 @@ function step()
|
||||
debug(cpu.dumpRegisters());
|
||||
debug(cpu.dumpPC());
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var accelerated = false;
|
||||
|
||||
function updateCPU()
|
||||
window.updateCPU = function()
|
||||
{
|
||||
accelerated = $('#accelerator_toggle').prop('checked');
|
||||
kHz = accelerated ? 4092 : 1023;
|
||||
@ -488,7 +487,7 @@ function updateCPU()
|
||||
if (runTimer) {
|
||||
run();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var _requestAnimationFrame =
|
||||
window.requestAnimationFrame ||
|
||||
@ -634,7 +633,7 @@ function loadBinary(bin) {
|
||||
run(bin.start);
|
||||
}
|
||||
|
||||
function selectCategory() {
|
||||
window.selectCategory = function() {
|
||||
$('#disk_select').empty();
|
||||
var cat = disk_categories[$('#category_select').val()];
|
||||
if (cat) {
|
||||
@ -650,15 +649,15 @@ function selectCategory() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function selectDisk() {
|
||||
window.selectDisk = function() {
|
||||
$('#local_file').val('');
|
||||
}
|
||||
};
|
||||
|
||||
function clickDisk() {
|
||||
window.clickDisk = function() {
|
||||
doLoad();
|
||||
}
|
||||
};
|
||||
|
||||
function loadDisk(drive, disk) {
|
||||
var name = disk.name;
|
||||
@ -843,20 +842,20 @@ function _keyup(evt) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateScreen() {
|
||||
window.updateScreen = function() {
|
||||
var green = $('#green_screen').prop('checked');
|
||||
var scanlines = $('#show_scanlines').prop('checked');
|
||||
|
||||
vm.green(green);
|
||||
vm.scanlines(scanlines);
|
||||
}
|
||||
};
|
||||
|
||||
var disableMouseJoystick = false;
|
||||
var flipX = false;
|
||||
var flipY = false;
|
||||
var swapXY = false;
|
||||
|
||||
function updateJoystick() {
|
||||
window.updateJoystick = function() {
|
||||
disableMouseJoystick = $('#disable_mouse').prop('checked');
|
||||
flipX = $('#flip_x').prop('checked');
|
||||
flipY = $('#flip_y').prop('checked');
|
||||
@ -867,7 +866,7 @@ function updateJoystick() {
|
||||
io.paddle(1, 0.5);
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function _mousemove(evt) {
|
||||
if (gamepad || disableMouseJoystick) {
|
||||
@ -889,7 +888,7 @@ function _mousemove(evt) {
|
||||
io.paddle(1, flipY ? 1 - y : y);
|
||||
}
|
||||
|
||||
function pauseRun() {
|
||||
window.pauseRun = function() {
|
||||
var label = $('#pause-run i');
|
||||
if (paused) {
|
||||
run();
|
||||
@ -899,13 +898,13 @@ function pauseRun() {
|
||||
label.removeClass('fa-pause').addClass('fa-play');
|
||||
}
|
||||
paused = !paused;
|
||||
}
|
||||
};
|
||||
|
||||
function toggleSound() {
|
||||
window.toggleSound = function() {
|
||||
var enableSound = $('#enable_sound');
|
||||
enableSound.prop('checked', !enableSound.prop('checked'));
|
||||
updateSound();
|
||||
}
|
||||
window.updateSound();
|
||||
};
|
||||
|
||||
$(function() {
|
||||
hashtag = document.location.hash;
|
||||
@ -968,9 +967,9 @@ $(function() {
|
||||
|
||||
reset();
|
||||
setInterval(updateKHz, 1000);
|
||||
updateSound();
|
||||
updateScreen();
|
||||
updateCPU();
|
||||
window.updateSound();
|
||||
window.updateScreen();
|
||||
window.updateCPU();
|
||||
|
||||
var cancel = function() { $(this).dialog('close'); };
|
||||
$('#loading').dialog({ autoOpen: false, modal: true });
|
||||
@ -1020,8 +1019,8 @@ $(function() {
|
||||
}
|
||||
|
||||
var oldcat = '';
|
||||
for (var idx = 0; idx < disk_index.length; idx++) {
|
||||
var file = disk_index[idx];
|
||||
for (var idx = 0; idx < window.disk_index.length; idx++) {
|
||||
var file = window.disk_index[idx];
|
||||
var cat = file.category;
|
||||
var name = file.name, disk = file.disk;
|
||||
if (cat != oldcat) {
|
||||
|
12
js/mmu.js
12
js/mmu.js
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,15 +9,11 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported MMU */
|
||||
/*globals debug: false, toHex: false
|
||||
RAM: false
|
||||
*/
|
||||
import RAM from './ram';
|
||||
import { debug, toHex } from './util';
|
||||
|
||||
function MMU(cpu, vm, lores1, lores2, hires1, hires2, io, rom)
|
||||
export default function MMU(cpu, vm, lores1, lores2, hires1, hires2, io, rom)
|
||||
{
|
||||
'use strict';
|
||||
|
||||
var idx;
|
||||
|
||||
var _readPages = new Array(0x100);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,12 +9,8 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported Prefs */
|
||||
|
||||
function Prefs()
|
||||
export default function Prefs()
|
||||
{
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
havePrefs: function() {
|
||||
return typeof(localStorage) != 'undefined';
|
||||
|
12
js/ram.js
12
js/ram.js
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,14 +9,10 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*exported RAM */
|
||||
/*globals allocMemPages: false
|
||||
base64_encode: false, base64_decode: false
|
||||
*/
|
||||
|
||||
function RAM(sp, ep) {
|
||||
'use strict';
|
||||
import { base64_decode, base64_encode } from './base64';
|
||||
import { allocMemPages } from './util';
|
||||
|
||||
export default function RAM(sp, ep) {
|
||||
var mem;
|
||||
var start_page = sp;
|
||||
var end_page = ep;
|
||||
|
@ -258,3 +258,5 @@ var apple2_charset = [
|
||||
0x80,0x90,0x88,0x84,0x82,0x84,0x88,0x90,
|
||||
0x80,0x9c,0xa2,0x84,0x88,0x88,0x80,0x88
|
||||
];
|
||||
|
||||
export default apple2_charset;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*exported Apple2eROM*/
|
||||
|
||||
function Apple2eROM()
|
||||
export default function Apple2eROM()
|
||||
{
|
||||
var rom = [
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
|
@ -514,3 +514,5 @@ var apple2e_charset = [
|
||||
0x81,0x81,0x11,0x44,0x81,0x81,0x00,0x00,
|
||||
0x80,0x80,0x00,0x00,0x80,0x80,0x00,0x00
|
||||
];
|
||||
|
||||
export default apple2e_charset;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*exported Apple2eEnhancedROM */
|
||||
|
||||
function Apple2eEnhancedROM()
|
||||
export default function Apple2eEnhancedROM()
|
||||
{
|
||||
var rom = [
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
|
@ -514,3 +514,5 @@ var apple2enh_charset = [
|
||||
0x81,0x81,0x11,0x44,0x81,0x81,0x00,0x00,
|
||||
0x80,0x80,0x00,0x00,0x80,0x80,0x00,0x00
|
||||
];
|
||||
|
||||
export default apple2enh_charset;
|
||||
|
@ -1,5 +1,4 @@
|
||||
/*exported Apple2ROM */
|
||||
function Apple2ROM()
|
||||
export default function Apple2ROM()
|
||||
{
|
||||
var rom = [
|
||||
0x6f,0xd8,0x65,0xd7,0xf8,0xdc,0x94,0xd9,
|
||||
|
@ -1,6 +1,4 @@
|
||||
/*exported IntBASIC */
|
||||
|
||||
function IntBASIC()
|
||||
export default function IntBASIC()
|
||||
{
|
||||
var rom = [
|
||||
0xa9,0x20,0x8d,0x26,0x03,0xad,0x57,0xc0,
|
||||
|
@ -1,6 +1,4 @@
|
||||
/*exported OriginalROM */
|
||||
|
||||
function OriginalROM()
|
||||
export default function OriginalROM()
|
||||
{
|
||||
var rom = [
|
||||
0xa9,0x20,0x8d,0x26,0x03,0xad,0x57,0xc0,
|
||||
|
@ -740,3 +740,5 @@ var SYMBOLS = {
|
||||
0xFEFD: 'MON.READ',
|
||||
0xFF02: 'MON.READ2'
|
||||
};
|
||||
|
||||
export default SYMBOLS;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,14 +9,13 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*globals debug: false */
|
||||
/*exported Audio */
|
||||
import { debug } from '../util';
|
||||
|
||||
/*
|
||||
* Audio Handling
|
||||
*/
|
||||
|
||||
function Audio(io) {
|
||||
export default function Audio(io) {
|
||||
var sound = true;
|
||||
var _samples = [];
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,14 +9,12 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*jshint jquery: true, browser: true */
|
||||
/*globals flipX: false, flipY: false */
|
||||
/*exported processGamepad, initGamepad, gamepad */
|
||||
|
||||
var getGamepads = navigator.getGamepads || navigator.webkitGetGamepads;
|
||||
var gamepad;
|
||||
export var gamepad;
|
||||
var gamepadMap = [];
|
||||
var gamepadState = [];
|
||||
var flipX = false;
|
||||
var flipY = false;
|
||||
|
||||
var BUTTON = {
|
||||
// Buttons
|
||||
@ -50,14 +48,14 @@ var DEFAULT_GAMEPAD = {
|
||||
'B': 1,
|
||||
'L1': 0,
|
||||
'R1': 1,
|
||||
'START': '\033'
|
||||
'START': 0x1B
|
||||
};
|
||||
|
||||
window.addEventListener('gamepadconnected', function(e) {
|
||||
gamepad = e.gamepad;
|
||||
});
|
||||
|
||||
function processGamepad(io) {
|
||||
export function processGamepad(io) {
|
||||
if (getGamepads) {
|
||||
gamepad = getGamepads.call(navigator)[0];
|
||||
}
|
||||
@ -98,7 +96,7 @@ function processGamepad(io) {
|
||||
}
|
||||
}
|
||||
|
||||
function initGamepad(data) {
|
||||
export function initGamepad(data) {
|
||||
for (var idx = 0; idx < 16; idx++) {
|
||||
gamepadMap[idx] = undefined;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -9,11 +9,9 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/*jshint jquery: true, browser: true */
|
||||
/*globals debug: false, toHex: false, reset: false */
|
||||
/*exported KeyBoard */
|
||||
import { debug, toHex } from '../util';
|
||||
|
||||
function KeyBoard(io, e) {
|
||||
export default function KeyBoard(cpu, io, e) {
|
||||
// keycode: [plain, cntl, shift]
|
||||
var keymap = {
|
||||
// Most of these won't happen
|
||||
@ -219,7 +217,7 @@ function KeyBoard(io, e) {
|
||||
}
|
||||
|
||||
if (key == 0x7F && evt.shiftKey && evt.ctrlKey) {
|
||||
reset();
|
||||
cpu.reset();
|
||||
key = 0xff;
|
||||
}
|
||||
|
||||
@ -281,7 +279,7 @@ function KeyBoard(io, e) {
|
||||
reset: function keyboard_reset(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
reset();
|
||||
cpu.reset();
|
||||
},
|
||||
|
||||
create: function keyboard_create(el) {
|
||||
@ -316,25 +314,25 @@ function KeyBoard(io, e) {
|
||||
key = '\t';
|
||||
break;
|
||||
case 'DELETE':
|
||||
key = '\177';
|
||||
key = 0x7F;
|
||||
break;
|
||||
case '←':
|
||||
key = '\010';
|
||||
key = 0x04;
|
||||
break;
|
||||
case '→':
|
||||
key = '\025';
|
||||
key = 0x15;
|
||||
break;
|
||||
case '↓':
|
||||
key = '\012';
|
||||
key = 0x0A;
|
||||
break;
|
||||
case '↑':
|
||||
key = '\013';
|
||||
key = 0x0B;
|
||||
break;
|
||||
case ' ':
|
||||
key = ' ';
|
||||
break;
|
||||
case 'ESC':
|
||||
key = '\033';
|
||||
key = 0x1B;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -358,7 +356,7 @@ function KeyBoard(io, e) {
|
||||
window.location.reload();
|
||||
break;
|
||||
case 'RESET':
|
||||
reset();
|
||||
cpu.reset();
|
||||
break;
|
||||
case 'OPEN_APPLE':
|
||||
self.commandKey(!commanded);
|
||||
|
@ -1,6 +1,15 @@
|
||||
/*exported Printer */
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation. No representations are made about the suitability of this
|
||||
* software for any purpose. It is provided "as is" without express or
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
function Printer(paper) {
|
||||
export default function Printer(paper) {
|
||||
var _lineBuffer;
|
||||
var _line;
|
||||
|
||||
@ -23,7 +32,7 @@ function Printer(paper) {
|
||||
_lineBuffer = '';
|
||||
} else if (c == '\t') {
|
||||
_lineBuffer += ' ';
|
||||
} else if (c == '\010') {
|
||||
} else if (c == 0x04) {
|
||||
_lineBuffer = _lineBuffer.slice(0, -1);
|
||||
} else {
|
||||
if (visible) {
|
||||
|
@ -1,7 +1,18 @@
|
||||
/*globals debug */
|
||||
/*exported Tape */
|
||||
|
||||
function Tape(io) {
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation. No representations are made about the suitability of this
|
||||
* software for any purpose. It is provided "as is" without express or
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
import { debug } from '../util';
|
||||
|
||||
export default function Tape(io) {
|
||||
var AudioContext = window.AudioContext || window.webkitAudioContext;
|
||||
|
||||
return {
|
||||
|
31
js/util.js
31
js/util.js
@ -1,4 +1,4 @@
|
||||
/* Copyright 2010-2017 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
@ -10,20 +10,11 @@
|
||||
*/
|
||||
|
||||
/*eslint no-console: 0*/
|
||||
/*exported allocMemPages, bytify, debug, each, gup, hup, toBinary, toHex
|
||||
*/
|
||||
/*global Uint8Array: false */
|
||||
|
||||
if (!Date.now) {
|
||||
Date.now = function now() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
}
|
||||
|
||||
var hex_digits = '0123456789ABCDEF';
|
||||
var bin_digits = '01';
|
||||
|
||||
function allocMem(size) {
|
||||
export function allocMem(size) {
|
||||
function garbage() {
|
||||
return (Math.random() * 0x100) & 0xff;
|
||||
}
|
||||
@ -47,11 +38,11 @@ function allocMem(size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function allocMemPages(pages) {
|
||||
export function allocMemPages(pages) {
|
||||
return allocMem(pages * 0x100);
|
||||
}
|
||||
|
||||
function bytify(ary) {
|
||||
export function bytify(ary) {
|
||||
var result = ary;
|
||||
if (window.Uint8Array) {
|
||||
result = new Uint8Array(ary);
|
||||
@ -59,13 +50,13 @@ function bytify(ary) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function debug() {
|
||||
export function debug() {
|
||||
if (typeof console != 'undefined' && 'log' in console) {
|
||||
console.log.apply(console, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
function toHex(v, n) {
|
||||
export function toHex(v, n) {
|
||||
if (!n) {
|
||||
n = v < 256 ? 2 : 4;
|
||||
}
|
||||
@ -77,7 +68,7 @@ function toHex(v, n) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function toBinary(v) {
|
||||
export function toBinary(v) {
|
||||
var result = '';
|
||||
for (var idx = 0; idx < 8; idx++) {
|
||||
result = bin_digits[v & 0x01] + result;
|
||||
@ -87,7 +78,7 @@ function toBinary(v) {
|
||||
}
|
||||
|
||||
// From http://www.netlobo.com/url_query_string_javascript.html
|
||||
function gup( name )
|
||||
export function gup( name )
|
||||
{
|
||||
name = name.replace(/[[]/,'\\[').replace(/[\]]/,'\\]');
|
||||
var regexS = '[\\?&]'+name+'=([^&#]*)';
|
||||
@ -99,7 +90,7 @@ function gup( name )
|
||||
return results[1];
|
||||
}
|
||||
|
||||
function hup() {
|
||||
export function hup() {
|
||||
var regex = new RegExp('#(.*)');
|
||||
var results = regex.exec(window.location.hash);
|
||||
if ( !results )
|
||||
@ -108,7 +99,7 @@ function hup() {
|
||||
return results[1];
|
||||
}
|
||||
|
||||
function keys(obj) {
|
||||
export function keys(obj) {
|
||||
var result = [];
|
||||
for (var key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
@ -118,6 +109,6 @@ function keys(obj) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function each(obj, fn) {
|
||||
export function each(obj, fn) {
|
||||
keys(obj).forEach(fn);
|
||||
}
|
||||
|
4408
package-lock.json
generated
4408
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
@ -2,10 +2,11 @@
|
||||
"name": "apple2js",
|
||||
"version": "0.0.1",
|
||||
"description": "Apple II Emulator in JavaScript",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"index": "scripts/index.pl > json/disks/index.js",
|
||||
"lint": "eslint js"
|
||||
"lint": "eslint js",
|
||||
"start": "webpack-dev-server"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -17,7 +18,11 @@
|
||||
"url": "https://github.com/whscullin/apple2js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/whscullin/apple2js#readme",
|
||||
"dependencies": {
|
||||
"eslint": "^5.12.0"
|
||||
"devDependencies": {
|
||||
"ajv": "^6.9.2",
|
||||
"eslint": "^5.12.0",
|
||||
"webpack": "^4.29.6",
|
||||
"webpack-cli": "^3.2.3",
|
||||
"webpack-dev-server": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
20
webpack.config.js
Normal file
20
webpack.config.js
Normal file
@ -0,0 +1,20 @@
|
||||
/*globals require module */
|
||||
const path = require('path');
|
||||
|
||||
module.exports =
|
||||
{
|
||||
mode: 'development',
|
||||
devtool: 'source-map',
|
||||
entry: {
|
||||
main2: path.resolve('js/main2.js'),
|
||||
main2e: path.resolve('js/main2e.js'),
|
||||
},
|
||||
output: {
|
||||
path: path.resolve('dist/'),
|
||||
},
|
||||
devServer: {
|
||||
compress: true,
|
||||
watchContentBase: true,
|
||||
writeToDisk: true
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user