mirror of
https://github.com/pkimpel/retro-b5500.git
synced 2026-02-12 19:27:39 +00:00
1. Commit emulator release 0.10.
2. Inhibit peripheral device windows from being closed while emulator is active. 3. Shut down peripheral devices and close their windows as part of cc.powerOff(). 4. Add shut-down code to peripheral drivers. 5. Ensure SPO is ready in cc.load(). 6. Enable emulator version display on B5500Console. 7. Clear DummyPrinter window when it is double-clicked (finally got this working). 8. Fix problem with "/" not accepted by SPO input in Google Chrome. 9. Commit ESPOL binary card loader image. 10. Fix problem with intensity levels in B5500Console NORMAL/CONTROL lights. 11. Attempt to enable emulator and utilities for Safari-style IndexedDB.
This commit is contained in:
@@ -26,13 +26,14 @@ function B5500CardPunch(mnemonic, unitIndex, designate, statusChange, signal) {
|
||||
this.statusChange = statusChange; // external function to call for ready-status change
|
||||
this.signal = signal; // external function to call for special signals (not used here)
|
||||
|
||||
this.timer = null; // setTimeout() token
|
||||
this.initiateStamp = 0; // timestamp of last initiation (set by IOUnit)
|
||||
|
||||
this.clear();
|
||||
|
||||
this.window = window.open("", mnemonic);
|
||||
if (this.window) {
|
||||
this.window.close(); // destroy the previously-existing window
|
||||
this.shutDown(); // destroy the previously-existing window
|
||||
this.window = null;
|
||||
}
|
||||
this.doc = null;
|
||||
@@ -178,6 +179,16 @@ B5500CardPunch.prototype.CPRunoutBtn_onclick = function CPRunoutBtn_onclick(ev)
|
||||
this.armRunout(!this.runoutArmed);
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500CardPunch.prototype.beforeUnload = function beforeUnload(ev) {
|
||||
var msg = "Closing this window will make the device unusable.\n" +
|
||||
"Suggest you stay on the page and minimize this window instead";
|
||||
|
||||
ev.preventDefault();
|
||||
ev.returnValue = msg;
|
||||
return msg;
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500CardPunch.prototype.punchOnload = function punchOnload() {
|
||||
/* Initializes the punch window and user interface */
|
||||
@@ -188,7 +199,7 @@ B5500CardPunch.prototype.punchOnload = function punchOnload() {
|
||||
|
||||
this.stacker1Frame = this.$$("CPStacker1Frame");
|
||||
this.stacker1Frame.contentDocument.head.innerHTML += "<style>" +
|
||||
"BODY {background-color: #F7E7CE; margin: 2px} " +
|
||||
"BODY {background-color: #FFE; margin: 2px} " +
|
||||
"PRE {margin: 0; font-size: 9pt; font-family: Lucida Sans Typewriter, Courier New, Courier, monospace}" +
|
||||
"</style>";
|
||||
this.stacker1 = this.doc.createElement("pre");
|
||||
@@ -198,7 +209,7 @@ B5500CardPunch.prototype.punchOnload = function punchOnload() {
|
||||
|
||||
this.stacker2Frame = this.$$("CPStacker2Frame");
|
||||
this.stacker2Frame.contentDocument.head.innerHTML += "<style>" +
|
||||
"BODY {background-color: #F7E7CE; margin: 2px} " +
|
||||
"BODY {background-color: #FFE; margin: 2px} " +
|
||||
"PRE {margin: 0; font-size: 9pt; font-family: Lucida Sans Typewriter, Courier New, Courier, monospace}" +
|
||||
"</style>";
|
||||
this.stacker2 = this.doc.createElement("pre");
|
||||
@@ -210,6 +221,8 @@ B5500CardPunch.prototype.punchOnload = function punchOnload() {
|
||||
this.window.resizeTo(this.window.outerWidth+this.$$("CPDiv").scrollWidth-this.window.innerWidth+12,
|
||||
this.window.outerHeight+this.$$("CPDiv").scrollHeight-this.window.innerHeight+12);
|
||||
|
||||
this.window.addEventListener("beforeunload", this.beforeUnload, false);
|
||||
|
||||
this.armRunout(false);
|
||||
this.setPunchReady(true);
|
||||
|
||||
@@ -282,7 +295,7 @@ B5500CardPunch.prototype.write = function write(finish, buffer, length, mode, co
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
this.timer = setTimeout(function() {
|
||||
that.busy = false;
|
||||
finish(that.errorMask, length);
|
||||
}, 60000/this.cardsPerMinute + this.initiateStamp - new Date().getTime());
|
||||
@@ -322,3 +335,14 @@ B5500CardPunch.prototype.writeInterrogate = function writeInterrogate(finish, co
|
||||
|
||||
finish(0x04, 0); // report unit not ready
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500CardPunch.prototype.shutDown = function shutDown() {
|
||||
/* Shuts down the device */
|
||||
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
this.window.removeEventListener("beforeunload", this.beforeUnload, false);
|
||||
this.window.close();
|
||||
};
|
||||
|
||||
@@ -26,13 +26,14 @@ function B5500CardReader(mnemonic, unitIndex, designate, statusChange, signal) {
|
||||
this.statusChange = statusChange; // external function to call for ready-status change
|
||||
this.signal = signal; // external function to call for special signals (not used here)
|
||||
|
||||
this.timer = null; // setTimeout() token
|
||||
this.initiateStamp = 0; // timestamp of last initiation (set by IOUnit)
|
||||
|
||||
this.clear();
|
||||
|
||||
this.window = window.open("", mnemonic);
|
||||
if (this.window) {
|
||||
this.window.close(); // destroy the previously-existing window
|
||||
this.shutDown(); // destroy the previously-existing window
|
||||
this.window = null;
|
||||
}
|
||||
this.doc = null;
|
||||
@@ -175,7 +176,7 @@ B5500CardReader.prototype.CRProgressBar_onclick = function CRProgressBar_onclick
|
||||
/* Handle the click event for the "input hopper" progress bar */
|
||||
|
||||
if (this.bufIndex < this.bufLength && !this.ready) {
|
||||
if (confirm((this.bufLength-this.bufIndex).toString() + " of " + this.bufLength.toString() +
|
||||
if (this.window.confirm((this.bufLength-this.bufIndex).toString() + " of " + this.bufLength.toString() +
|
||||
" characters remaining to read.\nDo you want to clear the reader input hopper?")) {
|
||||
this.buffer = "";
|
||||
this.bufLength = 0;
|
||||
@@ -303,6 +304,16 @@ B5500CardReader.prototype.readCardBinary = function readCardBinary(buffer, lengt
|
||||
return card;
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500CardReader.prototype.beforeUnload = function beforeUnload(ev) {
|
||||
var msg = "Closing this window will make the device unusable.\n" +
|
||||
"Suggest you stay on the page and minimize this window instead";
|
||||
|
||||
ev.preventDefault();
|
||||
ev.returnValue = msg;
|
||||
return msg;
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500CardReader.prototype.readerOnload = function readerOnload() {
|
||||
/* Initializes the reader window and user interface */
|
||||
@@ -318,12 +329,14 @@ B5500CardReader.prototype.readerOnload = function readerOnload() {
|
||||
|
||||
this.outHopperFrame = this.$$("CROutHopperFrame");
|
||||
this.outHopperFrame.contentDocument.head.innerHTML += "<style>" +
|
||||
"BODY {background-color: #F7E7CE; margin: 2px} " +
|
||||
"BODY {background-color: #FFE; margin: 2px} " +
|
||||
"PRE {margin: 0; font-size: 9pt; font-family: Lucida Sans Typewriter, Courier New, Courier, monospace}" +
|
||||
"</style>";
|
||||
this.outHopper = this.doc.createElement("pre");
|
||||
this.outHopperFrame.contentDocument.body.appendChild(this.outHopper);
|
||||
|
||||
this.window.addEventListener("beforeunload", this.beforeUnload, false);
|
||||
|
||||
this.armEOF(false);
|
||||
this.setReaderReady(false);
|
||||
|
||||
@@ -383,7 +396,7 @@ B5500CardReader.prototype.read = function read(finish, buffer, length, mode, con
|
||||
this.setReaderReady(false);
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
this.timer = setTimeout(function() {
|
||||
that.busy = false;
|
||||
finish(that.errorMask, length);
|
||||
}, 60000/this.cardsPerMinute + this.initiateStamp - new Date().getTime());
|
||||
@@ -444,3 +457,14 @@ B5500CardReader.prototype.writeInterrogate = function writeInterrogate(finish, c
|
||||
|
||||
finish(0x04, 0); // report unit not ready
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500CardReader.prototype.shutDown = function shutDown() {
|
||||
/* Shuts down the device */
|
||||
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
this.window.removeEventListener("beforeunload", this.beforeUnload, false);
|
||||
this.window.close();
|
||||
};
|
||||
|
||||
@@ -61,6 +61,10 @@
|
||||
***********************************************************************/
|
||||
"use strict";
|
||||
|
||||
if (!window.indexedDB) { // for Safari, mostly
|
||||
window.indexedDB = window.webkitIndexedDB || window.mozIndexedDB;
|
||||
}
|
||||
|
||||
window.addEventListener("load", function() {
|
||||
var configName = "CONFIG"; // database configuration store name
|
||||
var dbName = "B5500DiskUnit"; // IDB database name
|
||||
@@ -1958,7 +1962,7 @@ window.addEventListener("load", function() {
|
||||
$$("ColdstartBtn").disabled = false;
|
||||
$$("FileSelector").disabled = false;
|
||||
|
||||
dumpDisk(); // <<<<<<<<<<<<<< DEBUG <<<<<<<<<<<<<<<<<
|
||||
// dumpDisk(); // <<<<<<<<<<<<<< DEBUG <<<<<<<<<<<<<<<<<
|
||||
|
||||
disk.transaction("CONFIG").objectStore("CONFIG").get(0).onsuccess = function(ev) {
|
||||
config = ev.target.result;
|
||||
|
||||
@@ -43,9 +43,8 @@ DIV#B5500Logo {
|
||||
z-index: 15}
|
||||
|
||||
DIV#RetroVersion {
|
||||
display: none; /***** TEMPORARY *****/
|
||||
position: absolute;
|
||||
top: 80px;
|
||||
top: 82px;
|
||||
right: 170px;
|
||||
color: white;
|
||||
font-family: Arial Rounded, Arial, Helvetica, sans-serif;
|
||||
|
||||
@@ -22,6 +22,12 @@
|
||||
<script src="../emulator/B5500IOUnit.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
if (!window.indexedDB) { // for Safari, mostly
|
||||
window.indexedDB = window.webkitIndexedDB || window.mozIndexedDB;
|
||||
}
|
||||
|
||||
window.addEventListener("load", function() {
|
||||
var aControl;
|
||||
var aNormal;
|
||||
@@ -89,9 +95,27 @@ window.addEventListener("load", function() {
|
||||
}
|
||||
|
||||
function LoadBtn_Click(ev) {
|
||||
cc.load(false);
|
||||
$$("HaltBtn").disabled = false;
|
||||
$$("LoadBtn").disabled = true;
|
||||
var result;
|
||||
|
||||
result = cc.load(false);
|
||||
switch (result) {
|
||||
case 0: // load initiated successfully
|
||||
$$("HaltBtn").disabled = false;
|
||||
$$("LoadBtn").disabled = true;
|
||||
break;
|
||||
case 1:
|
||||
alert("P1 busy or not available");
|
||||
break;
|
||||
case 2:
|
||||
alert("SPO is not ready");
|
||||
break;
|
||||
case 3:
|
||||
alert("SPO is busy");
|
||||
break;
|
||||
default:
|
||||
alert("cc.load() result = " + result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function LoadSelectBtn_Click(ev) {
|
||||
@@ -171,7 +195,7 @@ window.addEventListener("load", function() {
|
||||
aNormal.className = "yellowButton";
|
||||
}
|
||||
} else {
|
||||
stateRate = Math.round(pa.normalCycles/(pa.normalCycles+pa.controlCycles)*7 + 0.49);
|
||||
stateRate = Math.round(pa.normalCycles/(pa.normalCycles+pa.controlCycles)*6);
|
||||
if (stateRate != lastPANormalRate) {
|
||||
lastPANormalRate = stateRate;
|
||||
switch (stateRate) {
|
||||
@@ -184,13 +208,13 @@ window.addEventListener("load", function() {
|
||||
case 2:
|
||||
aNormal.className = "yellowButton yellowLit2";
|
||||
break;
|
||||
case 0:
|
||||
case 3:
|
||||
aNormal.className = "yellowButton yellowLit3";
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
aNormal.className = "yellowButton yellowLit4";
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
aNormal.className = "yellowButton yellowLit5";
|
||||
break;
|
||||
default:
|
||||
@@ -199,7 +223,7 @@ window.addEventListener("load", function() {
|
||||
}
|
||||
}
|
||||
|
||||
stateRate = 7 - stateRate;
|
||||
stateRate = 6 - stateRate;
|
||||
if (stateRate != lastPAControlRate) {
|
||||
lastPAControlRate = stateRate;
|
||||
switch (stateRate) {
|
||||
@@ -246,7 +270,7 @@ window.addEventListener("load", function() {
|
||||
lastPBControlRate = -1;
|
||||
}
|
||||
} else {
|
||||
stateRate = Math.round(pb.normalCycles/(pb.normalCycles+pb.controlCycles)*7 + 0.49);
|
||||
stateRate = Math.round(pb.normalCycles/(pb.normalCycles+pb.controlCycles)*6);
|
||||
if (stateRate != lastPBNormalRate) {
|
||||
lastPBNormalRate = stateRate;
|
||||
switch (stateRate) {
|
||||
@@ -259,13 +283,13 @@ window.addEventListener("load", function() {
|
||||
case 2:
|
||||
bNormal.className = "yellowButton yellowLit2";
|
||||
break;
|
||||
case 0:
|
||||
case 3:
|
||||
bNormal.className = "yellowButton yellowLit3";
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
bNormal.className = "yellowButton yellowLit4";
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
bNormal.className = "yellowButton yellowLit5";
|
||||
break;
|
||||
default:
|
||||
@@ -274,7 +298,7 @@ window.addEventListener("load", function() {
|
||||
}
|
||||
}
|
||||
|
||||
stateRate = 7 - stateRate;
|
||||
stateRate = 6 - stateRate;
|
||||
if (stateRate != lastPBControlRate) {
|
||||
lastPBControlRate = stateRate;
|
||||
switch (stateRate) {
|
||||
@@ -310,27 +334,6 @@ window.addEventListener("load", function() {
|
||||
timer = setTimeout(boundBlinkenlicht, timerInterval);
|
||||
}
|
||||
|
||||
function checkBrowser() {
|
||||
/* Checks whether this browser can support the necessary stuff */
|
||||
var missing = "";
|
||||
|
||||
if (!window.indexedDB) {missing += ", IndexedDB"}
|
||||
if (!window.ArrayBuffer) {missing += ", ArrayBuffer"}
|
||||
if (!window.DataView) {missing += ", DataView"}
|
||||
if (!window.Blob) {missing += ", Blob"}
|
||||
if (!window.File) {missing += ", File"}
|
||||
if (!window.FileReader) {missing += ", FileReader"}
|
||||
if (!window.FileList) {missing += ", FileList"}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
function buildLightMaps() {
|
||||
/* Builds tables of the DOM entries for the annunciator lights, for efficient access */
|
||||
var mnem;
|
||||
@@ -352,6 +355,28 @@ window.addEventListener("load", function() {
|
||||
}
|
||||
}
|
||||
|
||||
function checkBrowser() {
|
||||
/* Checks whether this browser can support the necessary stuff */
|
||||
var missing = "";
|
||||
|
||||
if (!window.indexedDB) {missing += ", IndexedDB"}
|
||||
if (!window.ArrayBuffer) {missing += ", ArrayBuffer"}
|
||||
if (!window.DataView) {missing += ", DataView"}
|
||||
if (!window.Blob) {missing += ", Blob"}
|
||||
if (!window.File) {missing += ", File"}
|
||||
if (!window.FileReader) {missing += ", FileReader"}
|
||||
if (!window.FileList) {missing += ", FileList"}
|
||||
if (!window.postMessage) {missing += ", window.postMessage"}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/***** window.onload() outer block *****/
|
||||
|
||||
$$("RetroVersion").innerHTML = B5500CentralControl.version;
|
||||
|
||||
@@ -78,6 +78,7 @@ function B5500DiskUnit(mnemonic, index, designate, statusChange, signal) {
|
||||
this.statusChange = statusChange; // external function to call for ready-status change
|
||||
this.signal = signal; // external function to call for special signals (e.g,. SPO input request)
|
||||
|
||||
this.timer = null; // setTimeout() token
|
||||
this.initiateStamp = 0; // timestamp of last initiation (set by IOUnit)
|
||||
|
||||
this.clear();
|
||||
@@ -220,7 +221,7 @@ B5500DiskUnit.prototype.read = function read(finish, buffer, length, mode, contr
|
||||
req = this.disk.transaction(euName).objectStore(euName).get(segAddr);
|
||||
req.onsuccess = function singleReadOnsuccess(ev) {
|
||||
that.copySegment(ev.target.result, buffer, 0);
|
||||
setTimeout(function singleReadTimeout() {
|
||||
this.timer = setTimeout(function singleReadTimeout() {
|
||||
finish(that.errorMask, length);
|
||||
that.errorMask = 0;
|
||||
}, finishTime - new Date().getTime());
|
||||
@@ -252,7 +253,7 @@ B5500DiskUnit.prototype.read = function read(finish, buffer, length, mode, contr
|
||||
bx += 240;
|
||||
segAddr++;
|
||||
}
|
||||
setTimeout(function rangeReadTimeout() {
|
||||
this.timer = setTimeout(function rangeReadTimeout() {
|
||||
finish(that.errorMask, length);
|
||||
that.errorMask = 0;
|
||||
}, finishTime - new Date().getTime());
|
||||
@@ -314,7 +315,7 @@ B5500DiskUnit.prototype.write = function write(finish, buffer, length, mode, con
|
||||
} else {
|
||||
txn = this.disk.transaction(euName, "readwrite")
|
||||
txn.oncomplete = function writeComplete(ev) {
|
||||
setTimeout(function writeTimeout() {
|
||||
this.timer = setTimeout(function writeTimeout() {
|
||||
finish(that.errorMask, length);
|
||||
that.errorMask = 0;
|
||||
}, finishTime - new Date().getTime());
|
||||
@@ -398,7 +399,7 @@ B5500DiskUnit.prototype.readCheck = function readCheck(finish, length, control)
|
||||
if (cursor) { // found a segment at some address in range
|
||||
cursor.continue();
|
||||
} else { // at end of range
|
||||
setTimeout(function readCheckTimeout() {
|
||||
this.timer = setTimeout(function readCheckTimeout() {
|
||||
that.signal();
|
||||
// DO NOT clear the error mask
|
||||
}, finishTime - new Date().getTime());
|
||||
@@ -430,7 +431,7 @@ B5500DiskUnit.prototype.readInterrogate = function readInterrogate(finish, contr
|
||||
if (segAddr < 0 || segAddr >= euSize) { // if read is past end of disk
|
||||
this.errorMask |= 0x20; // set D27F for invalid seg address
|
||||
}
|
||||
setTimeout(function readInterrogateTimeout() {
|
||||
this.timer = setTimeout(function readInterrogateTimeout() {
|
||||
finish(that.errorMask, length);
|
||||
that.errorMask = 0;
|
||||
}, Math.random()*this.maxLatency*1000 + this.initiateStamp - new Date().getTime());
|
||||
@@ -463,9 +464,19 @@ B5500DiskUnit.prototype.writeInterrogate = function writeInterrogate(finish, con
|
||||
if (segAddr < 0 || segAddr >= euSize) { // if read is past end of disk
|
||||
this.errorMask |= 0x20; // set D27F for invalid seg address
|
||||
}
|
||||
setTimeout(function writeInterrogateTimeout() {
|
||||
this.timer = setTimeout(function writeInterrogateTimeout() {
|
||||
finish(that.errorMask, length);
|
||||
that.errorMask = 0;
|
||||
}, Math.random()*this.maxLatency*1000 + this.initiateStamp - new Date().getTime());
|
||||
}
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500DiskUnit.prototype.shutDown = function shutDown() {
|
||||
/* Shuts down the device */
|
||||
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
// this device has no window to close
|
||||
};
|
||||
|
||||
@@ -27,13 +27,14 @@ function B5500DummyPrinter(mnemonic, unitIndex, designate, statusChange, signal)
|
||||
this.statusChange = statusChange; // external function to call for ready-status change
|
||||
this.signal = signal; // external function to call for special signals (e.g,. Printer Finished)
|
||||
|
||||
this.timer = null; // setTimeout() token
|
||||
this.initiateStamp = 0; // timestamp of last initiation (set by IOUnit)
|
||||
|
||||
this.clear();
|
||||
|
||||
this.window = window.open("", mnemonic);
|
||||
if (this.window) {
|
||||
this.window.close(); // destroy the previously-existing window
|
||||
this.shutDown(); // destroy the previously-existing window
|
||||
this.window = null;
|
||||
}
|
||||
this.doc = null;
|
||||
@@ -62,17 +63,15 @@ B5500DummyPrinter.prototype.clear = function clear() {
|
||||
this.busy = false; // busy status
|
||||
this.activeIOUnit = 0; // I/O unit currently using this device
|
||||
|
||||
this.lastClickStamp = 0; // last click time for double-click detection
|
||||
|
||||
this.errorMask = 0; // error mask for finish()
|
||||
this.finish = null; // external function to call for I/O completion
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500SPOUnit.prototype.tearPaper = function tearPaper(ev) {
|
||||
B5500DummyPrinter.prototype.ripPaper = function ripPaper(ev) {
|
||||
/* Handles an event to clear the "paper" from the printer */
|
||||
|
||||
if (confirm("Do you want to clear the \"paper\" from the printer?")) {
|
||||
if (this.window.confirm("Do you want to clear the \"paper\" from the printer?")) {
|
||||
while (this.paper.firstChild) {
|
||||
this.paper.removeChild(this.paper.firstChild);
|
||||
}
|
||||
@@ -92,6 +91,16 @@ B5500DummyPrinter.prototype.appendLine = function appendLine(text) {
|
||||
this.paper.appendChild(line);
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500DummyPrinter.prototype.beforeUnload = function beforeUnload(ev) {
|
||||
var msg = "Closing this window will make the device unusable.\n" +
|
||||
"Suggest you stay on the page and minimize this window instead";
|
||||
|
||||
ev.preventDefault();
|
||||
ev.returnValue = msg;
|
||||
return msg;
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500DummyPrinter.prototype.printerOnload = function printerOnload() {
|
||||
/* Initializes the line printer window and user interface */
|
||||
@@ -108,17 +117,13 @@ B5500DummyPrinter.prototype.printerOnload = function printerOnload() {
|
||||
this.window.resizeTo(1000, screen.availHeight*0.80);
|
||||
|
||||
this.window.addEventListener("click", function(ev) {
|
||||
var stamp = new Date().getTime();
|
||||
|
||||
// a kludge, but this is the DUMMY printer....
|
||||
if (stamp - this.lastClickStamp < 500) {
|
||||
if (ev.detail == 2) { // check for left-button double-click
|
||||
that.ripPaper(ev);
|
||||
that.lastClickStamp = 0; // no triple-clicking allowed
|
||||
} else {
|
||||
that.lastClickStamp = stamp;
|
||||
}
|
||||
}, false);
|
||||
|
||||
this.window.addEventListener("beforeunload", this.beforeUnload, false);
|
||||
|
||||
this.statusChange(1);
|
||||
};
|
||||
|
||||
@@ -156,7 +161,8 @@ B5500DummyPrinter.prototype.write = function write(finish, buffer, length, mode,
|
||||
this.paper.appendChild(this.doc.createElement("hr"));
|
||||
}
|
||||
|
||||
setTimeout(this.signal, 60000/this.linesPerMinute + this.initiateStamp - new Date().getTime());
|
||||
this.timer = setTimeout(this.signal,
|
||||
60000/this.linesPerMinute + this.initiateStamp - new Date().getTime());
|
||||
finish(0, 0);
|
||||
this.endOfPaper.scrollIntoView();
|
||||
};
|
||||
@@ -205,3 +211,14 @@ B5500DummyPrinter.prototype.writeInterrogate = function writeInterrogate(finish,
|
||||
String.fromCharCode.apply(null, buffer.subarray(0, length)));
|
||||
finish(0x04, 0);
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500DummyPrinter.prototype.shutDown = function shutDown() {
|
||||
/* Shuts down the device */
|
||||
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
this.window.removeEventListener("beforeunload", this.beforeUnload, false);
|
||||
this.window.close();
|
||||
};
|
||||
@@ -28,6 +28,7 @@ function B5500DummyUnit(mnemonic, index, designate, statusChange, signal) {
|
||||
this.statusChange = statusChange; // external function to call for ready-status change
|
||||
this.signal = signal; // external function to call for special signals (e.g,. SPO input request)
|
||||
|
||||
this.timer = null; // setTimeout() token
|
||||
this.initiateStamp = 0; // timestamp of last initiation (set by IOUnit)
|
||||
|
||||
this.clear();
|
||||
@@ -101,3 +102,13 @@ B5500DummyUnit.prototype.writeInterrogate = function writeInterrogate(finish, co
|
||||
|
||||
finish(0x04, 0); // report unit not ready
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500DummyUnit.prototype.shutDown = function shutDown() {
|
||||
/* Shuts down the device */
|
||||
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
// this device has no window to close
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@ function B5500SPOUnit(mnemonic, unitIndex, designate, statusChange, signal) {
|
||||
this.statusChange = statusChange; // external function to call for ready-status change
|
||||
this.signal = signal; // external function to call for special signals (e.g,. SPO input request)
|
||||
|
||||
this.timer = null; // setTimeout() token
|
||||
this.initiateStamp = 0; // timestamp of last initiation (set by IOUnit)
|
||||
|
||||
this.clear();
|
||||
@@ -40,7 +41,7 @@ function B5500SPOUnit(mnemonic, unitIndex, designate, statusChange, signal) {
|
||||
|
||||
this.window = window.open("", mnemonic);
|
||||
if (this.window) {
|
||||
this.window.close(); // destroy the previously-existing window
|
||||
this.shutDown(); // destroy the previously-existing window
|
||||
this.window = null;
|
||||
}
|
||||
this.doc = null;
|
||||
@@ -244,19 +245,19 @@ B5500SPOUnit.prototype.outputChar = function outputChar() {
|
||||
that.printChar(that.buffer[that.bufIndex]);
|
||||
that.bufIndex++;
|
||||
that.printCol++;
|
||||
setTimeout(that.outputChar, delay);
|
||||
this.timer = setTimeout(that.outputChar, delay);
|
||||
} else { // set up for the final CR/LF
|
||||
that.printCol = 72;
|
||||
setTimeout(that.outputChar, delay);
|
||||
this.timer = setTimeout(that.outputChar, delay);
|
||||
}
|
||||
} else if (that.printCol == 72) { // delay to fake the output of a carriage-return
|
||||
that.printCol++;
|
||||
setTimeout(that.outputChar, delay+that.charPeriod);
|
||||
this.timer = setTimeout(that.outputChar, delay+that.charPeriod);
|
||||
} else { // actually output the CR/LF
|
||||
that.appendEmptyLine();
|
||||
if (that.bufIndex < that.bufLength) {
|
||||
that.printCol = 0; // more characters to print after the CR/LF
|
||||
setTimeout(that.outputChar, delay);
|
||||
this.timer = setTimeout(that.outputChar, delay);
|
||||
} else { // message text is exhausted
|
||||
that.finish(that.errorMask, that.bufLength); // report finish with any errors
|
||||
if (that.spoLocalRequested) {
|
||||
@@ -305,7 +306,6 @@ B5500SPOUnit.prototype.keyPress = function keyPress(ev) {
|
||||
var c = ev.charCode;
|
||||
var index = this.bufLength;
|
||||
var nextTime;
|
||||
var result = true;
|
||||
var stamp = new Date().getTime();
|
||||
|
||||
if (this.nextCharTime > stamp) {
|
||||
@@ -320,27 +320,25 @@ B5500SPOUnit.prototype.keyPress = function keyPress(ev) {
|
||||
if (this.printCol < 72) {
|
||||
this.printCol++;
|
||||
}
|
||||
setTimeout(function() {that.printChar(c)}, nextTime-stamp);
|
||||
this.timer = setTimeout(function() {that.printChar(c)}, nextTime-stamp);
|
||||
}
|
||||
if (c == 126) { // "~" (B5500 group-mark)
|
||||
c = this.keyFilter[c];
|
||||
if (this.printCol < 72) {
|
||||
this.printCol++;
|
||||
}
|
||||
setTimeout(function() {that.printChar(c)}, nextTime-stamp);
|
||||
this.timer = setTimeout(function() {that.printChar(c)}, nextTime-stamp);
|
||||
this.nextCharTime = nextTime + this.charPeriod;
|
||||
this.terminateInput();
|
||||
}
|
||||
} else if (this.spoState == this.spoLocal) {
|
||||
if (c >= 32 && c <= 126) {
|
||||
c = this.keyFilter[c];
|
||||
setTimeout(function() {that.printChar(c)}, nextTime-stamp);
|
||||
this.timer = setTimeout(function() {that.printChar(c)}, nextTime-stamp);
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
return result;
|
||||
|
||||
ev.preventDefault();
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
@@ -376,7 +374,7 @@ B5500SPOUnit.prototype.keyDown = function keyDown(ev) {
|
||||
switch (this.spoState) {
|
||||
case this.spoInput:
|
||||
case this.spoLocal:
|
||||
setTimeout(this.backspaceChar, nextTime-stamp);
|
||||
this.timer = setTimeout(this.backspaceChar, nextTime-stamp);
|
||||
this.nextCharTime = nextTime;
|
||||
result = false;
|
||||
break;
|
||||
@@ -390,7 +388,7 @@ B5500SPOUnit.prototype.keyDown = function keyDown(ev) {
|
||||
result = false;
|
||||
break
|
||||
case this.spoLocal:
|
||||
setTimeout(function() {
|
||||
this.timer = setTimeout(function() {
|
||||
that.appendEmptyLine();
|
||||
}, nextTime-stamp+this.charPeriod);
|
||||
this.nextCharTime = nextTime;
|
||||
@@ -403,7 +401,6 @@ B5500SPOUnit.prototype.keyDown = function keyDown(ev) {
|
||||
if (!result) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
@@ -427,6 +424,16 @@ B5500SPOUnit.prototype.printText = function printText(msg, finish) {
|
||||
this.outputChar(); // start the printing process
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500SPOUnit.prototype.beforeUnload = function beforeUnload(ev) {
|
||||
var msg = "Closing this window will make the device unusable.\n" +
|
||||
"Suggest you stay on the page and minimize this window instead";
|
||||
|
||||
ev.preventDefault();
|
||||
ev.returnValue = msg;
|
||||
return msg;
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500SPOUnit.prototype.spoOnload = function spoOnload() {
|
||||
/* Initializes the SPO window and user interface */
|
||||
@@ -451,6 +458,16 @@ B5500SPOUnit.prototype.spoOnload = function spoOnload() {
|
||||
this.window.moveTo(0, screen.availHeight-this.window.outerHeight);
|
||||
this.window.focus();
|
||||
|
||||
this.window.addEventListener("beforeunload", this.beforeUnload, false);
|
||||
|
||||
this.window.addEventListener("keypress", function(ev) {
|
||||
that.keyPress(ev);
|
||||
}, false);
|
||||
|
||||
this.window.addEventListener("keydown", function(ev) {
|
||||
that.keyDown(ev);
|
||||
}, false);
|
||||
|
||||
this.$$("SPORemoteBtn").addEventListener("click", function() {
|
||||
that.setRemote();
|
||||
}, false);
|
||||
@@ -479,16 +496,6 @@ B5500SPOUnit.prototype.spoOnload = function spoOnload() {
|
||||
that.terminateInput();
|
||||
}, false);
|
||||
|
||||
this.window.addEventListener("keypress", function(ev) {
|
||||
if (ev.keyCode == 191) {ev.preventDefault()};
|
||||
that.keyPress(ev);
|
||||
}, false);
|
||||
|
||||
this.window.addEventListener("keydown", function(ev) {
|
||||
if (ev.keyCode == 191) {ev.preventDefault()};
|
||||
that.keyDown(ev);
|
||||
}, false);
|
||||
|
||||
for (x=0; x<32; x++) {
|
||||
this.appendEmptyLine();
|
||||
}
|
||||
@@ -595,3 +602,14 @@ B5500SPOUnit.prototype.writeInterrogate = function writeInterrogate(finish, cont
|
||||
|
||||
finish(0x04, 0); // report unit not ready
|
||||
};
|
||||
|
||||
/**************************************/
|
||||
B5500SPOUnit.prototype.shutDown = function shutDown() {
|
||||
/* Shuts down the device */
|
||||
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
this.window.removeEventListener("beforeunload", this.beforeUnload, false);
|
||||
this.window.close();
|
||||
};
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
if (!window.indexedDB) { // for Safari, mostly
|
||||
window.indexedDB = window.webkitIndexedDB || window.mozIndexedDB;
|
||||
}
|
||||
|
||||
var runningCycles = 1000; // Number of instructions per run-mode interval
|
||||
|
||||
var cc;
|
||||
@@ -877,12 +881,29 @@ function fileSelector_onChange(ev) {
|
||||
|
||||
function hardwareLoad_onClick(ev) {
|
||||
/* Handle the "Hardware Load" button click */
|
||||
var result;
|
||||
|
||||
cc.clear();
|
||||
cc.P1.clear();
|
||||
cc.cardLoadSelect = $$("CardLoadSelect").checked;
|
||||
cc.load(true);
|
||||
displaySystemState();
|
||||
result = cc.load(true);
|
||||
switch (result) {
|
||||
case 0: // load initiated successfully
|
||||
cc.P1.clear();
|
||||
cc.cardLoadSelect = $$("CardLoadSelect").checked;
|
||||
displaySystemState();
|
||||
break;
|
||||
case 1:
|
||||
alert("P1 busy or not available");
|
||||
break;
|
||||
case 2:
|
||||
alert("SPO is not ready");
|
||||
break;
|
||||
case 3:
|
||||
alert("SPO is busy");
|
||||
break;
|
||||
default:
|
||||
alert("cc.load() result = " + result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function checkBrowser() {
|
||||
|
||||
1
webUI/ESPOL-Binary-Card-Loader.txt
Normal file
1
webUI/ESPOL-Binary-Card-Loader.txt
Normal file
@@ -0,0 +1 @@
|
||||
14M90+KI$|#0|00MM)290+JI"000000D4*342L05000V10JI18JI0)0)000S0QKI000W0HKI000,08KI000]=/1V082I08JI0417+E0M16+E[)|/EV+EBV+E}V+E?V*)*/}V000M16+E:)B/1VB),/4V4J1>50JI
|
||||
Reference in New Issue
Block a user