1
0
mirror of https://github.com/pkimpel/retro-220.git synced 2026-03-29 10:55:59 +00:00

Commit version 0.00d:

1. Implement console teletype printer and paper tape punch devices.
2. Correct timing mechanism and operation complete processing for asynchronous (I/O) processor mode.
3. Delete extraneous alarm toggles from B220Processor.
4. Correct Reset And Transfer switch so it will work when the Processor is running.
5. Implement Hello World default program for SPO at address 0020.
6. Change keyboard keystroke assignments for B220ConsoleKeyboard.
7. Implement Reset-to-Defaults feature for B220SystemConfig.
8. Implement DOM Element.classList for B220Util class attribute manipulation.
9. Minor typo correction to BALGOL-Generator.bacg.
This commit is contained in:
Paul Kimpel
2017-04-29 13:41:02 -07:00
parent bd285f4308
commit df29455c91
20 changed files with 2538 additions and 367 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -220,7 +220,7 @@ SEQ PLAC ADDR WORD LABEL OPCODE OPERAND ' IS A 4
210 0155 0 4410 40 2449 STA TBL+1/44
211 0156 0 4204 27 2451 DFL TBL+3/42,4
212 0157 0 0000 30 0134 BUN COMMENT
213 0158 0 0000 10 2449 SETSCAN.1 CRD TBL+1
213 0158 0 0000 10 2449 SETSCAN.1 CAD TBL+1
214 0159 1 4410 40 1677 -STA IA/44
215 0160 0 0000 30 0514 BUN RETURN
216

View File

@@ -30,11 +30,7 @@
<script src="../emulator/B220Processor.js"></script>
<script src="./B220ConsoleKeyboard.js"></script>
<script src="./B220ControlConsole.js"></script>
<!--
<script src="./B220ConsoleOutput.js"></script>
<script src="./B220ConsoleInput.js"></script>
<script src="./B220CardatronInput.js"></script>
@@ -46,6 +42,11 @@
<script src="./B220MagTapeControl.js"></script>
-->
<script src="./B220ConsoleKeyboard.js"></script>
<script src="./B220ConsolePrinter.js"></script>
<script src="./B220PaperTapePunch.js"></script>
<script src="./B220ControlConsole.js"></script>
<script src="./B220.js"></script>
</head>

View File

@@ -308,7 +308,7 @@ DIV.blackControlKnobBottomCaption {
DIV.panelSurface {
position: absolute;
background-color: #E4DDCD; /* was #D8C5BC; putty #EDEAE8; */
background-color: #D8C5BC; /* was #E4DDCD; putty #EDEAE8; */
color: black}
DIV.panelRegister {

View File

@@ -33,11 +33,11 @@
class=keyboardBtn>C</button>
<button id=EBtn title="Also E keypress"
class=keyboardBtn>E</button>
<button id=ExamBtn title "Also Enter keypress"
<button id=ExamBtn title "Also X keypress"
class=keyboardBtn>EXAM</button>
<button id=EntBtn title="No alternate keypress"
<button id=EntBtn title="Also ENTER keypress"
class=keyboardBtn>ENT</button>
<button id=StepBtn title="No alternate keypress"
<button id=StepBtn title="Also S keypress"
class=keyboardBtn>STEP</button>
<button id=Btn9 class=keyboardBtn>9</button>

View File

@@ -23,7 +23,7 @@ function B220ConsoleKeyboard(p) {
this.window = null; // window object, null if not displayed
this.enabled = false; // true if keyboard is active
this.boundKeypress = B220Processor.bindMethod(this, B220ConsoleKeyboard.prototype.keypress);
this.boundKeypress = B220Util.bindMethod(this, B220ConsoleKeyboard.prototype.keypress);
this.boundButton_Click = B220Util.bindMethod(this, B220ConsoleKeyboard.prototype.button_Click);
this.boundKeyboard_OnLoad = B220Util.bindMethod(this, B220ConsoleKeyboard.prototype.keyboardOnLoad);
this.boundKeyboard_Unload = B220Util.bindMethod(this, B220ConsoleKeyboard.prototype.keyboardUnload);
@@ -150,14 +150,22 @@ B220ConsoleKeyboard.prototype.keypress = function keypress(ev) {
this.animateClick(this.$$("EBtn"));
this.p.keyboardAction(-3);
break;
case 0x0D: // Enter key = EXAM
case 0x58: case 0x78: // "X", "x"
this.animateClick(this.$$("ExamBtn"));
this.p.keyboardAction(-4);
break;
case 0x0D: // Enter key = ENT
this.animateClick(this.$$("EntBtn"));
this.p.keyboardAction(-5);
break;
case 0x53: case 0x73: // "S", "s"
this.animateClick(this.$$("StepBtn"));
this.p.keyboardAction(-6);
break;
case 0: // Firefox reports only graphic charCodes for keypress
if (ev.keyCode == 0x0D) { // check keyCode instead
this.animateClick(this.$$("ExamBtn"));
this.p.keyboardAction(-4);
this.animateClick(this.$$("EntBtn"));
this.p.keyboardAction(-5);
}
break;
} // switch c
@@ -175,7 +183,7 @@ B220ConsoleKeyboard.prototype.keyboardOpen = function keyboardOpen() {
if (!this.window) {
this.window = window.open("../webUI/B220ConsoleKeyboard.html", this.mnemonic,
"location=no,scrollbars=no,resizable,width=" + w + ",height=" + h +
"resizable,width=" + w + ",height=" + h +
",left=" + (screen.availWidth - w) + ",top=" + (screen.availHeight - h));
this.window.addEventListener("load", this.boundKeyboard_OnLoad, false);
}

View File

@@ -0,0 +1,294 @@
/***********************************************************************
* retro-220/webUI B220PaperTapePunch.css
************************************************************************
* Copyright (c) 2017, Paul Kimpel.
* Licensed under the MIT License, see
* http://www.opensource.org/licenses/mit-license.php
************************************************************************
* Burroughs 220 Console Printer Unit.
************************************************************************
* 2017-03-17 P.Kimpel
* Original version, from retro-205 D205ConsoleOutput.css.
***********************************************************************/
#PrinterBody {
height: 100%;
min-height: 100%;
overflow: hidden;
padding: 0}
#Printer {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: 4px;
border-radius: 16px}
#LineFeedBtn {
left: 16px;
top: 8px;
box-shadow: 3px 3px 2px #999}
#LineFeedBtnCaption {
left: 48px;
top: 18px}
#CarriageReturnBtn {
right: 16px;
top: 8px;
box-shadow: 3px 3px 2px #999}
#CarriageReturnBtnCaption {
right: 48px;
top: 18px}
#OpenPanelBtn {
position: absolute;
top: 8px;
left: calc(50% - 50px);
width: 100px}
#ClosePanelBtn {
position: absolute;
top: 8px;
left: calc(50% - 50px);
width: 100px}
#PrinterPlaten {
position: absolute;
left: 16px;
right: 16px;
top: 48px;
bottom: 16px;
min-height: 64px;
min-width: 120px;
overflow-x: hidden;
overflow-y: scroll;
color: black;
background-color: white;
padding: 4px;
border: 1px solid gray}
#Paper {
margin-left: 0;
margin-right: 0;
margin-top: 2000px;
margin-bottom: 0;
padding: 0}
#EndOfPaper {
display: block;
margin: 0;
padding: 0;
opacity: 0}
#EndOfPaper.hidden {
display: none}
#FormatControlsDiv {
position: absolute;
overflow: visible;
display: none;
left: calc(50% - 312px);
top: 48px;
z-index: 10;
height: 216px;
width: 624px;
border-radius: 8px;
border: 2px solid black;
box-shadow: 3px 3px 2px #999;
color: black;
background-color: #E4DDCD}
#RemoteKnob {
position: absolute;
left: 36px;
top: 60px}
#RemoteKnobRemoteCaption {
left: 36px;
top: 48px;
width: 36px;
text-align: left}
#RemoteKnobLocalCaption {
left: 62px;
top: 48px;
width: 38px;
text-align: right}
#FormatKnob {
position: absolute;
right: 36px;
top: 60px}
#FormatKnobCaption {
right: 36px;
top: 128px;
width: 64px}
#FormatKnobSpaceCaption {
right: 88px;
top: 48px;
text-align: right}
#FormatKnobTabCaption {
right: 36px;
top: 48px;
width: 64px}
#FormatKnobCarRetCaption {
right: 12px;
top: 48px;
text-align: right}
#ZeroSuppressSwitch {
position: absolute;
left: 134px;
top: 80px;
width: 24px}
#ZeroSuppressOn {
left: 122px;
top: 66px;
width: 48px}
#ZeroSuppressOff {
left: 122px;
top: 110px;
width: 48px}
#MapMemorySwitch {
position: absolute;
left: 184px;
top: 80px;
width: 24px}
#MapMemoryOn {
left: 172px;
top: 66px;
width: 48px}
#MapMemoryNormal {
left: 172px;
top: 110px;
width: 48px}
#Columns {
position: absolute;
right: 356px;
top: 80px;
width: 16px}
#ColumnsCaption {
right: 338px;
top: 66px;
width: 60px}
#TabStops {
position: absolute;
right: 124px;
top: 80px;
width: 220px}
#TabStopsCaption {
right: 124px;
top: 66px;
width: 220px}
#UnitSwitch0 {
position: absolute;
left: 134px;
top: 160px;
width: 24px}
#UnitSwitch0Caption {
left: 122px;
top: 146px;
width: 48px}
#UnitSwitch1 {
position: absolute;
left: 170px;
top: 160px;
width: 24px}
#UnitSwitch1Caption {
left: 158px;
top: 146px;
width: 48px}
#UnitSwitch2 {
position: absolute;
left: 206px;
top: 160px;
width: 24px}
#UnitSwitch2Caption {
left: 194px;
top: 146px;
width: 48px}
#UnitSwitch3 {
position: absolute;
left: 242px;
top: 160px;
width: 24px}
#UnitSwitch3Caption {
left: 230px;
top: 146px;
width: 48px}
#UnitSwitch4 {
position: absolute;
left: 278px;
top: 160px;
width: 24px}
#UnitSwitch4Caption {
left: 266px;
top: 146px;
width: 48px}
#UnitSwitch5 {
position: absolute;
left: 314px;
top: 160px;
width: 24px}
#UnitSwitch5Caption {
left: 302px;
top: 146px;
width: 48px}
#UnitSwitch6 {
position: absolute;
left: 350px;
top: 160px;
width: 24px}
#UnitSwitch6Caption {
left: 338px;
top: 146px;
width: 48px}
#UnitSwitch7 {
position: absolute;
left: 386px;
top: 160px;
width: 24px}
#UnitSwitch7Caption {
left: 374px;
top: 146px;
width: 48px}
#UnitSwitch8 {
position: absolute;
left: 422px;
top: 160px;
width: 24px}
#UnitSwitch8Caption {
left: 410px;
top: 146px;
width: 48px}
#UnitSwitch9 {
position: absolute;
left: 458px;
top: 160px;
width: 24px}
#UnitSwitch9Caption {
left: 446px;
top: 146px;
width: 48px}
#UnitSwitch10 {
position: absolute;
left: 494px;
top: 160px;
width: 24px}
#UnitSwitch10Caption {
left: 482px;
top: 146px;
width: 48px}

View File

@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>retro-220 Emulator Console Printer</title>
<!--
/***********************************************************************
* retro-220/webUI B220ConsolePrinter.html
************************************************************************
* Copyright (c) 2017, Paul Kimpel.
* Licensed under the MIT License, see
* http://www.opensource.org/licenses/mit-license.php
************************************************************************
* Burroughs 220 Console printer (teletype) window.
************************************************************************
* 2017-03-17 P.Kimpel
* Original version, from retro-205 D205Flexowriter.html.
***********************************************************************/
-->
<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="B220Common.css">
<link id=printerStyleSheet rel=stylesheet type="text/css" href="B220ConsolePrinter.css">
</head>
<body id=PrinterBody class=deviceBody>
<div id=Printer class=panelSurface>
<div id=LineFeedBtn class=blackButton3></div>
<div id=LineFeedBtnCaption class=caption>LINE FEED</div>
<button id=OpenPanelBtn class=plainButton title="Click to open the printer control panel">Open Panel</button>
<div id=CarriageReturnBtnCaption class=caption>CAR. RET.</div>
<div id=CarriageReturnBtn class=blackButton3></div>
<div id=PrinterPlaten>
<pre id=Paper class=paper title="Double-click to copy all text">&nbsp;</pre>
<div id=EndOfPaper>&nbsp;</div>
</div>
<div id=FormatControlsDiv>
<button id=ClosePanelBtn class=plainButton title="Click to close the printer control panel">Close Panel</button>
<div id=RemoteKnobRemoteCaption class=caption>REMOTE</div>
<div id=RemoteKnobLocalCaption class=caption>LOCAL</div>
<div id=ZeroSuppressOn class=caption>ZERO<br>SUPPRESS</div>
<div id=ZeroSuppressOff class=caption>NORMAL</div>
<div id=MapMemoryOn class=caption>MAP<br>MEMORY</div>
<div id=MapMemoryNormal class=caption>NORMAL</div>
<div id=FormatKnobSpaceCaption class=caption>SPACE</div>
<div id=FormatKnobTabCaption class=caption>TAB</div>
<div id=FormatKnobCarRetCaption class=caption>CAR.RET.</div>
<div id=FormatKnobCaption class=caption>FORMAT</div>
<div id=ColumnsCaption class=caption>COLUMNS</div>
<input id=Columns class=center type=text maxlength=2 value=72 title="Auto-return column, 1-80">
<div id=TabStopsCaption class=caption>TAB STOPS</div>
<input id=TabStops class=data type=text maxlength=80 title="comma-delimited list of 1-relative tab stops">
<div id=UnitSwitch0Caption class=caption>SPO</div>
<div id=UnitSwitch1Caption class=caption>1</div>
<div id=UnitSwitch2Caption class=caption>2</div>
<div id=UnitSwitch3Caption class=caption>3</div>
<div id=UnitSwitch4Caption class=caption>4</div>
<div id=UnitSwitch5Caption class=caption>5</div>
<div id=UnitSwitch6Caption class=caption>6</div>
<div id=UnitSwitch7Caption class=caption>7</div>
<div id=UnitSwitch8Caption class=caption>8</div>
<div id=UnitSwitch9Caption class=caption>9</div>
<div id=UnitSwitch10Caption class=caption>0</div>
</div>
</div>
</body>
</html>

566
webUI/B220ConsolePrinter.js Normal file
View File

@@ -0,0 +1,566 @@
/***********************************************************************
* retro-220/webUI B220ConsolePrinter.js
************************************************************************
* Copyright (c) 2017, Paul Kimpel.
* Licensed under the MIT License, see
* http://www.opensource.org/licenses/mit-license.php
************************************************************************
* Burroughs 220 Console Printer and
* High-Speed Paper Tape Punch devices.
************************************************************************
* 2017-03-17 P.Kimpel
* Original version, from retro-205 D205ConsoleOutput.js.
***********************************************************************/
"use strict";
/**************************************/
function B220ConsolePrinter(mnemonic, unitIndex, config) {
/* Constructor for the Console Printer object */
var top = unitIndex*32;
var left = unitIndex*32;
this.config = config; // System configuration object
this.mnemonic = mnemonic; // Unit mnemonic
this.unitIndex = unitIndex; // Unit index into console output units
this.outTimer = 0; // output setCallback() token
this.columns = 72; // right-margin auto-return position
this.format = 0; // 0=space, 1=tab, 2=carriage-return
this.nextCharTime = 0; // next time a character can be printed
this.mapMemory = 0; // map-memory switch setting
this.unitMask = 0; // unit selection mask
this.unitSwitch = new Array(11); // unit selection switch objects
this.tabStop = []; // 0-relative tab stop positions
this.zeroSuppress = 0; // zero-suppression switch setting
this.boundButton_Click = B220Util.bindMethod(this, B220ConsolePrinter.prototype.button_Click);
this.boundText_OnChange = B220Util.bindMethod(this, B220ConsolePrinter.prototype.text_OnChange);
this.boundFlipSwitch = B220Util.bindMethod(this, B220ConsolePrinter.prototype.flipSwitch);
this.boundReceiveSign = B220Util.bindMethod(this, B220ConsolePrinter.prototype.receiveSign);
this.boundReceiveChar = B220Util.bindMethod(this, B220ConsolePrinter.prototype.receiveChar);
this.clear();
// Create the printer window and onload event
this.doc = null;
this.paper = null;
this.printerEOP = null;
this.printerLine = 0;
this.printerCol = 0;
this.window = window.open("../webUI/B220ConsolePrinter.html", mnemonic,
"location=no,scrollbars=no,resizable,width=640,height=300," +
"left=" + left + ",top=" + top);
this.window.addEventListener("load", B220Util.bindMethod(this,
B220ConsolePrinter.prototype.printerOnLoad));
}
/**************************************/
B220ConsolePrinter.offSwitchImage = "./resources/ToggleDown.png";
B220ConsolePrinter.onSwitchImage = "./resources/ToggleUp.png";
B220ConsolePrinter.charsPerSecond = 10; // Printer speed
B220ConsolePrinter.charPeriod = 1000/B220ConsolePrinter.charsPerSecond;
// Inter-character period, ms
B220ConsolePrinter.pageSize = 66; // lines/page for form-feed
B220ConsolePrinter.maxScrollLines = 15000;
// Maximum amount of paper scrollback
B220ConsolePrinter.codeXlate = [ // translate internal B220 code to ANSI
" ", "?", " ", ".", "\u00A4", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 00-0F
"&", "?", "?", "$", "*", "\f", "\n", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 10-1F
"-", "/", "?", ",", "%", "?", "\t", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 20-2F
"?", "?", "?", "#", "@", "!", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 30-3F
"?", "A", "B", "C", "D", "E", "F", "G", "H", "I", "?", "?", "?", "?", "?", "?", // 40-4F
"?", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "?", "?", "?", "?", "?", "?", // 50-5F
"?", "?", "S", "T", "U", "V", "W", "X", "Y", "Z", "?", "?", "?", "?", "?", "?", // 60-6F
"?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 70-7F
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "?", "?", "?", "?", "?", "?", // 80-8F
"?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?"]; // 90-9F
/**************************************/
B220ConsolePrinter.prototype.clear = function clear() {
/* Initializes (and if necessary, creates) the SPO unit state */
this.ready = false; // ready status
this.busy = false; // busy status
this.eowAction = 0; // 1 => End-of-Word action needed
this.suppressLZ = 0; // 1 => currently suppressing leading zeroes
};
/**************************************/
B220ConsolePrinter.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;
};
/**************************************/
B220ConsolePrinter.prototype.$$ = function $$(e) {
return this.doc.getElementById(e);
};
/**************************************/
B220ConsolePrinter.prototype.emptyPaper = function emptyPaper() {
/* Empties the printer output "paper" and initializes it for new output */
while (this.paper.firstChild) {
this.paper.removeChild(this.paper.firstChild);
}
this.paper.appendChild(this.doc.createTextNode(""));
};
/**************************************/
B220ConsolePrinter.prototype.emptyLine = function emptyLine(text) {
/* Removes excess lines already output, then appends a new text node to the
<pre> element within the paper element. Note that "text" is an ANSI string */
var paper = this.paper;
var line = text || "";
while (paper.childNodes.length > B220ConsolePrinter.maxScrollLines) {
paper.removeChild(paper.firstChild);
}
paper.lastChild.nodeValue += "\n"; // newline
paper.appendChild(this.doc.createTextNode(line));
++this.printerLine;
this.printerCol = line.length;
this.printerEOP.scrollIntoView();
};
/**************************************/
B220ConsolePrinter.prototype.printChar = function printChar(code) {
/* Outputs the character "code" to the device */
var c = B220ConsolePrinter.codeXlate[code];
var line;
var len;
if (c != "?") { // some 220 codes just don't print
line = this.paper.lastChild.nodeValue;
len = line.length;
if (len < 1) {
this.paper.lastChild.nodeValue = c;
this.printerCol = 1;
} else if (len < this.columns) {
this.paper.lastChild.nodeValue = line + c;
++this.printerCol;
} else {
this.emptyLine(c);
}
}
};
/**************************************/
B220ConsolePrinter.prototype.printTab = function printTab() {
/* Simulates tabulation by outputting an appropriate number of spaces */
var tabCol; // tabulation column
var x; // scratch index
for (x=0; x<this.tabStop.length; ++x) {
if (this.tabStop[x] > this.printerCol) {
tabCol = this.tabStop[x];
break; // out of for loop
}
} // for x
if (this.columns < tabCol) {
this.emptyLine(); // tab would overflow right margin
} else {
while (this.printerCol < tabCol) {
this.printChar(0x00); // output a space
}
}
};
/**************************************/
B220ConsolePrinter.prototype.printFormFeed = function printFormFeed() {
/* Simulates a form feed by outputting an appropriate number of blank lines */
this.printerLine %= B220ConsolePrinter.pageSize;
while (this.printerLine < B220ConsolePrinter.pageSize) {
this.emptyLine();
}
};
/**************************************/
B220ConsolePrinter.prototype.resizeWindow = function resizeWindow(ev) {
/* Handles the window onresize event by scrolling the "paper" so it remains at the end */
this.printerEOP.scrollIntoView();
};
/**************************************/
B220ConsolePrinter.prototype.copyPaper = function copyPaper(ev) {
/* Copies the text contents of the "paper" area of the device, opens a new
temporary window, and pastes that text into the window so it can be copied
or saved by the user */
var text = this.paper.textContent;
var title = "B220 " + this.mnemonic + " Text Snapshot";
var win = window.open("./B220FramePaper.html", "TTY-Snapshot",
"scrollbars,resizable,width=500,height=500");
win.moveTo((screen.availWidth-win.outerWidth)/2, (screen.availHeight-win.outerHeight)/2);
win.addEventListener("load", function() {
var doc;
doc = win.document;
doc.title = title;
doc.getElementById("Paper").textContent = text;
});
this.emptyPaper();
this.emptyLine();
ev.preventDefault();
ev.stopPropagation();
};
/**************************************/
B220ConsolePrinter.prototype.button_Click = function button_Click(ev) {
/* Handler for button clicks */
switch (ev.target.id) {
case "LineFeedBtn":
case "CarriageReturnBtn":
if (!this.ready) {
this.emptyLine();
}
break;
case "OpenPanelBtn":
ev.target.disabled = true;
this.$$("FormatControlsDiv").style.display = "block";
break;
case "ClosePanelBtn":
this.$$("OpenPanelBtn").disabled = false;
this.$$("FormatControlsDiv").style.display = "none";
break;
} // switch ev.target.id
ev.preventDefault();
ev.stopPropagation();
};
/**************************************/
B220ConsolePrinter.prototype.flipSwitch = function flipSwitch(ev) {
/* Handler for switch clicks */
var id = ev.target.id;
var prefs = this.config.getNode("ConsoleOutput.units", this.unitIndex);
var x;
switch (id) {
case "ZeroSuppressSwitch":
this.zeroSuppressSwitch.flip();
prefs.zeroSuppress = this.zeroSuppress = this.zeroSuppressSwitch.state;
break;
case "MapMemorySwitch":
this.mapMemorySwitch.flip();
prefs.mapMemory, this.mapMemory = this.mapMemorySwitch.state;
break;
case "RemoteKnob":
this.remoteKnob.step();
prefs.remote = this.remoteKnob.position;
this.ready = (this.remoteKnob.position != 0);
break;
case "FormatKnob":
this.formatKnob.step();
prefs.format = this.formatKnob.position;
this.format = this.formatKnob.position;
break;
default:
x = id.indexOf("UnitSwitch");
if (x == 0) {
x = parseInt(id.substring(10), 10);
if (!isNaN(x)) {
this.unitSwitch[x].flip();
this.unitMask ^= B220Processor.pow2[x];
prefs.unitMask = this.unitMask;
}
}
break;
}
this.config.putNode("ConsoleOutput.units", prefs, this.unitIndex);
ev.preventDefault();
ev.stopPropagation();
};
/**************************************/
B220ConsolePrinter.prototype.text_OnChange = function text_OnChange(ev) {
/* Handler for text onchange events */
var prefs = this.config.getNode("ConsoleOutput.units", this.unitIndex);
var text = ev.target.value;
var v;
switch (ev.target.id) {
case "Columns":
v = parseInt(text, 10);
if (!isNaN(v)) {
this.columns = v;
ev.target.value = text = v.toFixed();
prefs.columns = v;
}
break;
case "TabStops":
v = this.parseTabStops(prefs.tabs || "", this.window);
if (v !== null) {
this.tabStop = v;
ev.target.value = text = v.join(",");
prefs.tabs = text;
}
break;
} // switch ev.target.id
this.config.putNode("ConsoleOutput.units", prefs, this.unitIndex);
ev.preventDefault();
ev.stopPropagation();
};
/**************************************/
B220ConsolePrinter.prototype.parseTabStops = function parsetabStops(text, alertWin) {
/* Parses a comma-delimited list of 1-relative tab stops. If the list is parsed
successfully, returns an array of 0-relative tab stop positions; otherwise
returns null. An alert is displayed on the window for the first parsing or
out-of-sequence error */
var col;
var cols;
var copacetic = true;
var lastCol = 0;
var raw;
var x;
var tabStop = [];
if (text.search(/\S/) >= 0) {
cols = text.split(",");
for (x=0; x<cols.length; ++x) {
raw = cols[x].trim();
if (raw.length > 0) { // ignore empty fields
col = parseInt(raw, 10);
if (isNaN(col)) {
copacetic = false;
alertWin.alert("Tab stop #" + (x+1) + " (\"" + cols[x] + "\") is not numeric");
break; // out of for loop
} else if (col <= lastCol) {
copacetic = false;
alertWin.alert("Tab stop #" + (x+1) + " (\"" + col + "\") is out of sequence");
break; // out of for loop
} else {
lastCol = col;
tabStop.push(col-1);
}
}
} // for x
}
return (copacetic ? tabStop : null);
};
/**************************************/
B220ConsolePrinter.prototype.printerOnLoad = function printerOnLoad() {
/* Initializes the Teletype printer window and user interface */
var body;
var id;
var mask;
var prefs = this.config.getNode("ConsoleOutput.units", this.unitIndex);
var tabStop;
var x;
this.doc = this.window.document;
this.doc.title = "retro-220 Printer - " + this.mnemonic;
this.paper = this.$$("Paper");
this.printerEOP = this.$$("EndOfPaper");
this.emptyPaper();
this.emptyLine();
body = this.$$("FormatControlsDiv");
this.remoteKnob = new BlackControlKnob(body, null, null, "RemoteKnob",
prefs.remote, [20, -20]);
this.ready = (prefs.remote != 0);
this.zeroSuppressSwitch = new ToggleSwitch(body, null, null, "ZeroSuppressSwitch",
B220ConsolePrinter.offSwitchImage, B220ConsolePrinter.onSwitchImage);
this.zeroSuppressSwitch.set(prefs.zeroSuppress);
this.zeroSuppress = this.zeroSuppressSwitch.state;
this.mapMemorySwitch = new ToggleSwitch(body, null, null, "MapMemorySwitch",
B220ConsolePrinter.offSwitchImage, B220ConsolePrinter.onSwitchImage);
this.mapMemorySwitch.set(prefs.mapMemory);
this.mapMemory = this.mapMemorySwitch.state;
mask = 0x001;
this.unitMask = prefs.unitMask;
for (x=0; x<this.unitSwitch.length; ++x) {
id = "UnitSwitch" + x.toFixed();
this.unitSwitch[x] = new ToggleSwitch(body, null, null, id,
B220ConsolePrinter.offSwitchImage, B220ConsolePrinter.onSwitchImage);
this.unitSwitch[x].set(prefs.unitMask & mask ? 1 : 0);
this.unitSwitch[x].addEventListener("click", this.boundFlipSwitch);
mask <<= 1;
}
this.formatKnob = new BlackControlKnob(body, null, null, "FormatKnob",
prefs.format, [-30, 0, 30]);
this.format = prefs.format;
this.columns = prefs.columns;
this.$$("Columns").value = prefs.columns.toFixed();
tabStop = this.parseTabStops(prefs.tabs || "", this.window);
if (tabStop !== null) {
this.tabStop = tabStop;
this.$$("TabStops").value = tabStop.join(",");
}
// Events
this.window.addEventListener("beforeunload",
B220ConsolePrinter.prototype.beforeUnload);
this.window.addEventListener("resize",
B220Util.bindMethod(this, B220ConsolePrinter.prototype.resizeWindow));
this.paper.addEventListener("dblclick",
B220Util.bindMethod(this, B220ConsolePrinter.prototype.copyPaper));
this.$$("OpenPanelBtn").addEventListener("click", this.boundButton_Click);
this.$$("ClosePanelBtn").addEventListener("click", this.boundButton_Click);
this.$$("LineFeedBtn").addEventListener("click", this.boundButton_Click);
this.$$("CarriageReturnBtn").addEventListener("click", this.boundButton_Click);
this.zeroSuppressSwitch.addEventListener("click", this.boundFlipSwitch);
this.mapMemorySwitch.addEventListener("click", this.boundFlipSwitch);
this.remoteKnob.addEventListener("click", this.boundFlipSwitch);
this.formatKnob.addEventListener("click", this.boundFlipSwitch);
this.$$("Columns").addEventListener("change", this.boundText_OnChange);
this.$$("TabStops").addEventListener("change", this.boundText_OnChange);
this.window.focus();
};
/***********************************************************************
* Output Entry Points *
***********************************************************************/
/**************************************/
B220ConsolePrinter.prototype.initiateOutput = function initiateOutput(successor) {
/* Initiates output to the printer. This simply calls the successor function,
passing our receiver function, so the processor can get the ball rolling */
successor(this.boundReceiveSign);
};
/**************************************/
B220ConsolePrinter.prototype.receiveSign = function receiveSign(char, successor) {
/* Receives the sign character from the processor and handles it according
to the value of the sign and the setting of the Map Memory and LZ Suppress
switches */
var delay = B220ConsolePrinter.charPeriod; // default character delay
var stamp = performance.now(); // current time
switch (true) {
case this.mapMemory != 0: // transparent output
this.eowAction = 1;
this.suppressLZ = 0;
this.printChar(char);
break;
case char == 0x82: // sign = 2, print alphanumeric
this.eowAction = 0;
this.suppressLZ = 0;
delay = 0; // eat the sign char
break;
case this.zeroSuppress == 1: // sign != 2, zero suppress
this.eowAction = 1;
this.suppressLZ = (char == 0x80 ? 1 : 0);
this.printChar(0x00); // print " "
break;
case (char & 0x01) == 1: // sign odd, no zero suppress
this.eowAction = 1;
this.suppressLZ = 0;
this.printChar(0x20); // print "-"
break;
default: // sign even, no zero suppress
this.eowAction = 1;
this.suppressLZ = 0;
this.printChar(0x00); // print " "
break;
} // switch
if (this.nextCharTime <= stamp) {
this.nextCharTime = stamp;
}
setCallback(this.mnemonic, this, this.nextCharTime-stamp+delay, successor, this.boundReceiveChar);
this.nextCharTime += delay;
};
/**************************************/
B220ConsolePrinter.prototype.receiveChar = function receiveChar(char, successor) {
/* Receives a non-sign character from the processor and outputs it. Special handling
is provided for tabs, carriage returns, form feeds, and end-of-word characters */
var delay = B220ConsolePrinter.charPeriod; // default character delay
var nextReceiver = this.boundReceiveChar; // default routine to receive next char
var stamp = performance.now(); // current time
switch (char) {
case 0x80: // zero
this.printChar(this.suppressLZ ? 0x00 : char);
break;
case 0x15: // form-feed
this.suppressLZ = 0;
this.printFormFeed();
break;
case 0x16: // carriage-return
this.suppressLZ = 0;
this.emptyLine();
break;
case 0x26: // tab
this.suppressLZ = 0;
this.printTab();
break;
case 0x35: // end-of-word
delay = 0;
nextReceiver = this.boundReceiveSign; // next will be start of a new word
if (this.eowAction) {
switch (this.format) {
case 0: // EOW = space
this.printChar(0x00);
break;
case 1: // EOW = tab
this.printTab();
break;
case 2: // EOW = carriage-return
this.emptyLine();
break;
}
}
break;
default: // all others
this.suppressLZ = 0;
this.printChar(char);
break;
} // switch char
setCallback(this.mnemonic, this, this.nextCharTime-stamp+delay, successor, nextReceiver);
this.nextCharTime += delay;
};
/**************************************/
B220ConsolePrinter.prototype.shutDown = function shutDown() {
/* Shuts down the device */
if (this.outTimer) {
clearCallback(this.outTimer);
}
if (this.window) {
this.window.removeEventListener("beforeunload", B220ConsolePrinter.prototype.beforeUnload);
this.window.close();
this.window = null;
}
};

View File

@@ -18,11 +18,15 @@ function B220ControlConsole(p, systemShutdown) {
var h = 600;
var w = 1064;
var mnemonic = "ControlConsole";
var outputConfig = p.config.getNode("ConsoleOutput");
var u;
var x;
this.config = p.config; // System Configuration object
this.intervalToken = 0; // setInterval() token for panel refresh
this.p = p; // B220Processor object
this.systemShutdown = systemShutdown; // system shut-down callback
this.keyboard = new B220ConsoleKeyboard(p);
this.boundLamp_Click = B220Util.bindMethod(this, B220ControlConsole.prototype.lamp_Click);
@@ -32,6 +36,37 @@ function B220ControlConsole(p, systemShutdown) {
this.boundResetTimer = B220Util.bindMethod(this, B220ControlConsole.prototype.resetTimer);
this.boundUpdatePanel = B220Util.bindMethod(this, B220ControlConsole.prototype.updatePanel);
// Configure the console output unit objects. These can be any combination
// of paper tape punches and teletype printers.
this.outputUnit = [
null, // 0=unit A (usually the SPO)
null, // 1=unit B
null, // 2=unit C
null, // 3=unit D
null, // 4=unit E
null, // 5=unit F
null, // 6=unit G
null, // 7=unit H
null, // 8=unit I
null, // 9=unit J
null]; //10=unit K
for (x=0; x<outputConfig.units.length; ++x) {
u = outputConfig.units[x];
switch (u.type.substring(0, 3)) {
case "TTY":
this.outputUnit[x] = new B220ConsolePrinter(u.type, x, this.config);
break;
case "PTP":
this.outputUnit[x] = new B220PaperTapePunch(u.type, x, this.config);
break;
default:
this.outputUnit[x] = null;
break;
} // switch u.type
}
// Create the Console window
this.doc = null;
this.window = window.open("../webUI/B220ControlConsole.html", mnemonic,
"location=no,scrollbars,resizable,width=" + w + ",height=" + h +
@@ -148,10 +183,10 @@ B220ControlConsole.prototype.displayCallbackState = function displayCallbackStat
/**************************************/
B220ControlConsole.prototype.updatePanel = function updatePanel() {
/* Updates the panel from the current Processor state */
var eLevel;
var eLevel; // EXECUTE lamp glow level
var p = this.p; // local copy of Processor object
var stamp = performance.now();
var text;
var text; // run timer display text
var timer = p.runTimer;
// Update the interval timer
@@ -176,12 +211,12 @@ B220ControlConsole.prototype.updatePanel = function updatePanel() {
// Alarm Panel
this.digitCheckLamp.set(p.digitCheckAlarm.glow);
this.programCheckLamp.set(p.programCheckAlarm.glow);
this.storageLamp.set(p.storageAlarm.glow);
this.magneticTapeLamp.set(p.magneticTapeAlarm.glow);
this.cardatronLamp.set(p.paperTapeAlarm.glow);
this.paperTapeLamp.set(p.cardatronAlarm.glow);
this.highSpeedPrinterLamp.set(p.highSpeedPrinterAlarm.glow);
this.programCheckLamp.set(p.ALT.glow);
this.storageLamp.set(p.MET.glow);
this.magneticTapeLamp.set(p.TAT.glow);
this.paperTapeLamp.set(p.PAT.glow);
this.cardatronLamp.set(p.CRT.glow);
this.highSpeedPrinterLamp.set(p.HAT.glow);
this.systemNotReadyLamp.set(p.systemNotReady.glow);
this.computerNotReadyLamp.set(p.computerNotReady.glow);
@@ -335,52 +370,52 @@ B220ControlConsole.prototype.switch_Click = function switch_Click(ev) {
case "ControlSwitch1":
this.controlSwitch1.flip();
this.config.putNode("ControlConsole.controlSwitch1", this.controlSwitch1.state);
this.config.putNode("ControlConsole.PCS1SW", this.controlSwitch1.state);
p.PC1SW = this.controlSwitch1.state;
break;
case "ControlSwitch2":
this.controlSwitch2.flip();
this.config.putNode("ControlConsole.controlSwitch2", this.controlSwitch2.state);
this.config.putNode("ControlConsole.PCS2SW", this.controlSwitch2.state);
p.PC2SW = this.controlSwitch2.state;
break;
case "ControlSwitch3":
this.controlSwitch3.flip();
this.config.putNode("ControlConsole.controlSwitch3", this.controlSwitch3.state);
this.config.putNode("ControlConsole.PCS3SW", this.controlSwitch3.state);
p.PC3SW = this.controlSwitch3.state;
break;
case "ControlSwitch4":
this.controlSwitch4.flip();
this.config.putNode("ControlConsole.controlSwitch4", this.controlSwitch4.state);
this.config.putNode("ControlConsole.PCS4SW", this.controlSwitch4.state);
p.PC4SW = this.controlSwitch4.state;
break;
case "ControlSwitch5":
this.controlSwitch5.flip();
this.config.putNode("ControlConsole.controlSwitch5", this.controlSwitch5.state);
this.config.putNode("ControlConsole.PCS5SW", this.controlSwitch5.state);
p.PC5SW = this.controlSwitch5.state;
break;
case "ControlSwitch6":
this.controlSwitch6.flip();
this.config.putNode("ControlConsole.controlSwitch6", this.controlSwitch6.state);
this.config.putNode("ControlConsole.PCS6SW", this.controlSwitch6.state);
p.PC6SW = this.controlSwitch6.state;
break;
case "ControlSwitch7":
this.controlSwitch7.flip();
this.config.putNode("ControlConsole.controlSwitch7", this.controlSwitch7.state);
this.config.putNode("ControlConsole.PCS7SW", this.controlSwitch7.state);
p.PC7SW = this.controlSwitch7.state;
break;
case "ControlSwitch8":
this.controlSwitch8.flip();
this.config.putNode("ControlConsole.controlSwitch8", this.controlSwitch8.state);
this.config.putNode("ControlConsole.PCS8SW", this.controlSwitch8.state);
p.PC8SW = this.controlSwitch8.state;
break;
case "ControlSwitch9":
this.controlSwitch9.flip();
this.config.putNode("ControlConsole.controlSwitch9", this.controlSwitch9.state);
this.config.putNode("ControlConsole.PCS9SW", this.controlSwitch9.state);
p.PC9SW = this.controlSwitch9.state;
break;
case "ControlSwitch10":
this.controlSwitch10.flip();
this.config.putNode("ControlConsole.controlSwitch10", this.controlSwitch10.state);
this.config.putNode("ControlConsole.PCS0SW", this.controlSwitch10.state);
p.PC0SW = this.controlSwitch10.state;
break;
@@ -392,22 +427,22 @@ B220ControlConsole.prototype.switch_Click = function switch_Click(ev) {
break;
case "SOnSwitch":
this.sOnSwitch.flip();
this.config.putNode("ControlConsole.sOnSwitch", this.sOnSwitch.state);
this.config.putNode("ControlConsole.SONSW", this.sOnSwitch.state);
p.SONSW = this.sOnSwitch.state;
break;
case "UnitsSwitch":
this.unitsSwitch.flip();
this.config.putNode("ControlConsole.unitsSwitch", this.unitsSwitch.state);
this.config.putNode("ControlConsole.SUNITSSW", this.unitsSwitch.state);
p.SUNITSSW = this.unitsSwitch.state;
break;
case "SToPSwitch":
this.sToPSwitch.flip();
this.config.putNode("ControlConsole.sToPSwitch", this.sToPSwitch.state);
this.config.putNode("ControlConsole.STOPSW", this.sToPSwitch.state);
p.STOPSW = this.sToPSwitch.state;
break;
case "SToCSwitch":
this.sToCSwitch.flip();
this.config.putNode("ControlConsole.sToCSwitch", this.sToCSwitch.state);
this.config.putNode("ControlConsole.STOCSW", this.sToCSwitch.state);
p.STOCSW = this.sToCSwitch.state;
break;
case "ResetTransferSwitch":
@@ -536,52 +571,52 @@ B220ControlConsole.prototype.consoleOnLoad = function consoleOnLoad() {
panel = this.$$("ControlSwitchPanel");
this.controlSwitch1 = new OrganSwitch(panel, null, null, "ControlSwitch1",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch1.set(this.config.getNode("ControlConsole.controlSwitch1"));
this.controlSwitch1.set(this.config.getNode("ControlConsole.PCS1SW"));
p.PC1SW = this.controlSwitch1.state;
this.controlSwitch2 = new OrganSwitch(panel, null, null, "ControlSwitch2",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch2.set(this.config.getNode("ControlConsole.controlSwitch2"));
this.controlSwitch2.set(this.config.getNode("ControlConsole.PCS2SW"));
p.PC2SW = this.controlSwitch2.state;
this.controlSwitch3 = new OrganSwitch(panel, null, null, "ControlSwitch3",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch3.set(this.config.getNode("ControlConsole.controlSwitch3"));
this.controlSwitch3.set(this.config.getNode("ControlConsole.PCS3SW"));
p.PC3SW = this.controlSwitch3.state;
this.controlSwitch4 = new OrganSwitch(panel, null, null, "ControlSwitch4",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch4.set(this.config.getNode("ControlConsole.controlSwitch4"));
this.controlSwitch4.set(this.config.getNode("ControlConsole.PCS4SW"));
p.PC4SW = this.controlSwitch4.state;
this.controlSwitch5 = new OrganSwitch(panel, null, null, "ControlSwitch5",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch5.set(this.config.getNode("ControlConsole.controlSwitch5"));
this.controlSwitch5.set(this.config.getNode("ControlConsole.PCS5SW"));
p.PC5SW = this.controlSwitch5.state;
this.controlSwitch6 = new OrganSwitch(panel, null, null, "ControlSwitch6",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch6.set(this.config.getNode("ControlConsole.controlSwitch6"));
this.controlSwitch6.set(this.config.getNode("ControlConsole.PCS6SW"));
p.PC6SW = this.controlSwitch6.state;
this.controlSwitch7 = new OrganSwitch(panel, null, null, "ControlSwitch7",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch7.set(this.config.getNode("ControlConsole.controlSwitch7"));
this.controlSwitch7.set(this.config.getNode("ControlConsole.PCS7SW"));
p.PC7SW = this.controlSwitch7.state;
this.controlSwitch8 = new OrganSwitch(panel, null, null, "ControlSwitch8",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch8.set(this.config.getNode("ControlConsole.controlSwitch8"));
this.controlSwitch8.set(this.config.getNode("ControlConsole.PCS8SW"));
p.PC8SW = this.controlSwitch8.state;
this.controlSwitch9 = new OrganSwitch(panel, null, null, "ControlSwitch9",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch9.set(this.config.getNode("ControlConsole.controlSwitch9"));
this.controlSwitch9.set(this.config.getNode("ControlConsole.PCS9SW"));
p.PC9SW = this.controlSwitch9.state;
this.controlSwitch10 = new OrganSwitch(panel, null, null, "ControlSwitch10",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.controlSwitch10.set(this.config.getNode("ControlConsole.controlSwitch10"));
this.controlSwitch10.set(this.config.getNode("ControlConsole.PCS0SW"));
p.PC0SW = this.controlSwitch10.state;
panel = this.$$("OperationSwitchPanel");
@@ -600,22 +635,22 @@ B220ControlConsole.prototype.consoleOnLoad = function consoleOnLoad() {
this.sOnSwitch = new OrganSwitch(panel, null, null, "SOnSwitch",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.sOnSwitch.set(this.config.getNode("ControlConsole.sOnSwitch"));
this.sOnSwitch.set(this.config.getNode("ControlConsole.SONSW"));
p.SONSW = this.sOnSwitch.state;
this.unitsSwitch = new OrganSwitch(panel, null, null, "UnitsSwitch",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.unitsSwitch.set(this.config.getNode("ControlConsole.unitsSwitch"));
this.unitsSwitch.set(this.config.getNode("ControlConsole.SUNITSSW"));
p.SUNITSSW = this.unitsSwitch.state;
this.sToPSwitch = new OrganSwitch(panel, null, null, "SToPSwitch",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.sToPSwitch.set(this.config.getNode("ControlConsole.sToPSwitch"));
this.sToPSwitch.set(this.config.getNode("ControlConsole.STOPSW"));
p.STOPSW = this.sToPSwitch.state;
this.sToCSwitch = new OrganSwitch(panel, null, null, "SToCSwitch",
B220ControlConsole.offOrganSwitchImage, B220ControlConsole.onOrganSwitchImage, false);
this.sToCSwitch.set(this.config.getNode("ControlConsole.sToCSwitch"));
this.sToCSwitch.set(this.config.getNode("ControlConsole.STOCSW"));
p.STOCSW = this.sToCSwitch.state;
this.resetTransferSwitch = new OrganSwitch(panel, null, null, "ResetTransferSwitch",
@@ -703,15 +738,48 @@ B220ControlConsole.prototype.keyboardOpen = function keyboardOpen() {
this.keyboard.keyboardOpen();
};
/**************************************/
B220ControlConsole.prototype.outputUnitSelect = function outputUnitSelect(unitNr, successor) {
/* Prepares for paper-tape or SPO output by selecting the first ready device
having a unitMask matching the unitNr parameter. If one is found, returns
that index and calls initiateOutput() for the unit. If no such unit is found,
returns -1 */
var result = -1; // be pessimistic
var u = null; // output unit object
var x; // for loop index
for (x=0; x<this.outputUnit.length; ++x) {
u = this.outputUnit[x];
if (u && u.ready) {
if (u.unitMask & B220Processor.pow2[unitNr]) {
result = x;
u.initiateOutput(successor);
break; // out of for loop
}
}
}
return result;
};
/**************************************/
B220ControlConsole.prototype.shutDown = function shutDown() {
/* Shuts down the panel */
var x;
this.window.removeEventListener("beforeunload", B220ControlConsole.prototype.beforeUnload);
if (this.intervalToken) {
this.window.clearInterval(this.intervalToken);
}
this.keyboard.shutDown();
this.keyboard = null;
for (x=0; x<this.outputUnit.length; ++x) {
if (this.outputUnit[x]) {
this.outputUnit[x].shutDown();
this.outputUnit[x] = null;
}
}
this.window.close();
};

48
webUI/B220FramePaper.html Normal file
View File

@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Burroughs 220 Device Frame Paper Page</title>
<!--
/***********************************************************************
* retro-220/webUI B220FramePaper.html
************************************************************************
* Copyright (c) 2017, Paul Kimpel.
* Licensed under the MIT License, see
* http://www.opensource.org/licenses/mit-license.php
************************************************************************
* Burroughs 220 user interface blank page for use with Card Reader, Punch, etc.
************************************************************************
* 2017-03-19 P.Kimpel
* Original version, from retro-205 D205FramePaper.html
***********************************************************************/
-->
<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="B220Common.css">
<style id=PaperFrameStyles>
BODY {
padding: 2px;
background-color: white}
#Paper {
margin: 0;
font-size: 8pt}
#EndOfPaper {
height: 1px;
border: 0;
opacity: 0}
DIV.whiteBar {
white-space: pre;
background-color: white}
DIV.greenBar {
white-space: pre;
background-color: #CFC}
</style>
</head>
<body>
<div id=Paper class=paper></div>
<div id=EndOfPaper></div>
</body>
</html>

View File

@@ -1,5 +1,5 @@
CACHE MANIFEST
# retro-220 emulator 0.00c, 2017-03-12 12:15
# retro-220 emulator 0.00d, 2017-04-29 12:35
CACHE:
../emulator/B220Processor.js
B220.css
@@ -21,8 +21,9 @@ B220Common.css
B220ConsoleKeyboard.css
B220ConsoleKeyboard.html
B220ConsoleKeyboard.js
#B220ConsoleOutput.css
#B220ConsoleOutput.js
B220ConsolePrinter.css
B220ConsolePrinter.html
B220ConsolePrinter.js
B220ControlConsole.css
B220ControlConsole.html
B220ControlConsole.js
@@ -30,8 +31,7 @@ B220ControlConsole.js
#B220DataFile.html
#B220DataFile.js
#B220DiagMonitor.html
#B220Flexowriter.html
#B220FramePaper.html
B220FramePaper.html
#B220MagTapeControl.css
#B220MagTapeControl.html
#B220MagTapeControl.js
@@ -40,7 +40,9 @@ B220ControlConsole.js
#B220MagTapeDrive.js
#B220MagTapeLoadPanel.html
B220PanelUtil.js
#B220PaperTapePunch.html
B220PaperTapePunch.css
B220PaperTapePunch.html
B220PaperTapePunch.js
#B220PaperTapeReader.html
B220SetCallback.js
B220SystemConfig.css

View File

@@ -133,6 +133,7 @@ function NeonLampBox(parent, x, y, id, caption) {
this.lamp = new NeonLamp(this.element, 3, 3, id + "_Lamp");
this.button = document.createElement("div");
this.button.id = id + "_LampBtn";
this.button.className = NeonLampBox.lampButtonClass;
this.button.textContent = caption;
this.element.appendChild(this.button);
@@ -582,6 +583,7 @@ function BlackControlKnob(parent, x, y, id, initial, positions) {
BlackControlKnob.topCaptionClass = "blackControlKnobTopCaption";
BlackControlKnob.bottomCaptionClass = "blackControlKnobBottomCaption";
BlackControlKnob.className = "blackControlKnob1";
BlackControlKnob.canvasColor = "transparent";
BlackControlKnob.size = 64; // width/height in pixels
/**************************************/
@@ -614,7 +616,7 @@ BlackControlKnob.prototype.set = function set(position) {
dc.save();
dc.translate(halfSize+0.5, halfSize+0.5); // move origin to the center
dc.fillStyle = "#246"; // fill in the panel background (aids antialiasing)
dc.fillStyle = BlackControlKnob.canvasColor;// fill in the panel background (aids antialiasing)
dc.fillRect(-halfSize, -halfSize, BlackControlKnob.size, BlackControlKnob.size);
silverSkirt = dc.createRadialGradient(0, 0, halfSize, 0, 0, quarterSize);
@@ -639,7 +641,7 @@ BlackControlKnob.prototype.set = function set(position) {
dc.save(); // draw the knob indicator
dc.rotate(this.positions[this.position]*degrees);
dc.beginPath();
dc.moveTo(0, -halfSize);
dc.moveTo(0, 1-halfSize);
dc.lineTo(-quarterSize/4, -halfSize+quarterSize/2);
dc.lineTo(quarterSize/4, -halfSize+quarterSize/2);
dc.closePath();
@@ -678,10 +680,10 @@ BlackControlKnob.prototype.setCaption = function setCaption(caption, atBottom) {
e = document.createElement("div");
if (atBottom) {
this.bottomCaptionDiv = e;
e.className = blackControlKnob.bottomCaptionClass;
e.className = BlackControlKnob.bottomCaptionClass;
} else {
this.topCaptionDiv = e;
e.className = blackControlKnob.topCaptionClass;
e.className = BlackControlKnob.topCaptionClass;
}
e.appendChild(document.createTextNode(caption));
this.element.appendChild(e);

View File

@@ -0,0 +1,94 @@
/***********************************************************************
* retro-220/webUI B220PaperTapePunch.css
************************************************************************
* Copyright (c) 2017, Paul Kimpel.
* Licensed under the MIT License, see
* http://www.opensource.org/licenses/mit-license.php
************************************************************************
* Burroughs 220 Paper Tape Punch Unit.
************************************************************************
* 2017-04-28 P.Kimpel
* Original version, from retro-205 D205ConsoleOutput.css.
***********************************************************************/
#PunchBody {
height: 100%;
min-height: 100%;
overflow: hidden;
padding: 0}
#PaperTapePunch {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: 4px;
border-radius: 8px}
#PunchTape {
position: absolute;
left: 8px;
right: 8px;
top: 60px;
bottom: 8px;
min-height: 32px;
min-width: 120px;
overflow-x: hidden;
overflow-y: scroll;
color: black;
background-color: white;
padding: 4px;
border: 1px solid gray}
#Paper {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
padding: 0}
#EndOfPaper {
display: block;
margin: 0;
padding: 0;
opacity: 0}
#EndOfPaper.hidden {
display: none}
#RemoteSwitch {
position: absolute;
width: 24px;
left: 18px;
top: 12px}
#RemoteSwitchOn {
width: 36px;
left: 12px;
top: 6px}
#RemoteSwitchOff {
width: 36px;
left: 12px;
top: 42px}
#ReadyLamp {
position: absolute;
width: 24px;
left: 56px;
top: 14px}
#ReadyLampCaption {
width: 36px;
left: 52px;
top: 6px}
#UnitDesignateKnob {
position: absolute;
text-align: center;
width: 64px;
right: 8px;
top: 18px;
color: white;
background-color: #333}
#UnitDesignateKnobCaption {
width: 64px;
right: 8px;
top: 6px}

View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>retro-220 Emulator Paper Tape Punch</title>
<!--
/***********************************************************************
* retro-220/webUI B220PaperTapePunch.html
************************************************************************
* Copyright (c) 2017, Paul Kimpel.
* Licensed under the MIT License, see
* http://www.opensource.org/licenses/mit-license.php
************************************************************************
* Burroughs 220 High-Speed Paper Tape Punch window.
************************************************************************
* 2017-04-28 P.Kimpel
* Original version, from retro-205/D205PaperTapePunch.html.
***********************************************************************/
-->
<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="B220Common.css">
<link id=punchStyleSheet rel=stylesheet type="text/css" href="B220PaperTapePunch.css">
</head>
<body id=PunchBody class=deviceBody>
<div id=PaperTapePunch class=panelSurface>
<div id=RemoteSwitchOn class=caption>REMOTE</div>
<div id=RemoteSwitchOff class=caption>LOCAL</div>
<div id=ReadyLampCaption class=caption>READY</div>
<div id=UnitDesignateKnobCaption class=caption>UNIT DESIGNATE</div>
<select id=UnitDesignateKnob>
<option value= 0>SPO
<option value= 1>1
<option value= 2>2
<option value= 3>3
<option value= 4>4
<option value= 5>5
<option value= 6>6
<option value= 7>7
<option value= 8>8
<option value= 9>9
<option value=10>0
<option value=99>OFF
</select>
<div id=PunchTape>
<pre id=Paper class=paper title="Double-click to copy all text">&nbsp;</pre>
<div id=EndOfPaper>&nbsp;</div>
</div>
</div>
</body>
</html>

324
webUI/B220PaperTapePunch.js Normal file
View File

@@ -0,0 +1,324 @@
/***********************************************************************
* retro-220/webUI B220PaperTapePunch.js
************************************************************************
* Copyright (c) 2017, Paul Kimpel.
* Licensed under the MIT License, see
* http://www.opensource.org/licenses/mit-license.php
************************************************************************
* Burroughs 220 High-Speed Paper Tape Punch device.
************************************************************************
* 2017-04-28 P.Kimpel
* Original version, from retro-205 D205ConsoleOutput.js.
***********************************************************************/
"use strict";
/**************************************/
function B220PaperTapePunch(mnemonic, unitIndex, config) {
/* Constructor for the Console Paper Tape Punch object */
var top = unitIndex*32;
var left = unitIndex*32;
this.config = config; // System configuration object
this.mnemonic = mnemonic; // Unit mnemonic
this.unitIndex = unitIndex; // Unit index into console output units
this.outTimer = 0; // output setCallback() token
this.nextCharTime = 0; // next time a character can be punched
this.unitMask = 0; // unit selection mask
this.unitSwitch = new Array(11); // unit selection switch objects
this.tabStop = []; // 0-relative tab stop positions
this.boundFlipSwitch = B220Util.bindMethod(this, B220PaperTapePunch.prototype.flipSwitch);
this.boundReceiveSign = B220Util.bindMethod(this, B220PaperTapePunch.prototype.receiveSign);
this.boundReceiveChar = B220Util.bindMethod(this, B220PaperTapePunch.prototype.receiveChar);
this.clear();
// Create the punch window and onload event
this.doc = null;
this.punchTape = null;
this.punchEOP = null;
this.window = window.open("../webUI/B220PaperTapePunch.html", mnemonic,
"location=no,scrollbars=no,resizable,width=240,height=160," +
"left=" + left + ",top=" + top);
this.window.addEventListener("load", B220Util.bindMethod(this,
B220PaperTapePunch.prototype.punchOnLoad));
}
/**************************************/
B220PaperTapePunch.offSwitchImage = "./resources/ToggleDown.png";
B220PaperTapePunch.onSwitchImage = "./resources/ToggleUp.png";
B220PaperTapePunch.charsPerSecond = 60; // Punch speed, characters/second
B220PaperTapePunch.charPeriod = 1000/B220PaperTapePunch.charsPerSecond;
// Inter-character period, ms
B220PaperTapePunch.maxScrollLines = 45000;
// Maximum amount of punch word scrollback
B220PaperTapePunch.codeXlate = [ // translate internal B220 code to ANSI
// Note that ANSI new-line sequences are used for end-of-word characters,
// so B220 carriage-return translates to "|". To avoide space-expansion of
// tab characters, they are translated to "~".
" ", "?", " ", ".", "\u00A4", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 00-0F
"&", "?", "?", "$", "*", "\f", "|", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 10-1F
"-", "/", "?", ",", "%", "?", "~", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 20-2F
"?", "?", "?", "#", "@", "!", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 30-3F
"?", "A", "B", "C", "D", "E", "F", "G", "H", "I", "?", "?", "?", "?", "?", "?", // 40-4F
"?", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "?", "?", "?", "?", "?", "?", // 50-5F
"?", "?", "S", "T", "U", "V", "W", "X", "Y", "Z", "?", "?", "?", "?", "?", "?", // 60-6F
"?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", // 70-7F
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "?", "?", "?", "?", "?", "?", // 80-8F
"?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?"]; // 90-9F
/**************************************/
B220PaperTapePunch.prototype.clear = function clear() {
/* Initializes (and if necessary, creates) the SPO unit state */
this.ready = false; // ready status
this.busy = false; // busy status
};
/**************************************/
B220PaperTapePunch.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;
};
/**************************************/
B220PaperTapePunch.prototype.$$ = function $$(e) {
return this.doc.getElementById(e);
};
/**************************************/
B220PaperTapePunch.prototype.punchEmptyPaper = function punchEmptyPaper() {
/* Empties the punch output "paper" and initializes it for new output */
while (this.punchTape.firstChild) {
this.punchTape.removeChild(this.punchTape.firstChild);
}
this.punchTape.appendChild(this.doc.createTextNode(""));
};
/**************************************/
B220PaperTapePunch.prototype.punchEmptyLine = function punchEmptyLine(text) {
/* Removes excess lines already output, then appends a new text node to the
<pre> element within the paper element. Note that "text" is an ANSI string */
var paper = this.punchTape;
var line = text || "";
while (paper.childNodes.length > B220PaperTapePunch.maxScrollLines) {
paper.removeChild(paper.firstChild);
}
paper.lastChild.nodeValue += "\n"; // newline
paper.appendChild(this.doc.createTextNode(line));
};
/**************************************/
B220PaperTapePunch.prototype.punchChar = function punchChar(code) {
/* Outputs the character "code" to the device */
var c = B220PaperTapePunch.codeXlate[code];
var line;
var len;
if (c != "?") { // some 220 codes just don't print
line = this.punchTape.lastChild.nodeValue;
len = line.length;
if (len < 1) {
this.punchTape.lastChild.nodeValue = c;
} else {
this.punchTape.lastChild.nodeValue = line + c;
}
}
};
/**************************************/
B220PaperTapePunch.prototype.resizeWindow = function resizeWindow(ev) {
/* Handles the window onresize event by scrolling the "tape" so it remains at the end */
this.punchEOP.scrollIntoView();
};
/**************************************/
B220PaperTapePunch.prototype.punchCopyTape = function punchCopyTape(ev) {
/* Copies the text contents of the "paper" area of the device, opens a new
temporary window, and pastes that text into the window so it can be copied
or saved by the user */
var text = this.punchTape.textContent;
var title = "B220 " + this.mnemonic + " Text Snapshot";
var win = window.open("./B220FramePaper.html", "PaperTape-Snapshot",
"scrollbars,resizable,width=500,height=500");
win.moveTo((screen.availWidth-win.outerWidth)/2, (screen.availHeight-win.outerHeight)/2);
win.addEventListener("load", function() {
var doc;
doc = win.document;
doc.title = title;
doc.getElementById("Paper").textContent = text;
});
this.punchEmptyPaper();
ev.preventDefault();
ev.stopPropagation();
};
/**************************************/
B220PaperTapePunch.prototype.flipSwitch = function flipSwitch(ev) {
/* Handler for switch clicks */
var id = ev.target.id;
var prefs = this.config.getNode("ConsoleOutput.units", this.unitIndex);
var x;
switch (id) {
case "RemoteSwitch":
this.remoteSwitch.flip();
prefs.remote = this.remoteSwitch.state;
this.ready = (this.remoteSwitch.state != 0);
this.readyLamp.set(this.remoteSwitch.state);
break;
case "UnitDesignateKnob":
x = this.unitDesignateKnob.selectedIndex;
if (x < 0) {
x = this.unitDesignateKnob.length-1;
this.unitMask = 0;
} else {
this.unitMask = B220Processor.pow2[x];
prefs.unitMask = this.unitMask
}
break;
}
this.config.putNode("ConsoleOutput.units", prefs, this.unitIndex);
ev.preventDefault();
ev.stopPropagation();
};
/**************************************/
B220PaperTapePunch.prototype.punchOnLoad = function punchOnLoad() {
/* Initializes the Paper Tape Punch window and user interface */
var body;
var id;
var mask;
var prefs = this.config.getNode("ConsoleOutput.units", this.unitIndex);
var x;
this.doc = this.window.document;
this.doc.title = "retro-220 Punch - " + this.mnemonic;
this.punchTape = this.$$("Paper");
this.punchEOP = this.$$("EndOfPaper");
this.punchEmptyPaper();
body = this.$$("PaperTapePunch")
this.remoteSwitch = new ToggleSwitch(body, null, null, "RemoteSwitch",
B220PaperTapePunch.offSwitchImage, B220PaperTapePunch.onSwitchImage);
this.remoteSwitch.set(prefs.remote);
this.ready = (this.remoteSwitch.state != 0);
this.readyLamp = new ColoredLamp(body, null, null, "ReadyLamp", "blueLamp lampCollar", "blueLit");
this.readyLamp.set(this.remoteSwitch.state);
this.unitDesignateKnob = this.$$("UnitDesignateKnob");
mask = 0x001;
this.unitMask = prefs.unitMask;
if (this.unitMask == 0) {
this.unitDesignateKnob.selectedIndex = this.unitDesignateKnob.length-1;
} else {
for (x=0; x<this.unitDesignateKnob.length; ++x) {
if (this.unitMask & mask) {
this.unitDesignateKnob.selectedIndex = x;
break; // out of for loop
} else {
mask <<= 1;
}
}
}
// Events
this.window.addEventListener("beforeunload",
B220PaperTapePunch.prototype.beforeUnload);
this.window.addEventListener("resize",
B220Util.bindMethod(this, B220PaperTapePunch.prototype.resizeWindow));
this.punchTape.addEventListener("dblclick",
B220Util.bindMethod(this, B220PaperTapePunch.prototype.punchCopyTape));
this.remoteSwitch.addEventListener("click", this.boundFlipSwitch);
this.unitDesignateKnob.addEventListener("change", this.boundFlipSwitch);
//this.punchWin.moveTo(screen.availWidth-this.punchWin.outerWidth,
// screen.availHeight-this.punchWin.outerHeight);
//this.punchWin.moveTo(0, 430);
this.window.focus();
};
/***********************************************************************
* Output Entry Points *
***********************************************************************/
/**************************************/
B220PaperTapePunch.prototype.initiateOutput = function initiateOutput(successor) {
/* Initiates output to the punch. This simply calls the successor function,
passing our receiver function, so the processor can get the ball rolling */
successor(this.boundReceiveSign);
};
/**************************************/
B220PaperTapePunch.prototype.receiveSign = function receiveSign(char, successor) {
/* Receives the sign character from the processor and handles it according
to the value of the sign and the setting of the Map Memory and LZ Suppress
switches */
var delay = B220PaperTapePunch.charPeriod; // default character delay
var stamp = performance.now(); // current time
this.punchChar(char); // punch the sign
if (this.nextCharTime <= stamp) {
this.nextCharTime = stamp;
}
setCallback(this.mnemonic, this, this.nextCharTime-stamp+delay, successor, this.boundReceiveChar);
this.nextCharTime += delay;
};
/**************************************/
B220PaperTapePunch.prototype.receiveChar = function receiveChar(char, successor) {
/* Receives a non-sign character from the processor and outputs it. Special handling
is provided for tabs, carriage returns, form feeds, and end-of-word characters */
var delay = B220PaperTapePunch.charPeriod; // default character delay
var nextReceiver = this.boundReceiveChar; // default routine to receive next char
var stamp = performance.now(); // current time
switch (char) {
case 0x35: // end-of-word
delay = 0;
this.punchEmptyLine();
nextReceiver = this.boundReceiveSign; // next will be start of a new word
break;
default: // all others
this.punchChar(char);
break;
} // switch char
setCallback(this.mnemonic, this, this.nextCharTime-stamp+delay, successor, nextReceiver);
this.nextCharTime += delay;
};
/**************************************/
B220PaperTapePunch.prototype.shutDown = function shutDown() {
/* Shuts down the device */
if (this.outTimer) {
clearCallback(this.outTimer);
}
if (this.window) {
this.window.removeEventListener("beforeunload", B220PaperTapePunch.prototype.beforeUnload);
this.window.close();
this.window = null;
}
};

View File

@@ -30,6 +30,34 @@
height: 40px;
width: 100%}
#MessageArea {
position: absolute;
text-align: right;
top: 48px;
left: 90px;
right: 8px;
width: auto;
font-size: 8pt}
#SaveBtn {
position: absolute;
top: 68px;
right: 8px;
height: 20px}
#CancelBtn {
position: absolute;
top: 68px;
right: 80px;
height: 20px}
#DefaultsBtn {
position: absolute;
top: 68px;
right: 200px;
width: 80px;
height: 20px}
#SysConfigHeading {
position: absolute;
top: 8px;
@@ -47,8 +75,6 @@
position: absolute;
top: 8px;
right: 8px;
background-color: #EEE;
color: #333333;
font-size: 6pt;
padding-left: 4px;
padding-right: 4px}
@@ -58,21 +84,17 @@
margin: 4px}
#SystemMemorySize {
height: 1em;
width: 1.25em;
text-align: right}
text-align: center}
#ConsoleTable,
#ConsoleOutputTable,
#CardatronTable,
#MagTapeOptionsTable,
#MagTapeTable {
border-spacing: 0;
border-collapse: collapse;
font-family: DejaVuSansWeb, sans-serif;
font-size: 8pt}
border-collapse: collapse}
#ConsoleTable TH,
#ConsoleTable TD,
#ConsoleOutputTable TH,
#ConsoleOutputTable TD,
#CardatronTable TH,
#CardatronTable TD,
#MagTapeOptionsTable TH,
@@ -81,25 +103,4 @@
#MagTapeTable TD {
padding-left: 4px;
padding-right: 4px;
width: 4em;
white-space: nowrap}
#MessageArea {
position: absolute;
bottom: 8px;
left: 8px;
right: 90px;
width: auto;
font-size: 8pt}
#CancelBtn {
position: absolute;
bottom: 8px;
right: 80px;
height: 20px}
#SaveBtn {
position: absolute;
bottom: 8px;
right: 8px;
height: 20px}

View File

@@ -38,19 +38,483 @@
</div>
<hr>
<div id=MessageArea></div>
<button id=CancelBtn class="redButton">CANCEL</button>
<button id=SaveBtn class="greenButton">SAVE</button>
<button id=DefaultsBtn class="redButton" title="Set configurartion to original defaults">DEFAULTS</button>
<div class=heading>System Properties:</div>
<table id=ConsoleTable>
<select id=SystemMemorySize>
<option value=1000>1000
<option value=2000>2000
<option value=3000>3000
<option value=4000>4000
<option selected value=5000>5000
<option value=6000>6000
<option value=7000>7000
<option value=8000>8000
<option value=9000>9000
<option value=10000>10000
</select> Word Memory Size
<div class=heading>Console Output:</div>
<table id=ConsoleOutputTable>
<thead>
<th>Position<th>Type<th>SPO<th>1<th>2<th>3<th>4<th>5<th>6<th>7<th>8<th>9<th>10<th>Format<th>Cols<th>Tabs
<tbody>
<tr>
<td class=center>0
<td class=center>
<input id=SystemMemorySize type=text size=2 maxLength=2>
<td>&times; 1000 Word Memory
<select id=ConsoleOut0Type>
<option selected value=NONE>(not used)
<option value=TTYA>Printer
<option value=PTPA>Punch
<select>
<td class=center>
<input id=ConsoleOut0_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut0_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut0Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut0Columns>
&nbsp;
<td id=ConsoleOut0Tabs>
&nbsp;
<tr>
<td class=center>1
<td class=center>
<input id=SPO type=checkbox value=1 checked>
<td>
<label for=SPO>Supervisory Printer (SPO)
<select id=ConsoleOut1Type>
<option selected value=NONE>(not used)
<option value=TTYB>Printer
<option value=PTPB>Punch
<select>
<td class=center>
<input id=ConsoleOut1_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut1_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut1Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut1Columns>
&nbsp;
<td id=ConsoleOut1Tabs>
&nbsp;
<tr>
<td class=center>2
<td class=center>
<select id=ConsoleOut2Type>
<option selected value=NONE>(not used)
<option value=TTYC>Printer
<option value=PTPC>Punch
<select>
<td class=center>
<input id=ConsoleOut2_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut2_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut2Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut2Columns>
&nbsp;
<td id=ConsoleOut2Tabs>
&nbsp;
<tr>
<td class=center>3
<td class=center>
<select id=ConsoleOut3Type>
<option selected value=NONE>(not used)
<option value=TTYD>Printer
<option value=PTPD>Punch
<select>
<td class=center>
<input id=ConsoleOut3_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut3_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut3Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut3Columns>
&nbsp;
<td id=ConsoleOut3Tabs>
&nbsp;
<tr>
<td class=center>4
<td class=center>
<select id=ConsoleOut4Type>
<option selected value=NONE>(not used)
<option value=TTYE>Printer
<option value=PTPE>Punch
<select>
<td class=center>
<input id=ConsoleOut4_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut4_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut4Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut4Columns>
&nbsp;
<td id=ConsoleOut4Tabs>
&nbsp;
<tr>
<td class=center>5
<td class=center>
<select id=ConsoleOut5Type>
<option selected value=NONE>(not used)
<option value=TTYF>Printer
<option value=PTPF>Punch
<select>
<td class=center>
<input id=ConsoleOut5_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut5_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut5Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut5Columns>
&nbsp;
<td id=ConsoleOut5Tabs>
&nbsp;
<tr>
<td class=center>6
<td class=center>
<select id=ConsoleOut6Type>
<option selected value=NONE>(not used)
<option value=TTYG>Printer
<option value=PTPG>Punch
<select>
<td class=center>
<input id=ConsoleOut6_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut6_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut6Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut6Columns>
&nbsp;
<td id=ConsoleOut6Tabs>
&nbsp;
<tr>
<td class=center>7
<td class=center>
<select id=ConsoleOut7Type>
<option selected value=NONE>(not used)
<option value=TTYH>Printer
<option value=PTPH>Punch
<select>
<td class=center>
<input id=ConsoleOut7_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut7_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut7Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut7Columns>
&nbsp;
<td id=ConsoleOut7Tabs>
&nbsp;
<tr>
<td class=center>8
<td class=center>
<select id=ConsoleOut8Type>
<option selected value=NONE>(not used)
<option value=TTYI>Printer
<option value=PTPI>Punch
<select>
<td class=center>
<input id=ConsoleOut8_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut8_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut8Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut8Columns>
&nbsp;
<td id=ConsoleOut8Tabs>
&nbsp;
<tr>
<td class=center>9
<td class=center>
<select id=ConsoleOut9Type>
<option selected value=NONE>(not used)
<option value=TTYJ>Printer
<option value=PTPJ>Punch
<select>
<td class=center>
<input id=ConsoleOut9_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut9_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut9Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut9Columns>
&nbsp;
<td id=ConsoleOut9Tabs>
&nbsp;
<tr>
<td class=center>10
<td class=center>
<select id=ConsoleOut10Type>
<option selected value=NONE>(not used)
<option value=TTYK>Printer
<option value=PTPK>Punch
<select>
<td class=center>
<input id=ConsoleOut10_SPO type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_1 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_2 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_3 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_4 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_5 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_6 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_7 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_8 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_9 type=checkbox value=1>
<td class=center>
<input id=ConsoleOut10_10 type=checkbox value=1>
<td class=center>
<select id=ConsoleOut10Format>
<option selected value=S>Space
<option value=T>Tab
<option value=R>Car. Ret.
</select>
<td class=center id=ConsoleOut10Columns>
&nbsp;
<td id=ConsoleOut10Tabs>
&nbsp;
</table>
<div class=heading>Cardatron Unit Selection:</div>
@@ -446,11 +910,6 @@
<td class=center>
<input id=MagTape10NotWrite type=checkbox value=1>
</table>
<div id=MessageArea></div>
<button id=CancelBtn class="redButton">CANCEL</button>
<button id=SaveBtn class="greenButton">SAVE</button>
</div>
</body>

View File

@@ -58,23 +58,35 @@ B220SystemConfig.prototype.createConfigData = function createConfigData() {
memorySize: 5000, // 11-digit words
ControlConsole: {
hasSPO: true,
poSuppressSwitch: 0,
skipSwitch: 0,
audibleAlarmSwitch: 0,
outputKnob: 2,
breakpointKnob: 0,
inputKnob: 1},
PCS1SW: 0, // Program Control Switches 1-0
PCS2SW: 0,
PCS3SW: 0,
PCS4SW: 0,
PCS5SW: 0,
PCW6SW: 0,
PCS7SW: 0,
PCS8SW: 0,
PCS9SW: 0,
PCS0SW: 0,
SONSW: 0, // S-register on
SUNITSSW: 0, // S-register units
STOCSW: 0, // S-to-C stop
STOPSW: 0}, // S-to-P stop
Flexowriter: {
zeroSuppressSwitch: 0,
tabSpaceSwitch: 2,
groupingCountersSwitch: 0,
autoStopSwitch: 0,
powerSwitch: 1,
wordsKnob: 0,
linesKnob: 0,
groupsKnob: 0},
ConsoleOutput: {
units: [
{type: "TTYA", zeroSuppress: 0, mapMemory: 0, unitMask: 0x001, remote: 1, format: 0, columns: 72, tabs: "9,17,25,33,41,49,57,65,73,81"},
{type: "NONE"},
{type: "NONE"},
{type: "NONE"},
{type: "NONE"},
{type: "NONE"},
{type: "NONE"},
{type: "NONE"},
{type: "NONE"},
{type: "NONE"},
{type: "NONE"}
]},
Cardatron: {
hasCardatron: true,
@@ -108,54 +120,6 @@ B220SystemConfig.prototype.createConfigData = function createConfigData() {
};
this.flushHandler();
// Convert old Supervisory Panel prefs
s = localStorage.getItem("retro-205-SupervisoryPanel-Prefs");
if (s) {
try {
prefs = JSON.parse(s);
} finally {
// nothing
}
for (pref in prefs) {
this.configData.SupervisoryPanel[pref] = prefs[pref];
}
this.flushHandler();
localStorage.removeItem("retro-205-SupervisoryPanel-Prefs");
}
// Convert old Control Console prefs
s = localStorage.getItem("retro-205-ControlConsole-Prefs");
if (s) {
try {
prefs = JSON.parse(s);
} finally {
// nothing
}
for (pref in prefs) {
this.configData.ControlConsole[pref] = prefs[pref];
}
this.flushHandler();
localStorage.removeItem("retro-205-ControlConsole-Prefs");
}
// Convert old Flexowriter prefs
s = localStorage.getItem("retro-205-Flexowriter-Prefs");
if (s) {
try {
prefs = JSON.parse(s);
} finally {
// nothing
}
for (pref in prefs) {
this.configData.Flexowriter[pref] = prefs[pref];
}
this.flushHandler();
localStorage.removeItem("retro-205-Flexowriter-Prefs");
}
};
/**************************************/
@@ -306,14 +270,31 @@ B220SystemConfig.prototype.setListValue = function setListValue(id, value) {
B220SystemConfig.prototype.loadConfigDialog = function loadConfigDialog() {
/* Loads the configuration UI window with the settings from this.configData */
var cd = this.configData; // local configuration reference
var mask; // unit mask bits
var prefix; // unit id prefix
var unit; // unit configuration object
var x; // unit index
var y; // secondary index
this.$$("SystemMemorySize").value = Math.floor(cd.memorySize/1000).toString();
// System Properties
this.setListValue("SystemMemorySize", cd.memorySize.toString());
// Console units
this.$$("SPO").checked = cd.ControlConsole.hasSPO;
// Console Output units
for (x=0; x<=10; ++x) {
unit = cd.ConsoleOutput.units[x];
prefix = "ConsoleOut" + x;
this.setListValue(prefix + "Type", unit.type);
mask = 0x001;
this.$$(prefix + "_SPO").checked = (unit.unitMask & mask ? true : false);
for (y=1; y<=10; ++y) {
mask <<= 1;
this.$$(prefix + "_" + y).checked = (unit.unitMask & mask ? true : false);
} // for y
this.setListValue(prefix + "Format", unit.format);
this.$$(prefix + "Columns").textContent = (unit.columns ? unit.columns : 72);
this.$$(prefix + "Tabs").textContent = (unit.tabs ? unit.tabs : "");
} // for x
// Cardatron units
for (x=1; x<=7; ++x) {
@@ -363,9 +344,11 @@ B220SystemConfig.prototype.saveConfigDialog = function saveConfigDialog() {
the updated configuration to localStorage */
var cd = this.configData; // local configuration reference
var e; // local element reference
var mask; // unit mask
var prefix; // unit id prefix
var unit; // unit configuration object
var x; // unit index
var y; // secondary index
function getNumber(id, caption, min, max) {
var n;
@@ -382,16 +365,36 @@ B220SystemConfig.prototype.saveConfigDialog = function saveConfigDialog() {
return n;
}
x = getNumber.call(this, "SystemMemorySize", "Memory Size", 1, 10);
if (isNaN(x)) {
return;
} else {
cd.memorySize = x*1000;
}
// System Properties
// Console units
e = this.$$("SystemMemorySize");
x = parseInt(e.options[e.selectedIndex], 10);
cd.memorySize = (isNaN(x) ? 5000 : x);
cd.ControlConsole.hasSPO = this.$$("SPO").checked;
// Console Output units
for (x=0; x<=10; ++x) {
unit = cd.ConsoleOutput.units[x];
prefix = "ConsoleOut" + x;
e = this.$$(prefix + "Type");
unit.type = (e.selectedIndex < 0 ? "NONE" : e.options[e.selectedIndex].value);
mask = 0x001;
unit.unitMask = 0;
if (this.$$(prefix + "_SPO").checked) {
unit.unitMask |= mask;
}
for (y=1; y<=10; ++y) {
mask <<= 1;
if (this.$$(prefix + "_" + y).checked) {
unit.unitMask |= mask;
}
} // for y
e = this.$$(prefix + "Format");
unit.format = (e.selectedIndex < 0 ? "NONE" : e.options[e.selectedIndex].value);
unit.columns = (unit.columns ? unit.columns : 72);
unit.tabs = (unit.tabs ? unit.tabs : "1,9,17,25,33,41,49,57,65,73");
} // for x
// Cardatron units
@@ -472,6 +475,11 @@ B220SystemConfig.prototype.openConfigUI = function openConfigUI() {
B220Util.bindMethod(this, this.saveConfigDialog));
this.$$("CancelBtn").addEventListener("click",
B220Util.bindMethod(this, function(ev) {this.window.close()}));
this.$$("DefaultsBtn").addEventListener("click",
B220Util.bindMethod(this, function(ev) {
this.createConfigData();
this.loadConfigDialog();
}));
this.window.addEventListener("unload",
B220Util.bindMethod(this, this.closeConfigUI), false);
this.loadConfigDialog();
@@ -479,7 +487,7 @@ B220SystemConfig.prototype.openConfigUI = function openConfigUI() {
this.doc = null;
this.window = window.open("../webUI/B220SystemConfig.html", this.configStorageName,
"location=no,scrollbars,resizable,width=640,height=800");
"location=no,scrollbars,resizable,width=800,height=800");
this.window.moveTo(screen.availWidth-this.window.outerWidth-40,
(screen.availHeight-this.window.outerHeight)/2);
this.window.focus();

View File

@@ -44,31 +44,22 @@ B220Util.$$ = function $$(e) {
/**************************************/
B220Util.hasClass = function hasClass(e, name) {
/* returns true if element "e" has class "name" in its class list */
var classes = e.className;
if (!e) {
return false;
} else if (classes == name) {
return true;
} else {
return (classes.search("\\b" + name + "\\b") >= 0);
}
return e.classList.contains(name);
};
/**************************************/
B220Util.addClass = function addClass(e, name) {
/* Adds a class "name" to the element "e"s class list */
if (!B220Util.hasClass(e, name)) {
e.className += (" " + name);
}
e.classList.add(name);
};
/**************************************/
B220Util.removeClass = function removeClass(e, name) {
/* Removes the class "name" from the element "e"s class list */
e.className = e.className.replace(new RegExp("\\b" + name + "\\b\\s*", "g"), "");
e.classList.remove(name);
};
/**************************************/