1
0
mirror of https://github.com/pkimpel/retro-b5500.git synced 2026-02-12 03:07:30 +00:00
Files
pkimpel.retro-b5500/webUI/tools/B5500TestLoader.html

102 lines
3.3 KiB
HTML

<!DOCTYPE html>
<head>
<title>B5500 Test Loader</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Paul Kimpel">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<link id=defaultStyleSheet rel=stylesheet type="text/css" href="B5500DistributionAndDisplay.css">
<script src="../emulator/B5500SystemConfiguration.js"></script>
<script src="../emulator/B5500CentralControl.js"></script>
<script src="../emulator/B5500Processor.js"></script>
<script src="../emulator/B5500IOUnit.js"></script>
<script>
"use strict";
window.onload = function() {
var cc = new B5500CentralControl();
function fileLoader_onLoad(ev) {
/* Handle the onload event for an ArrayBuffer FileReader */
var addr = 0; // starting B5500 memory address
var buf = ev.target.result;
var words;
try {
words = cc.loadTest(buf, addr);
alert("File loaded: " + buf.byteLength + " bytes, " +
words + " words, last addr = @" + (addr+words-1).toString(8));
} catch (e) {
words = 0;
alert("File load failed: " + e.toString());
}
if (words > 0) {
document.getElementById("RunBtn").disabled = false;
}
}
function fileSelector_onChange(ev) {
/* Handle the <input type=file> onchange event when a file is selected */
var f = ev.target.files[0];
var reader = new FileReader();
document.getElementById("RunBtn").disabled = true;
reader.onload = fileLoader_onLoad;
reader.readAsArrayBuffer(f);
}
function runBtn_onClick(ev) {
/* Driver to initiate the Processor module */
cc.runTest(0x10); // execute from address @20
}
function checkBrowser() {
/* Checks whether this browser can support the necessary stuff */
var missing = "";
if (!window.File) {missing += ", File"}
if (!window.FileReader) {missing += ", FileReader"}
if (!window.FileList) {missing += ", FileList"}
if (!window.Blob) {missing += ", Blob"}
if (!window.ArrayBuffer) {missing += ", ArrayBuffer"}
if (!window.DataView) {missing += ", DataView"}
if (missing.length == 0) {
return false;
} else {
alert("No can do... your browser does not support the following features:\n" + missing.substring(2));
return true;
}
}
/* Start of window.onload() */
if (checkBrowser()) {
return;
}
cc.powerOn();
document.getElementById("FileSelector").addEventListener("change", fileSelector_onChange, false);
document.getElementById("RunBtn").addEventListener("click", runBtn_onClick, false);
}
</script>
</head>
<body>
<div style="position:relative; width:100%">
<div style="position:absolute; left:0; top:0; width:auto">
retro-B5500 Test Loader
</div>
<div style="position:absolute; top:0; right:0; width:auto">
<input id=FileSelector type=file size=60>
&nbsp;
<input id=RunBtn type=button value=Run disabled>
</div>
</div>
</body>
</html>