1
0
mirror of https://github.com/pkimpel/retro-220.git synced 2026-02-04 23:44:55 +00:00

Implement cursor for Teletype output.

Also:
. Implement separate B220Version module.
. Correct 220 internal code to ANSI translate table in
B220ControlConsole.js.
. Correct minor typos in comments.
This commit is contained in:
Paul Kimpel
2022-06-30 12:19:06 -07:00
parent bca1b7881a
commit cc8fd9123b
6 changed files with 36 additions and 18 deletions

View File

@@ -30,6 +30,7 @@
<script src="./B220SetCallback.js"></script>
<script src="./B220SystemConfig.js"></script>
<script src="../emulator/B220Version.js"></script>
<script src="../emulator/B220Processor.js"></script>
<script src="./B220CardatronInput.js"></script>

View File

@@ -137,7 +137,7 @@ window.addEventListener("load", function() {
/***** window.onload() outer block *****/
document.getElementById("StartUpBtn").disabled = true;
document.getElementById("EmulatorVersion").textContent = B220Processor.version;
document.getElementById("EmulatorVersion").textContent = B220Version.version;
if (checkBrowser()) {
document.getElementById("Retro220Logo").addEventListener("dblclick", openDiagPanel, false);
document.getElementById("StartUpBtn").disabled = false;

View File

@@ -66,6 +66,7 @@ B220ConsolePrinter.whippetSpeed = 1000; // Whippet printer speed, char/sec
B220ConsolePrinter.whippetNewLine = 75; // Whippet carriage-return delay, ms
B220ConsolePrinter.formFeedPeriod = 500;// full-page form-feed delay, ms
B220ConsolePrinter.cursorChar = "_"; // end-of-line cursor
B220ConsolePrinter.pageSize = 66; // lines/page for form-feed
B220ConsolePrinter.maxScrollLines = 15000;
// Maximum amount of paper scrollback
@@ -134,15 +135,16 @@ B220ConsolePrinter.prototype.printNewLine = function printNewLine(text) {
/* Removes excess lines already output, then appends a newline to the
current text node, and then a new text node to the end of the <pre> element
within the paper element. Note that "text" is an ANSI string */
var paper = this.paper;
var paper = this.paper;
var lastLine = paper.lastChild.nodeValue;
var line = text || "";
while (paper.childNodes.length > B220ConsolePrinter.maxScrollLines) {
paper.removeChild(paper.firstChild);
}
paper.lastChild.nodeValue += "\n"; // newline
paper.appendChild(this.doc.createTextNode(line));
paper.lastChild.nodeValue = lastLine.substring(0, lastLine.length-1) + "\n";
paper.appendChild(this.doc.createTextNode(line + B220ConsolePrinter.cursorChar));
++this.printerLine;
this.printerCol = line.length;
this.printerEOP.scrollIntoView();
@@ -159,10 +161,11 @@ B220ConsolePrinter.prototype.printChar = function printChar(code) {
line = this.paper.lastChild.nodeValue;
len = line.length;
if (len < 1) { // first char on line
this.paper.lastChild.nodeValue = c;
this.paper.lastChild.nodeValue = c + B220ConsolePrinter.cursorChar;
this.printerCol = 1;
} else if (len < this.columns) {// normal char
this.paper.lastChild.nodeValue = line + c;
this.paper.lastChild.nodeValue =
line.substring(0, len-1) + c + B220ConsolePrinter.cursorChar;
++this.printerCol;
} else { // right margin overflow
this.printNewLine(c);

View File

@@ -112,9 +112,9 @@ B220ControlConsole.onOrganSwitchImage = "./resources/Organ-Switch-Down.png"
B220ControlConsole.codeXlate = [ // translate internal 220 code to ANSI
// 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
" ", "?", "_", ".", "\u00A4", "?", "?", "?", "?", "?", "!", "!", "!", "!", "!", "!", // 00-0F
"&", "?", "?", "$", "*", "^", "|", "?", "?", "?", "!", "!", "!", "!", "!", "!", // 10-1F
"-", "/", "?", ",", "%", "?", "~", "?", "?", "?", "!", "!", "!", "!", "!", "!", // 20-2F
"?", "?", "?", "#", "@", "\\", "?", "?", "?", "?", "!", "!", "!", "!", "!", "!", // 30-3F
"&", "?", "]", "$", "*", "^", "|", "?", "?", "?", "!", "!", "!", "!", "!", "!", // 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
@@ -1034,7 +1034,7 @@ B220ControlConsole.prototype.consoleOnLoad = function consoleOnLoad(ev) {
this.window.addEventListener("beforeunload", B220ControlConsole.prototype.beforeUnload);
this.$$("EmulatorVersion").textContent = B220Processor.version;
this.$$("EmulatorVersion").textContent = B220Version.version;
this.window.moveTo(screen.availWidth - this.window.outerWidth, 0);