From 27bd443f7c1de77daf42f06e6fed13afb2796fc6 Mon Sep 17 00:00:00 2001 From: "paul.kimpel@digm.com" Date: Mon, 15 Jul 2013 03:31:34 +0000 Subject: [PATCH] 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. --- emulator/B5500CentralControl.js | 35 +++++++++-- tools/B5500DiskDirList.html | 4 ++ tools/B5500DiskFileList.html | 4 ++ webUI/B5500CardPunch.js | 32 ++++++++-- webUI/B5500CardReader.js | 32 ++++++++-- webUI/B5500ColdLoader.html | 6 +- webUI/B5500Console.css | 3 +- webUI/B5500Console.html | 93 +++++++++++++++++++----------- webUI/B5500DiskUnit.js | 23 ++++++-- webUI/B5500DummyPrinter.js | 43 +++++++++----- webUI/B5500DummyUnit.js | 11 ++++ webUI/B5500SPOUnit.js | 70 +++++++++++++--------- webUI/B5500SyllableDebugger.html | 29 ++++++++-- webUI/ESPOL-Binary-Card-Loader.txt | 1 + 14 files changed, 287 insertions(+), 99 deletions(-) create mode 100644 webUI/ESPOL-Binary-Card-Loader.txt diff --git a/emulator/B5500CentralControl.js b/emulator/B5500CentralControl.js index 5d37441..b9663ee 100644 --- a/emulator/B5500CentralControl.js +++ b/emulator/B5500CentralControl.js @@ -61,7 +61,7 @@ function B5500CentralControl() { /**************************************/ /* Global constants */ -B5500CentralControl.version = "0.09"; +B5500CentralControl.version = "0.10"; B5500CentralControl.memReadCycles = 2; // assume 2 µs memory read cycle time (the other option was 3 µs) B5500CentralControl.memWriteCycles = 4; // assume 4 µs memory write cycle time (the other option was 6 µs) @@ -788,11 +788,18 @@ B5500CentralControl.prototype.loadComplete = function loadComplete(dontStart) { B5500CentralControl.prototype.load = function load(dontStart) { /* Initiates a Load operation to start the system. If "dontStart" is truthy, then only the MCP bootstrap is loaded into memory -- P1 is not started */ + var result; var boundLoadComplete = (function boundLoadComplete(that, dontStart) { return function() {return that.loadComplete(dontStart)} })(this, dontStart); - if (this.P1 && !this.P1.busy) { + if (!this.P1 || this.P1.busy) { // P1 is busy or not available + result = 1; + } else if (!this.testUnitReady(22)) { // SPO not ready + result = 2; + } else if (this.testUnitBusy(22)) { // SPO is busy + result = 3; + } else { // ready to rock 'n roll this.clear(); this.nextTimeStamp = new Date().getTime(); this.tock(); @@ -820,7 +827,9 @@ B5500CentralControl.prototype.load = function load(dontStart) { } else { this.CCI04F = 1; // set I/O busy interrupt } + result = 0; // all is copacetic } + return result; }; /**************************************/ @@ -1005,15 +1014,23 @@ B5500CentralControl.prototype.powerOn = function powerOn() { B5500CentralControl.prototype.powerOff = function powerOff() { /* Powers down the system and deallocates the hardware modules. Redundant power-offs are ignored. */ - var x; + var that = this; + + function shutDown() { + var x; - if (this.poweredUp) { - this.halt(); if (this.timer) { clearTimeout(this.timer); this.timer = null; } + // Shut down the peripheral devices + for (x=0; x"; this.stacker1 = this.doc.createElement("pre"); @@ -198,7 +209,7 @@ B5500CardPunch.prototype.punchOnload = function punchOnload() { this.stacker2Frame = this.$$("CPStacker2Frame"); this.stacker2Frame.contentDocument.head.innerHTML += ""; 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(); +}; diff --git a/webUI/B5500CardReader.js b/webUI/B5500CardReader.js index 17072d8..18efdbf 100644 --- a/webUI/B5500CardReader.js +++ b/webUI/B5500CardReader.js @@ -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 += ""; 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(); +}; diff --git a/webUI/B5500ColdLoader.html b/webUI/B5500ColdLoader.html index 39fbbec..d03dbc5 100644 --- a/webUI/B5500ColdLoader.html +++ b/webUI/B5500ColdLoader.html @@ -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; diff --git a/webUI/B5500Console.css b/webUI/B5500Console.css index 70b5e4e..f2233f8 100644 --- a/webUI/B5500Console.css +++ b/webUI/B5500Console.css @@ -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; diff --git a/webUI/B5500Console.html b/webUI/B5500Console.html index 5c4e78d..ce8e04f 100644 --- a/webUI/B5500Console.html +++ b/webUI/B5500Console.html @@ -22,6 +22,12 @@