mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Export instead of attach to window, and make webpack like it.
This commit is contained in:
parent
2963f116ce
commit
542786e87c
@ -43,6 +43,11 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"jest": true
|
"jest": true
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"files": [ "js/entry2.js", "js/entry2e.js"],
|
||||||
|
"env": {
|
||||||
|
"commonjs": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,9 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="apple2"
|
<body class="apple2"
|
||||||
ondragover="handleDragOver(0, event)"
|
ondragover="Apple2.handleDragOver(0, event)"
|
||||||
ondrop="handleDrop(0, event)"
|
ondrop="Apple2.handleDrop(0, event)"
|
||||||
ondragend="handleDragEnd(0, event)">
|
ondragend="Apple2.handleDragEnd(0, event)">
|
||||||
<div style="margin: auto; width: 614px">
|
<div style="margin: auto; width: 614px">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<a href="about.html" target="_blank">
|
<a href="about.html" target="_blank">
|
||||||
@ -51,30 +51,30 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="inset">
|
<div class="inset">
|
||||||
<div style="float: left; width: 50%"
|
<div style="float: left; width: 50%"
|
||||||
ondragover="handleDragOver(1, event)"
|
ondragover="Apple2.handleDragOver(1, event)"
|
||||||
ondrop="handleDrop(1, event)"
|
ondrop="Apple2.handleDrop(1, event)"
|
||||||
ondragend="handleDragEnd(1, event)">
|
ondragend="Apple2.handleDragEnd(1, event)">
|
||||||
<button id="diskload1" class="diskload" title="Load Disk"
|
<button id="diskload1" class="diskload" title="Load Disk"
|
||||||
onclick="openLoad(1, event);">
|
onclick="Apple2.openLoad(1, event);">
|
||||||
<i class="fas fa-folder-open"></i>
|
<i class="fas fa-folder-open"></i>
|
||||||
</button>
|
</button>
|
||||||
<button id="disksave1" class="disksave" title="Save Disk"
|
<button id="disksave1" class="disksave" title="Save Disk"
|
||||||
onclick="openSave(1, event);">
|
onclick="Apple2.openSave(1, event);">
|
||||||
<i class="fas fa-save"></i>
|
<i class="fas fa-save"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="disk" id="disk1"> </div>
|
<div class="disk" id="disk1"> </div>
|
||||||
<span id="disklabel1" class="disklabel">Disk 1</span>
|
<span id="disklabel1" class="disklabel">Disk 1</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="float: left; width: 50%"
|
<div style="float: left; width: 50%"
|
||||||
ondragover="handleDragOver(2, event)"
|
ondragover="Apple2.handleDragOver(2, event)"
|
||||||
ondrop="handleDrop(2, event)"
|
ondrop="Apple2.handleDrop(2, event)"
|
||||||
ondragend="handleDragEnd(2, event)">
|
ondragend="Apple2.handleDragEnd(2, event)">
|
||||||
<button id="diskload2" class="diskload" title="Load Disk"
|
<button id="diskload2" class="diskload" title="Load Disk"
|
||||||
onclick="openLoad(2, event);">
|
onclick="Apple2.openLoad(2, event);">
|
||||||
<i class="fas fa-folder-open"></i>
|
<i class="fas fa-folder-open"></i>
|
||||||
</button>
|
</button>
|
||||||
<button id="disksave2" class="disksave" title="Save Disk"
|
<button id="disksave2" class="disksave" title="Save Disk"
|
||||||
onclick="openSave(2, event);">
|
onclick="Apple2.openSave(2, event);">
|
||||||
<i class="fas fa-save"></i>
|
<i class="fas fa-save"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="disk" id="disk2"> </div>
|
<div class="disk" id="disk2"> </div>
|
||||||
@ -83,21 +83,21 @@
|
|||||||
<div style="clear: both"></div>
|
<div style="clear: both"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inset">
|
<div class="inset">
|
||||||
<div id="khz" onclick="showFPS = !showFPS">0KHz</div>
|
<div id="khz" onclick="Apple2.togglShowFPS()">0KHz</div>
|
||||||
<button id="pause-run" onclick="pauseRun()" title="Pause/Run">
|
<button id="pause-run" onclick="Apple2.pauseRun()" title="Pause/Run">
|
||||||
<i class="fas fa-pause"></i>
|
<i class="fas fa-pause"></i>
|
||||||
</button>
|
</button>
|
||||||
<button id="toggle-sound" onclick="toggleSound()" title="Toggle Sound">
|
<button id="toggle-sound" onclick="Apple2.toggleSound()" title="Toggle Sound">
|
||||||
<i class="fas fa-volume-off"></i>
|
<i class="fas fa-volume-off"></i>
|
||||||
</button>
|
</button>
|
||||||
<button id="toggle-printer" onclick="openPrinterModal()" title="Toggle Printer">
|
<button id="toggle-printer" onclick="Apple2.openPrinterModal()" title="Toggle Printer">
|
||||||
<i class="fas fa-print"></i>
|
<i class="fas fa-print"></i>
|
||||||
</button>
|
</button>
|
||||||
<div style="float: right">
|
<div style="float: right">
|
||||||
<button onclick="window.open('about.html', 'blank')" title="About">
|
<button onclick="window.open('about.html', 'blank')" title="About">
|
||||||
<i class="fas fa-info"></i>
|
<i class="fas fa-info"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick="openOptions()" title="Options">
|
<button onclick="Apple2.openOptions()" title="Options">
|
||||||
<i class="fas fa-cog"></i>
|
<i class="fas fa-cog"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -106,22 +106,22 @@
|
|||||||
<div style="margin: 0 10px">
|
<div style="margin: 0 10px">
|
||||||
<div id="keyboard"></div>
|
<div id="keyboard"></div>
|
||||||
<div id="textarea" style="display: none">
|
<div id="textarea" style="display: none">
|
||||||
<button onclick="io.keyDown(0x1b)">
|
<button onclick="Apple2.io.keyDown(0x1b)">
|
||||||
ESC
|
ESC
|
||||||
</button>
|
</button>
|
||||||
<button onclick="reset()" style="float: right; margin-left: 10px">
|
<button onclick="Apple2.reset()" style="float: right; margin-left: 10px">
|
||||||
Reset
|
Reset
|
||||||
</button>
|
</button>
|
||||||
<button onclick="io.keyDown(0x15)" style="float: right">
|
<button onclick="Apple2.io.keyDown(0x15)" style="float: right">
|
||||||
→
|
→
|
||||||
</button>
|
</button>
|
||||||
<button onclick="io.keyDown(0x08)" style="float: right">
|
<button onclick="Apple2.io.keyDown(0x08)" style="float: right">
|
||||||
←
|
←
|
||||||
</button>
|
</button>
|
||||||
<label for="text_input">Text Input</label>
|
<label for="text_input">Text Input</label>
|
||||||
<textarea rows="10" style="width: 99%" id="text_input"></textarea>
|
<textarea rows="10" style="width: 99%" id="text_input"></textarea>
|
||||||
<br />
|
<br />
|
||||||
<button onclick="io.setKeyBuffer(document.querySelector('#text_input').innerText)">
|
<button onclick="Apple2.io.setKeyBuffer(document.querySelector('#text_input').innerText)">
|
||||||
Send
|
Send
|
||||||
</button>
|
</button>
|
||||||
<input type="checkbox" id="buffering" />
|
<input type="checkbox" id="buffering" />
|
||||||
@ -161,7 +161,7 @@
|
|||||||
<h3>Type</h3>
|
<h3>Type</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<select id="computer_type2" value="apple2plus" onchange="updateCPU()">
|
<select id="computer_type2" value="apple2plus" onchange="Apple2.updateCPU()">
|
||||||
<option value="apple2plus">Apple ][+</option>
|
<option value="apple2plus">Apple ][+</option>
|
||||||
<option value="apple2">Autostart Apple ][</option>
|
<option value="apple2">Autostart Apple ][</option>
|
||||||
<option value="original">Apple ][</option>
|
<option value="original">Apple ][</option>
|
||||||
@ -177,7 +177,7 @@
|
|||||||
<h3>CPU</h3>
|
<h3>CPU</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="accelerator_toggle" onclick="updateCPU()"/>
|
<input type="checkbox" id="accelerator_toggle" onclick="Apple2.updateCPU()"/>
|
||||||
<label for="accelerator_toggle">
|
<label for="accelerator_toggle">
|
||||||
Accelerated CPU
|
Accelerated CPU
|
||||||
</label>
|
</label>
|
||||||
@ -187,28 +187,28 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="disable_mouse"
|
<input type="checkbox" id="disable_mouse"
|
||||||
onclick="updateJoystick()" />
|
onclick="Apple2.updateJoystick()" />
|
||||||
<label for="disable_mouse">
|
<label for="disable_mouse">
|
||||||
Disable Mouse Joystick
|
Disable Mouse Joystick
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="flip_x"
|
<input type="checkbox" id="flip_x"
|
||||||
onclick="updateJoystick()" />
|
onclick="Apple2.updateJoystick()" />
|
||||||
<label for="flip_x">
|
<label for="flip_x">
|
||||||
Flip X-Axis
|
Flip X-Axis
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="flip_y"
|
<input type="checkbox" id="flip_y"
|
||||||
onclick="updateJoystick()" />
|
onclick="Apple2.updateJoystick()" />
|
||||||
<label for="flip_y">
|
<label for="flip_y">
|
||||||
Flip Y-Axis
|
Flip Y-Axis
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="swap_x_y"
|
<input type="checkbox" id="swap_x_y"
|
||||||
onclick="updateJoystick()" />
|
onclick="Apple2.updateJoystick()" />
|
||||||
<label for="swap_x_y">
|
<label for="swap_x_y">
|
||||||
Swap X-Y Axis
|
Swap X-Y Axis
|
||||||
</label>
|
</label>
|
||||||
@ -218,14 +218,14 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="green_screen"
|
<input type="checkbox" id="green_screen"
|
||||||
onclick="updateScreen()" />
|
onclick="Apple2.updateScreen()" />
|
||||||
<label for="green_screen">
|
<label for="green_screen">
|
||||||
Green Screen
|
Green Screen
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="show_scanlines"
|
<input type="checkbox" id="show_scanlines"
|
||||||
onclick="updateScreen()" />
|
onclick="Apple2.updateScreen()" />
|
||||||
<label for="show_scanlines">
|
<label for="show_scanlines">
|
||||||
Show Scanlines
|
Show Scanlines
|
||||||
</label>
|
</label>
|
||||||
@ -235,7 +235,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="enable_sound"
|
<input type="checkbox" id="enable_sound"
|
||||||
onclick="updateSound()" checked="checked" />
|
onclick="Apple2.updateSound()" checked="checked" />
|
||||||
<label for="enable_sound">
|
<label for="enable_sound">
|
||||||
Enable
|
Enable
|
||||||
</label>
|
</label>
|
||||||
@ -272,7 +272,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<footer class="modal__footer">
|
<footer class="modal__footer">
|
||||||
<button class="modal__btn" onclick="doSave()" aria-label="Save disk locally">Save</button>
|
<button class="modal__btn" onclick="Apple2.doSave()" aria-label="Save disk locally">Save</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -334,13 +334,13 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<select id="category_select" multiple="multiple"
|
<select id="category_select" multiple="multiple"
|
||||||
onchange="selectCategory(event)" >
|
onchange="Apple2.selectCategory(event)" >
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="disk_select" multiple="multiple"
|
<select id="disk_select" multiple="multiple"
|
||||||
onchange="selectDisk(event)"
|
onchange="Apple2.selectDisk(event)"
|
||||||
ondblclick="clickDisk(event)">
|
ondblclick="Apple2.clickDisk(event)">
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -351,7 +351,7 @@
|
|||||||
</main>
|
</main>
|
||||||
<footer class="modal__footer">
|
<footer class="modal__footer">
|
||||||
<button class="modal__btn" data-micromodal-close aria-label="Close this dialog window">Cancel</button>
|
<button class="modal__btn" data-micromodal-close aria-label="Close this dialog window">Cancel</button>
|
||||||
<button class="modal__btn" onclick="doLoad()" aria-label="Open the selected disk">Open</button>
|
<button class="modal__btn" onclick="Apple2.doLoad()" aria-label="Open the selected disk">Open</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,9 +34,9 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="apple2e"
|
<body class="apple2e"
|
||||||
ondragover="handleDragOver(0, event)"
|
ondragover="Apple2.handleDragOver(0, event)"
|
||||||
ondrop="handleDrop(0, event)"
|
ondrop="Apple2.handleDrop(0, event)"
|
||||||
ondragend="handleDragEnd(0, event)">
|
ondragend="Apple2.handleDragEnd(0, event)">
|
||||||
<div class="outer">
|
<div class="outer">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<a href="about.html" target="_blank">
|
<a href="about.html" target="_blank">
|
||||||
@ -46,37 +46,37 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="display">
|
<div id="display">
|
||||||
<div class="overscan"
|
<div class="overscan"
|
||||||
onkeydown="_keydown(event);"
|
onkeydown="Apple2._keydown(event);"
|
||||||
onkeyup="_keyup(event);">
|
onkeyup="Apple2._keyup(event);">
|
||||||
<canvas id="screen" width="560" height="384"></canvas>
|
<canvas id="screen" width="560" height="384"></canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inset">
|
<div class="inset">
|
||||||
<div style="float: left; width: 50%"
|
<div style="float: left; width: 50%"
|
||||||
ondragover="handleDragOver(1, event)"
|
ondragover="Apple2.handleDragOver(1, event)"
|
||||||
ondrop="handleDrop(1, event)"
|
ondrop="Apple2.handleDrop(1, event)"
|
||||||
ondragend="handleDragEnd(1, event)">
|
ondragend="Apple2.handleDragEnd(1, event)">
|
||||||
<button id="diskload1" class="diskload" title="Load Disk"
|
<button id="diskload1" class="diskload" title="Load Disk"
|
||||||
onclick="openLoad(1, event);">
|
onclick="Apple2.openLoad(1, event);">
|
||||||
<i class="fas fa-folder-open"></i>
|
<i class="fas fa-folder-open"></i>
|
||||||
</button>
|
</button>
|
||||||
<button id="disksave1" class="disksave" title="Save Disk"
|
<button id="disksave1" class="disksave" title="Save Disk"
|
||||||
onclick="openSave(1, event);">
|
onclick="Apple2.openSave(1, event);">
|
||||||
<i class="fas fa-save"></i>
|
<i class="fas fa-save"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="disk" id="disk1"> </div>
|
<div class="disk" id="disk1"> </div>
|
||||||
<span id="disklabel1" class="disklabel">Disk 1</span>
|
<span id="disklabel1" class="disklabel">Disk 1</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="float: left; width: 50%"
|
<div style="float: left; width: 50%"
|
||||||
ondragover="handleDragOver(2, event)"
|
ondragover="Apple2.handleDragOver(2, event)"
|
||||||
ondrop="handleDrop(2, event)"
|
ondrop="Apple2.handleDrop(2, event)"
|
||||||
ondragend="handleDragEnd(2, event)">
|
ondragend="Apple2.handleDragEnd(2, event)">
|
||||||
<button id="diskload2" class="diskload" title="Load Disk"
|
<button id="diskload2" class="diskload" title="Load Disk"
|
||||||
onclick="openLoad(2, event);">
|
onclick="Apple2.openLoad(2, event);">
|
||||||
<i class="fas fa-folder-open"></i>
|
<i class="fas fa-folder-open"></i>
|
||||||
</button>
|
</button>
|
||||||
<button id="disksave2" class="disksave" title="Save Disk"
|
<button id="disksave2" class="disksave" title="Save Disk"
|
||||||
onclick="openSave(2, event);">
|
onclick="Apple2.openSave(2, event);">
|
||||||
<i class="fas fa-save"></i>
|
<i class="fas fa-save"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="disk" id="disk2"> </div>
|
<div class="disk" id="disk2"> </div>
|
||||||
@ -86,28 +86,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="position: relative">
|
<div style="position: relative">
|
||||||
<div id="controls" class="inset">
|
<div id="controls" class="inset">
|
||||||
<div id="khz" onclick="showFPS = !showFPS">0KHz</div>
|
<div id="khz" onclick="Apple2.toggleShowFPS()">0KHz</div>
|
||||||
<button id="pause-run" onclick="pauseRun()">
|
<button id="pause-run" onclick="Apple2.pauseRun()">
|
||||||
<i class="fas fa-pause"></i>
|
<i class="fas fa-pause"></i>
|
||||||
</button>
|
</button>
|
||||||
<button id="toggle-sound" onclick="toggleSound()">
|
<button id="toggle-sound" onclick="Apple2.toggleSound()">
|
||||||
<i class="fas fa-volume-off"></i>
|
<i class="fas fa-volume-off"></i>
|
||||||
</button>
|
</button>
|
||||||
<button id="toggle-printer" onclick="openPrinterModal()" title="Toggle Printer">
|
<button id="toggle-printer" onclick="Apple2.openPrinterModal()" title="Toggle Printer">
|
||||||
<i class="fas fa-print"></i>
|
<i class="fas fa-print"></i>
|
||||||
</button>
|
</button>
|
||||||
<div style="float: right">
|
<div style="float: right">
|
||||||
<button onclick="window.open('about.html', 'blank')" title="About">
|
<button onclick="Apple2.window.open('about.html', 'blank')" title="About">
|
||||||
<i class="fas fa-info"></i>
|
<i class="fas fa-info"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick="openOptions()">
|
<button onclick="Apple2.openOptions()">
|
||||||
<i class="fas fa-cog"></i>
|
<i class="fas fa-cog"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input id="reset" type="button" value="Reset"
|
<input id="reset" type="button" value="Reset"
|
||||||
onclick="reset(event)"
|
onclick="Apple2.reset(event)"
|
||||||
oncontextmenu="reset(event)" />
|
oncontextmenu="Apple2.reset(event)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="inset">
|
<div class="inset">
|
||||||
<div id="keyboard"></div>
|
<div id="keyboard"></div>
|
||||||
@ -140,7 +140,7 @@
|
|||||||
<h3>Type</h3>
|
<h3>Type</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<select id="computer_type2e" value="apple2enh" onchange="updateCPU()">
|
<select id="computer_type2e" value="apple2enh" onchange="Apple2.updateCPU()">
|
||||||
<option value="apple2enh">Enhanced Apple //e</option>
|
<option value="apple2enh">Enhanced Apple //e</option>
|
||||||
<option value="apple2e">Apple //e</option>
|
<option value="apple2e">Apple //e</option>
|
||||||
<option value="apple2rm">Enhanced Apple //e (Reactive Micro)</option>
|
<option value="apple2rm">Enhanced Apple //e (Reactive Micro)</option>
|
||||||
@ -153,7 +153,7 @@
|
|||||||
<h3>CPU</h3>
|
<h3>CPU</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="accelerator_toggle" onclick="updateCPU()"/>
|
<input type="checkbox" id="accelerator_toggle" onclick="Apple2.updateCPU()"/>
|
||||||
<label for="accelerator_toggle">
|
<label for="accelerator_toggle">
|
||||||
Accelerated CPU
|
Accelerated CPU
|
||||||
</label>
|
</label>
|
||||||
@ -163,28 +163,28 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="disable_mouse"
|
<input type="checkbox" id="disable_mouse"
|
||||||
onclick="updateJoystick()" />
|
onclick="Apple2.updateJoystick()" />
|
||||||
<label for="disable_mouse">
|
<label for="disable_mouse">
|
||||||
Disable Mouse Joystick
|
Disable Mouse Joystick
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="flip_x"
|
<input type="checkbox" id="flip_x"
|
||||||
onclick="updateJoystick()" />
|
onclick="Apple2.updateJoystick()" />
|
||||||
<label for="flip_x">
|
<label for="flip_x">
|
||||||
Flip X-Axis
|
Flip X-Axis
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="flip_y"
|
<input type="checkbox" id="flip_y"
|
||||||
onclick="updateJoystick()" />
|
onclick="Apple2.updateJoystick()" />
|
||||||
<label for="flip_y">
|
<label for="flip_y">
|
||||||
Flip Y-Axis
|
Flip Y-Axis
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="swap_x_y"
|
<input type="checkbox" id="swap_x_y"
|
||||||
onclick="updateJoystick()" />
|
onclick="Apple2.updateJoystick()" />
|
||||||
<label for="swap_x_y">
|
<label for="swap_x_y">
|
||||||
Swap X-Y Axis
|
Swap X-Y Axis
|
||||||
</label>
|
</label>
|
||||||
@ -194,14 +194,14 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="green_screen"
|
<input type="checkbox" id="green_screen"
|
||||||
onclick="updateScreen()" />
|
onclick="Apple2.updateScreen()" />
|
||||||
<label for="green_screen">
|
<label for="green_screen">
|
||||||
Green Screen
|
Green Screen
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="show_scanlines"
|
<input type="checkbox" id="show_scanlines"
|
||||||
onclick="updateScreen()" />
|
onclick="Apple2.updateScreen()" />
|
||||||
<label for="show_scanlines">
|
<label for="show_scanlines">
|
||||||
Show Scanlines
|
Show Scanlines
|
||||||
</label>
|
</label>
|
||||||
@ -211,7 +211,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="enable_sound"
|
<input type="checkbox" id="enable_sound"
|
||||||
onclick="updateSound()" checked="checked" />
|
onclick="Apple2.updateSound()" checked="checked" />
|
||||||
<label for="enable_sound">
|
<label for="enable_sound">
|
||||||
Enable
|
Enable
|
||||||
</label>
|
</label>
|
||||||
@ -248,7 +248,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<footer class="modal__footer">
|
<footer class="modal__footer">
|
||||||
<button class="modal__btn" onclick="doSave()" aria-label="Save disk locally">Save</button>
|
<button class="modal__btn" onclick="Apple2.doSave()" aria-label="Save disk locally">Save</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -310,13 +310,13 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<select id="category_select" multiple="multiple"
|
<select id="category_select" multiple="multiple"
|
||||||
onchange="selectCategory(event)" >
|
onchange="Apple2.selectCategory(event)" >
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="disk_select" multiple="multiple"
|
<select id="disk_select" multiple="multiple"
|
||||||
onchange="selectDisk(event)"
|
onchange="Apple2.selectDisk(event)"
|
||||||
ondblclick="clickDisk(event)">
|
ondblclick="Apple2.clickDisk(event)">
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -327,7 +327,7 @@
|
|||||||
</main>
|
</main>
|
||||||
<footer class="modal__footer">
|
<footer class="modal__footer">
|
||||||
<button class="modal__btn" data-micromodal-close aria-label="Close this dialog window">Cancel</button>
|
<button class="modal__btn" data-micromodal-close aria-label="Close this dialog window">Cancel</button>
|
||||||
<button class="modal__btn" onclick="doLoad()" aria-label="Open the selected disk">Open</button>
|
<button class="modal__btn" onclick="Apple2.doLoad()" aria-label="Open the selected disk">Open</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
/*!
|
|
||||||
* 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.
|
|
||||||
*/
|
|
3
js/entry2.js
Normal file
3
js/entry2.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const Apple2 = require('./main2');
|
||||||
|
|
||||||
|
module.exports = { Apple2 };
|
3
js/entry2e.js
Normal file
3
js/entry2e.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const Apple2 = require('./main2e');
|
||||||
|
|
||||||
|
module.exports = { Apple2 };
|
101
js/main2.js
101
js/main2.js
@ -56,7 +56,7 @@ var disk_cur_cat = [];
|
|||||||
|
|
||||||
var _currentDrive = 1;
|
var _currentDrive = 1;
|
||||||
|
|
||||||
window.openLoad = function(drive, event)
|
export function openLoad(drive, event)
|
||||||
{
|
{
|
||||||
_currentDrive = parseInt(drive, 10);
|
_currentDrive = parseInt(drive, 10);
|
||||||
if (event.metaKey) {
|
if (event.metaKey) {
|
||||||
@ -64,13 +64,13 @@ window.openLoad = function(drive, event)
|
|||||||
} else {
|
} else {
|
||||||
if (disk_cur_cat[drive]) {
|
if (disk_cur_cat[drive]) {
|
||||||
document.querySelector('#category_select').value = disk_cur_cat[drive];
|
document.querySelector('#category_select').value = disk_cur_cat[drive];
|
||||||
window.selectCategory();
|
selectCategory();
|
||||||
}
|
}
|
||||||
MicroModal.show('load-modal');
|
MicroModal.show('load-modal');
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
window.openSave = function(drive, event)
|
export function openSave(drive, event)
|
||||||
{
|
{
|
||||||
_currentDrive = parseInt(drive, 10);
|
_currentDrive = parseInt(drive, 10);
|
||||||
|
|
||||||
@ -88,14 +88,14 @@ window.openSave = function(drive, event)
|
|||||||
document.querySelector('#save_name').value = drivelights.label(drive);
|
document.querySelector('#save_name').value = drivelights.label(drive);
|
||||||
MicroModal.show('save-modal');
|
MicroModal.show('save-modal');
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
window.handleDragOver = function(drive, event) {
|
export function handleDragOver(drive, event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.dataTransfer.dropEffect = 'copy';
|
event.dataTransfer.dropEffect = 'copy';
|
||||||
};
|
}
|
||||||
|
|
||||||
window.handleDragEnd = function(drive, event) {
|
export function handleDragEnd(drive, event) {
|
||||||
var dt = event.dataTransfer;
|
var dt = event.dataTransfer;
|
||||||
if (dt.items) {
|
if (dt.items) {
|
||||||
for (var i = 0; i < dt.items.length; i++) {
|
for (var i = 0; i < dt.items.length; i++) {
|
||||||
@ -104,9 +104,9 @@ window.handleDragEnd = function(drive, event) {
|
|||||||
} else {
|
} else {
|
||||||
event.dataTransfer.clearData();
|
event.dataTransfer.clearData();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
window.handleDrop = function(drive, event) {
|
export function handleDrop(drive, event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ window.handleDrop = function(drive, event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
var loading = false;
|
var loading = false;
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ function loadAjax(drive, url) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.doLoad = function doLoad() {
|
export function doLoad() {
|
||||||
MicroModal.close('load-modal');
|
MicroModal.close('load-modal');
|
||||||
var urls = document.querySelector('#disk_select').value, url;
|
var urls = document.querySelector('#disk_select').value, url;
|
||||||
if (urls && urls.length) {
|
if (urls && urls.length) {
|
||||||
@ -198,19 +198,19 @@ window.doLoad = function doLoad() {
|
|||||||
document.location.hash = parts.join('|');
|
document.location.hash = parts.join('|');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
window.doSave = function doSave() {
|
export function doSave() {
|
||||||
var name = document.querySelector('#save_name').value;
|
var name = document.querySelector('#save_name').value;
|
||||||
saveLocalStorage(_currentDrive, name);
|
saveLocalStorage(_currentDrive, name);
|
||||||
MicroModal.close('save-modal');
|
MicroModal.close('save-modal');
|
||||||
};
|
}
|
||||||
|
|
||||||
window.doDelete = function(name) {
|
export function doDelete(name) {
|
||||||
if (window.confirm('Delete ' + name + '?')) {
|
if (window.confirm('Delete ' + name + '?')) {
|
||||||
deleteLocalStorage(name);
|
deleteLocalStorage(name);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function doLoadLocal(drive, file) {
|
function doLoadLocal(drive, file) {
|
||||||
var parts = file.name.split('.');
|
var parts = file.name.split('.');
|
||||||
@ -374,7 +374,7 @@ io.setSlot(3, videoterm);
|
|||||||
io.setSlot(6, disk2);
|
io.setSlot(6, disk2);
|
||||||
io.setSlot(7, clock);
|
io.setSlot(7, clock);
|
||||||
|
|
||||||
window.showFPS = false;
|
var showFPS = false;
|
||||||
|
|
||||||
function updateKHz() {
|
function updateKHz() {
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
@ -382,7 +382,7 @@ function updateKHz() {
|
|||||||
var cycles = cpu.cycles();
|
var cycles = cpu.cycles();
|
||||||
var delta;
|
var delta;
|
||||||
|
|
||||||
if (window.showFPS) {
|
if (showFPS) {
|
||||||
delta = renderedFrames - lastFrames;
|
delta = renderedFrames - lastFrames;
|
||||||
var fps = parseInt(delta/(ms/1000), 10);
|
var fps = parseInt(delta/(ms/1000), 10);
|
||||||
document.querySelector('#khz').innerText = fps + 'fps';
|
document.querySelector('#khz').innerText = fps + 'fps';
|
||||||
@ -397,7 +397,11 @@ function updateKHz() {
|
|||||||
lastFrames = renderedFrames;
|
lastFrames = renderedFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.updateSound = function updateSound() {
|
export function toggleShowFPS() {
|
||||||
|
showFPS = !showFPS;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateSound() {
|
||||||
var on = document.querySelector('#enable_sound').checked;
|
var on = document.querySelector('#enable_sound').checked;
|
||||||
var label = document.querySelector('#toggle-sound i');
|
var label = document.querySelector('#toggle-sound i');
|
||||||
audio.enable(on);
|
audio.enable(on);
|
||||||
@ -419,16 +423,16 @@ function dumpDisk(drive) {
|
|||||||
wind.document.close();
|
wind.document.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.dumpProgram = function() {
|
export function dumpProgram() {
|
||||||
var wind = window.open('', '_blank');
|
var wind = window.open('', '_blank');
|
||||||
wind.document.title = 'Program Listing';
|
wind.document.title = 'Program Listing';
|
||||||
wind.document.write('<pre>');
|
wind.document.write('<pre>');
|
||||||
wind.document.write(dumper.toString());
|
wind.document.write(dumper.toString());
|
||||||
wind.document.write('</pre>');
|
wind.document.write('</pre>');
|
||||||
wind.document.close();
|
wind.document.close();
|
||||||
};
|
}
|
||||||
|
|
||||||
window.step = function()
|
export function step()
|
||||||
{
|
{
|
||||||
if (runTimer) {
|
if (runTimer) {
|
||||||
clearInterval(runTimer);
|
clearInterval(runTimer);
|
||||||
@ -439,11 +443,11 @@ window.step = function()
|
|||||||
debug(cpu.dumpRegisters());
|
debug(cpu.dumpRegisters());
|
||||||
debug(cpu.dumpPC());
|
debug(cpu.dumpPC());
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
var accelerated = false;
|
var accelerated = false;
|
||||||
|
|
||||||
window.updateCPU = function updateCPU()
|
export function updateCPU()
|
||||||
{
|
{
|
||||||
accelerated = document.querySelector('#accelerator_toggle').checked;
|
accelerated = document.querySelector('#accelerator_toggle').checked;
|
||||||
kHz = accelerated ? 4092 : 1023;
|
kHz = accelerated ? 4092 : 1023;
|
||||||
@ -539,11 +543,6 @@ function stop() {
|
|||||||
runTimer = null;
|
runTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset()
|
|
||||||
{
|
|
||||||
cpu.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
var state = null;
|
var state = null;
|
||||||
|
|
||||||
function storeStateLocal() {
|
function storeStateLocal() {
|
||||||
@ -612,7 +611,7 @@ function loadBinary(bin) {
|
|||||||
run(bin.start);
|
run(bin.start);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.selectCategory = function() {
|
export function selectCategory() {
|
||||||
document.querySelector('#disk_select').innerHTML = '';
|
document.querySelector('#disk_select').innerHTML = '';
|
||||||
var cat = disk_categories[document.querySelector('#category_select').value];
|
var cat = disk_categories[document.querySelector('#category_select').value];
|
||||||
if (cat) {
|
if (cat) {
|
||||||
@ -630,15 +629,15 @@ window.selectCategory = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
window.selectDisk = function() {
|
export function selectDisk() {
|
||||||
document.querySelector('#local_file').value = '';
|
document.querySelector('#local_file').value = '';
|
||||||
};
|
}
|
||||||
|
|
||||||
window.clickDisk = function() {
|
export function clickDisk() {
|
||||||
window.doLoad();
|
doLoad();
|
||||||
};
|
}
|
||||||
|
|
||||||
function loadDisk(drive, disk) {
|
function loadDisk(drive, disk) {
|
||||||
var name = disk.name;
|
var name = disk.name;
|
||||||
@ -811,7 +810,7 @@ function _keyup(evt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.updateScreen = function updateScreen() {
|
export function updateScreen() {
|
||||||
var green = document.querySelector('#green_screen').checked;
|
var green = document.querySelector('#green_screen').checked;
|
||||||
var scanlines = document.querySelector('#show_scanlines').checked;
|
var scanlines = document.querySelector('#show_scanlines').checked;
|
||||||
|
|
||||||
@ -824,7 +823,7 @@ var flipX = false;
|
|||||||
var flipY = false;
|
var flipY = false;
|
||||||
var swapXY = false;
|
var swapXY = false;
|
||||||
|
|
||||||
window.updateJoystick = function() {
|
export function updateJoystick() {
|
||||||
disableMouseJoystick = document.querySelector('#disable_mouse').checked;
|
disableMouseJoystick = document.querySelector('#disable_mouse').checked;
|
||||||
flipX = document.querySelector('#flip_x').checked;
|
flipX = document.querySelector('#flip_x').checked;
|
||||||
flipY = document.querySelector('#flip_y').checked;
|
flipY = document.querySelector('#flip_y').checked;
|
||||||
@ -836,7 +835,7 @@ window.updateJoystick = function() {
|
|||||||
io.paddle(1, 0.5);
|
io.paddle(1, 0.5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function _mousemove(evt) {
|
function _mousemove(evt) {
|
||||||
if (gamepad || disableMouseJoystick) {
|
if (gamepad || disableMouseJoystick) {
|
||||||
@ -858,7 +857,7 @@ function _mousemove(evt) {
|
|||||||
io.paddle(1, flipY ? 1 - y : y);
|
io.paddle(1, flipY ? 1 - y : y);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.pauseRun = function() {
|
export function pauseRun() {
|
||||||
var label = document.querySelector('#pause-run i');
|
var label = document.querySelector('#pause-run i');
|
||||||
if (paused) {
|
if (paused) {
|
||||||
run();
|
run();
|
||||||
@ -870,19 +869,19 @@ window.pauseRun = function() {
|
|||||||
label.classList.add('fa-play');
|
label.classList.add('fa-play');
|
||||||
}
|
}
|
||||||
paused = !paused;
|
paused = !paused;
|
||||||
};
|
}
|
||||||
|
|
||||||
window.toggleSound = function() {
|
export function toggleSound() {
|
||||||
var enableSound = document.querySelector('#enable_sound');
|
var enableSound = document.querySelector('#enable_sound');
|
||||||
enableSound.checked = !enableSound.checked;
|
enableSound.checked = !enableSound.checked;
|
||||||
window.updateSound();
|
updateSound();
|
||||||
};
|
}
|
||||||
|
|
||||||
window.openOptions = function () {
|
export function openOptions() {
|
||||||
MicroModal.show('options-modal');
|
MicroModal.show('options-modal');
|
||||||
};
|
};
|
||||||
|
|
||||||
window.openPrinterModal = function () {
|
export function openPrinterModal() {
|
||||||
MicroModal.show('printer-modal');
|
MicroModal.show('printer-modal');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -943,11 +942,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
reset();
|
cpu.reset();
|
||||||
setInterval(updateKHz, 1000);
|
setInterval(updateKHz, 1000);
|
||||||
window.updateSound();
|
updateSound();
|
||||||
window.updateScreen();
|
updateScreen();
|
||||||
window.updateCPU();
|
updateCPU();
|
||||||
|
|
||||||
if (window.localStorage !== undefined) {
|
if (window.localStorage !== undefined) {
|
||||||
document.querySelectorAll('.disksave').forEach(function (el) { el.style.display = 'inline-block';});
|
document.querySelectorAll('.disksave').forEach(function (el) { el.style.display = 'inline-block';});
|
||||||
|
96
js/main2e.js
96
js/main2e.js
@ -51,7 +51,7 @@ var disk_cur_cat = [];
|
|||||||
|
|
||||||
var _currentDrive = 1;
|
var _currentDrive = 1;
|
||||||
|
|
||||||
window.openLoad = function(drive, event)
|
export function openLoad(drive, event)
|
||||||
{
|
{
|
||||||
_currentDrive = parseInt(drive, 10);
|
_currentDrive = parseInt(drive, 10);
|
||||||
if (event.metaKey) {
|
if (event.metaKey) {
|
||||||
@ -59,13 +59,13 @@ window.openLoad = function(drive, event)
|
|||||||
} else {
|
} else {
|
||||||
if (disk_cur_cat[drive]) {
|
if (disk_cur_cat[drive]) {
|
||||||
document.querySelector('#category_select').value = disk_cur_cat[drive];
|
document.querySelector('#category_select').value = disk_cur_cat[drive];
|
||||||
window.selectCategory();
|
selectCategory();
|
||||||
}
|
}
|
||||||
MicroModal.show('load-modal');
|
MicroModal.show('load-modal');
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
window.openSave = function(drive, event)
|
export function openSave(drive, event)
|
||||||
{
|
{
|
||||||
_currentDrive = parseInt(drive, 10);
|
_currentDrive = parseInt(drive, 10);
|
||||||
|
|
||||||
@ -83,14 +83,14 @@ window.openSave = function(drive, event)
|
|||||||
document.querySelector('#save_name').value = drivelights.label(drive);
|
document.querySelector('#save_name').value = drivelights.label(drive);
|
||||||
MicroModal.show('save-modal');
|
MicroModal.show('save-modal');
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
window.handleDragOver = function(drive, event) {
|
export function handleDragOver(drive, event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.dataTransfer.dropEffect = 'copy';
|
event.dataTransfer.dropEffect = 'copy';
|
||||||
};
|
}
|
||||||
|
|
||||||
window.handleDragEnd = function(drive, event) {
|
export function handleDragEnd(drive, event) {
|
||||||
var dt = event.dataTransfer;
|
var dt = event.dataTransfer;
|
||||||
if (dt.items) {
|
if (dt.items) {
|
||||||
for (var i = 0; i < dt.items.length; i++) {
|
for (var i = 0; i < dt.items.length; i++) {
|
||||||
@ -99,9 +99,9 @@ window.handleDragEnd = function(drive, event) {
|
|||||||
} else {
|
} else {
|
||||||
event.dataTransfer.clearData();
|
event.dataTransfer.clearData();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
window.handleDrop = function(drive, event) {
|
export function handleDrop(drive, event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ window.handleDrop = function(drive, event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
var loading = false;
|
var loading = false;
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ function loadAjax(drive, url) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.doLoad = function doLoad() {
|
export function doLoad() {
|
||||||
MicroModal.close('load-modal');
|
MicroModal.close('load-modal');
|
||||||
var urls = document.querySelector('#disk_select').value, url;
|
var urls = document.querySelector('#disk_select').value, url;
|
||||||
if (urls && urls.length) {
|
if (urls && urls.length) {
|
||||||
@ -195,17 +195,17 @@ window.doLoad = function doLoad() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.doSave = function doSave() {
|
export function doSave() {
|
||||||
var name = document.querySelector('#save_name').value;
|
var name = document.querySelector('#save_name').value;
|
||||||
saveLocalStorage(_currentDrive, name);
|
saveLocalStorage(_currentDrive, name);
|
||||||
MicroModal.close('save-modal');
|
MicroModal.close('save-modal');
|
||||||
};
|
};
|
||||||
|
|
||||||
window.doDelete = function(name) {
|
export function doDelete(name) {
|
||||||
if (window.confirm('Delete ' + name + '?')) {
|
if (window.confirm('Delete ' + name + '?')) {
|
||||||
deleteLocalStorage(name);
|
deleteLocalStorage(name);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function doLoadLocal(drive, file) {
|
function doLoadLocal(drive, file) {
|
||||||
var parts = file.name.split('.');
|
var parts = file.name.split('.');
|
||||||
@ -348,7 +348,7 @@ io.setSlot(2, slinky);
|
|||||||
io.setSlot(6, disk2);
|
io.setSlot(6, disk2);
|
||||||
io.setSlot(7, clock);
|
io.setSlot(7, clock);
|
||||||
|
|
||||||
window.showFPS = false;
|
var showFPS = false;
|
||||||
|
|
||||||
function updateKHz() {
|
function updateKHz() {
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
@ -356,7 +356,7 @@ function updateKHz() {
|
|||||||
var cycles = cpu.cycles();
|
var cycles = cpu.cycles();
|
||||||
var delta;
|
var delta;
|
||||||
|
|
||||||
if (window.showFPS) {
|
if (showFPS) {
|
||||||
delta = renderedFrames - lastFrames;
|
delta = renderedFrames - lastFrames;
|
||||||
var fps = parseInt(delta/(ms/1000), 10);
|
var fps = parseInt(delta/(ms/1000), 10);
|
||||||
document.querySelector('#khz').innerText = fps + 'fps';
|
document.querySelector('#khz').innerText = fps + 'fps';
|
||||||
@ -371,7 +371,11 @@ function updateKHz() {
|
|||||||
lastFrames = renderedFrames;
|
lastFrames = renderedFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.updateSound = function updateSound() {
|
export function toggleShowFPS() {
|
||||||
|
showFPS = !showFPS;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateSound() {
|
||||||
var on = document.querySelector('#enable_sound').checked;
|
var on = document.querySelector('#enable_sound').checked;
|
||||||
var label = document.querySelector('#toggle-sound i');
|
var label = document.querySelector('#toggle-sound i');
|
||||||
audio.enable(on);
|
audio.enable(on);
|
||||||
@ -393,16 +397,16 @@ function dumpDisk(drive) {
|
|||||||
wind.document.close();
|
wind.document.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.dumpProgram = function() {
|
export function dumpProgram() {
|
||||||
var wind = window.open('', '_blank');
|
var wind = window.open('', '_blank');
|
||||||
wind.document.title = 'Program Listing';
|
wind.document.title = 'Program Listing';
|
||||||
wind.document.write('<pre>');
|
wind.document.write('<pre>');
|
||||||
wind.document.write(dumper.toString());
|
wind.document.write(dumper.toString());
|
||||||
wind.document.write('</pre>');
|
wind.document.write('</pre>');
|
||||||
wind.document.close();
|
wind.document.close();
|
||||||
};
|
}
|
||||||
|
|
||||||
window.step = function()
|
export function step()
|
||||||
{
|
{
|
||||||
if (runTimer) {
|
if (runTimer) {
|
||||||
clearInterval(runTimer);
|
clearInterval(runTimer);
|
||||||
@ -413,11 +417,11 @@ window.step = function()
|
|||||||
debug(cpu.dumpRegisters());
|
debug(cpu.dumpRegisters());
|
||||||
debug(cpu.dumpPC());
|
debug(cpu.dumpPC());
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
var accelerated = false;
|
var accelerated = false;
|
||||||
|
|
||||||
window.updateCPU = function updateCPU()
|
export function updateCPU()
|
||||||
{
|
{
|
||||||
accelerated = document.querySelector('#accelerator_toggle').checked;
|
accelerated = document.querySelector('#accelerator_toggle').checked;
|
||||||
kHz = accelerated ? 4092 : 1023;
|
kHz = accelerated ? 4092 : 1023;
|
||||||
@ -505,7 +509,7 @@ function stop() {
|
|||||||
runTimer = null;
|
runTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset()
|
export function reset()
|
||||||
{
|
{
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
}
|
}
|
||||||
@ -572,7 +576,7 @@ function loadBinary(bin) {
|
|||||||
run(bin.start);
|
run(bin.start);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.selectCategory = function() {
|
export function selectCategory() {
|
||||||
document.querySelector('#disk_select').innerHTML = '';
|
document.querySelector('#disk_select').innerHTML = '';
|
||||||
var cat = disk_categories[document.querySelector('#category_select').value];
|
var cat = disk_categories[document.querySelector('#category_select').value];
|
||||||
if (cat) {
|
if (cat) {
|
||||||
@ -590,15 +594,15 @@ window.selectCategory = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
window.selectDisk = function() {
|
export function selectDisk() {
|
||||||
document.querySelector('#local_file').value = '';
|
document.querySelector('#local_file').value = '';
|
||||||
};
|
}
|
||||||
|
|
||||||
window.clickDisk = function() {
|
export function clickDisk() {
|
||||||
window.doLoad();
|
doLoad();
|
||||||
};
|
}
|
||||||
|
|
||||||
function loadDisk(drive, disk) {
|
function loadDisk(drive, disk) {
|
||||||
var name = disk.name;
|
var name = disk.name;
|
||||||
@ -709,8 +713,6 @@ function processHash(hash) {
|
|||||||
* Keyboard/Gamepad routines
|
* Keyboard/Gamepad routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window.reset = keyboard.reset;
|
|
||||||
|
|
||||||
function _keydown(evt) {
|
function _keydown(evt) {
|
||||||
if (!focused && (!evt.metaKey || evt.ctrlKey)) {
|
if (!focused && (!evt.metaKey || evt.ctrlKey)) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
@ -790,7 +792,7 @@ function _keyup(evt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.updateScreen = function updateScreen() {
|
export function updateScreen() {
|
||||||
var green = document.querySelector('#green_screen').checked;
|
var green = document.querySelector('#green_screen').checked;
|
||||||
var scanlines = document.querySelector('#show_scanlines').checked;
|
var scanlines = document.querySelector('#show_scanlines').checked;
|
||||||
|
|
||||||
@ -803,7 +805,7 @@ var flipX = false;
|
|||||||
var flipY = false;
|
var flipY = false;
|
||||||
var swapXY = false;
|
var swapXY = false;
|
||||||
|
|
||||||
window.updateJoystick = function() {
|
export function updateJoystick() {
|
||||||
disableMouseJoystick = document.querySelector('#disable_mouse').checked;
|
disableMouseJoystick = document.querySelector('#disable_mouse').checked;
|
||||||
flipX = document.querySelector('#flip_x').checked;
|
flipX = document.querySelector('#flip_x').checked;
|
||||||
flipY = document.querySelector('#flip_y').checked;
|
flipY = document.querySelector('#flip_y').checked;
|
||||||
@ -815,7 +817,7 @@ window.updateJoystick = function() {
|
|||||||
io.paddle(1, 0.5);
|
io.paddle(1, 0.5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function _mousemove(evt) {
|
function _mousemove(evt) {
|
||||||
if (gamepad || disableMouseJoystick) {
|
if (gamepad || disableMouseJoystick) {
|
||||||
@ -837,7 +839,7 @@ function _mousemove(evt) {
|
|||||||
io.paddle(1, flipY ? 1 - y : y);
|
io.paddle(1, flipY ? 1 - y : y);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.pauseRun = function() {
|
export function pauseRun() {
|
||||||
var label = document.querySelector('#pause-run i');
|
var label = document.querySelector('#pause-run i');
|
||||||
if (paused) {
|
if (paused) {
|
||||||
run();
|
run();
|
||||||
@ -849,19 +851,19 @@ window.pauseRun = function() {
|
|||||||
label.classList.add('fa-play');
|
label.classList.add('fa-play');
|
||||||
}
|
}
|
||||||
paused = !paused;
|
paused = !paused;
|
||||||
};
|
}
|
||||||
|
|
||||||
window.toggleSound = function() {
|
export function toggleSound() {
|
||||||
var enableSound = document.querySelector('#enable_sound');
|
var enableSound = document.querySelector('#enable_sound');
|
||||||
enableSound.checked = !enableSound.checked;
|
enableSound.checked = !enableSound.checked;
|
||||||
window.updateSound();
|
updateSound();
|
||||||
};
|
}
|
||||||
|
|
||||||
window.openOptions = function () {
|
export function openOptions() {
|
||||||
MicroModal.show('options-modal');
|
MicroModal.show('options-modal');
|
||||||
};
|
};
|
||||||
|
|
||||||
window.openPrinterModal = function () {
|
export function openPrinterModal() {
|
||||||
MicroModal.show('printer-modal');
|
MicroModal.show('printer-modal');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -922,11 +924,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
reset();
|
cpu.reset();
|
||||||
setInterval(updateKHz, 1000);
|
setInterval(updateKHz, 1000);
|
||||||
window.updateSound();
|
updateSound();
|
||||||
window.updateScreen();
|
updateScreen();
|
||||||
window.updateCPU();
|
updateCPU();
|
||||||
|
|
||||||
if (window.localStorage !== undefined) {
|
if (window.localStorage !== undefined) {
|
||||||
document.querySelectorAll('.disksave').forEach(function (el) { el.style.display = 'inline-block';});
|
document.querySelectorAll('.disksave').forEach(function (el) { el.style.display = 'inline-block';});
|
||||||
|
12
js/prefs.js
12
js/prefs.js
@ -11,18 +11,20 @@
|
|||||||
|
|
||||||
export default function Prefs()
|
export default function Prefs()
|
||||||
{
|
{
|
||||||
|
var havePrefs = typeof window.localStorage !== 'undefined';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
havePrefs: function() {
|
havePrefs: function() {
|
||||||
return typeof(localStorage) != 'undefined';
|
return havePrefs;
|
||||||
},
|
},
|
||||||
readPref: function(name) {
|
readPref: function(name) {
|
||||||
if (localStorage)
|
if (havePrefs)
|
||||||
return localStorage.getItem(name);
|
return window.localStorage.getItem(name);
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
writePref: function(name, value) {
|
writePref: function(name, value) {
|
||||||
if (localStorage)
|
if (havePrefs)
|
||||||
localStorage.setItem(name, value);
|
window.localStorage.setItem(name, value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
/*!
|
|
||||||
* 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.
|
|
||||||
*/
|
|
@ -1,15 +1,17 @@
|
|||||||
/*globals require module */
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
{
|
{
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
entry: {
|
entry: {
|
||||||
main2: path.resolve('js/main2.js'),
|
main2: path.resolve('js/entry2.js'),
|
||||||
main2e: path.resolve('js/main2e.js')
|
main2e: path.resolve('js/entry2e.js')
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve('dist/')
|
path: path.resolve('dist/'),
|
||||||
|
library: 'Apple2',
|
||||||
|
libraryExport: 'Apple2',
|
||||||
|
libraryTarget: 'var'
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
compress: true,
|
compress: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user