1
0
mirror of https://github.com/pkimpel/retro-220.git synced 2026-01-11 23:52:46 +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

@ -260,8 +260,6 @@ function B220Processor(config, devices) {
* Global Constants *
***********************************************************************/
B220Processor.version = "1.04";
B220Processor.tick = 1000/200000; // milliseconds per clock cycle (200KHz)
B220Processor.cyclesPerMilli = 1/B220Processor.tick;
// clock cycles per millisecond (200 => 200KHz)
@ -308,7 +306,7 @@ B220Processor.mask2 = [ // (2**n)-1 for n from 0 to 52
0x0FFFFFFFFFF, 0x1FFFFFFFFFF, 0x3FFFFFFFFFF, 0x7FFFFFFFFFF,
0x0FFFFFFFFFFF, 0x1FFFFFFFFFFF, 0x3FFFFFFFFFFF , 0x7FFFFFFFFFFF,
0x0FFFFFFFFFFFF, 0x1FFFFFFFFFFFF, 0x3FFFFFFFFFFFF, 0x7FFFFFFFFFFFF,
0x0FFFFFFFFFFFFF] ;
0x0FFFFFFFFFFFFF];
B220Processor.multiplyDigitCounts = [1, 14, 27, 40, 53, 66, 65, 52, 39, 26];
@ -808,7 +806,6 @@ B220Processor.Register.prototype.checkFC = function checkFC() {
this.p.setDigitCheck(1);
return 1;
}
};
/**************************************/
@ -1007,7 +1004,7 @@ B220Processor.Register.prototype.dec = function dec() {
***********************************************************************/
B220Processor.FlipFlop = function FlopFlop(p, invisible) {
/* Constructor for the generaic FlipFlop class. "p" is a reference to the
/* Constructor for the generic FlipFlop class. "p" is a reference to the
Processor object, used to access the timing members. "invisible" should be
true if the FF does not have a visible presence in the UI -- this will
inhibit computing the average lamp glow value for it.
@ -1017,9 +1014,9 @@ B220Processor.FlipFlop = function FlopFlop(p, invisible) {
that state */
this.visible = (invisible ? false : true);
this.lastExecClock = 0; // time register was last set
this.lastExecClock = 0; // time flip-flop was last set
this.p = p; // processor instance
this.value = 0; // binary value of register: read-only externally
this.value = 0; // binary value of flip-flop: read-only externally
this.glow = 0; // average lamp glow value
};
@ -2074,7 +2071,7 @@ B220Processor.prototype.floatingDivide = function floatingDivide() {
sign = 0;
this.A.set(am);
} else {
// Shift A+R 1 digit right (exponent adjustment occurs later
// Shift A+R 1 digit right (exponent adjustment occurs later)
ad = am%0x10;
am = (am-ad)/0x10;
rd = rm%0x10;

17
emulator/B220Version.js Normal file
View File

@ -0,0 +1,17 @@
/***********************************************************************
* retro-220/emulator B220Version.js
************************************************************************
* Copyright (c) 2022, Paul Kimpel.
* Licensed under the MIT License, see
* http://www.opensource.org/licenses/mit-license.php
************************************************************************
* Global emulator version.
************************************************************************
* 2022-06-30 P.Kimpel
* Original version.
***********************************************************************/
function B220Version() {
};
B220Version.version = "1.05";

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);