Support for VT100 dot stretching

This commit is contained in:
Jeff Parsons 2016-08-08 11:19:06 -07:00
commit f7464dd182
7 changed files with 4890 additions and 4701 deletions

View file

@ -102,8 +102,7 @@ Keyboard.ASCII = {
* keyCodes for most common ASCII keys can simply use the appropriate ASCII code above.
*
* Most of these represent non-ASCII keys (eg, the LEFT arrow key), yet for some reason, browsers defined
* them using ASCII codes (eg, the LEFT arrow key uses the ASCII code for '%' or 37). This conflict is
* discussed further in the definition of CLICKCODE below.
* them using ASCII codes (eg, the LEFT arrow key uses the ASCII code for '%' or 37).
*
* @enum {number}
*/
@ -286,7 +285,18 @@ Keyboard.VT100 = {
LED1: 0x08,
LOCKED: 0x10,
ONLINE: 0x20,
LEDS: 0x3F, // all LEDs
START: 0x40, // set to initiate a scan
/*
* From p. 4-38 of the VT100 Technical Manual (July 1982):
*
* A bit (CLICK) in the keyboard status word controls the bell.... When a single status word contains
* the bell bit, flip-flop E3 toggles and turns on E1, generating a click. If the bell bit is set for
* many words in succession, the UART latch holds the data output constant..., allowing the circuit to
* produce an 800 hertz tone. Bell is generated by setting the bell bit for 0.25 seconds. Each cycle of
* the tone is at a reduced amplitude compared with the single keyclick.... The overall effect of the
* tone burst on the ear is that of a beep.
*/
CLICK: 0x80,
INIT: 0x00
}
@ -573,7 +583,7 @@ Keyboard.prototype.save = function()
case Keyboard.SI1978.MODEL:
break;
case Keyboard.VT100.MODEL:
state.set(0, [this.bLEDs]);
state.set(0, [this.bVT100Status]);
break;
}
return state.data();
@ -597,8 +607,8 @@ Keyboard.prototype.restore = function(data)
return true;
case Keyboard.VT100.MODEL:
this.bLEDs = a[0];
this.updateLEDs();
this.bVT100Status = a[0];
this.updateLEDs(this.bVT100Status & Keyboard.VT100.STATUS.LEDS);
return true;
}
}
@ -621,20 +631,22 @@ Keyboard.prototype.setLED = function(control, f)
};
/**
* updateLEDs()
* updateLEDs(bLEDs)
*
* @this {Keyboard}
* @param {number} bLEDs
*/
Keyboard.prototype.updateLEDs = function()
Keyboard.prototype.updateLEDs = function(bLEDs)
{
this.bLEDs = bLEDs;
for (var sBinding in this.config.LEDCODES) {
var id = "led-" + sBinding;
var control = this.bindings[id];
if (control) {
var bitLED = this.config.LEDCODES[sBinding];
var fOn = !!(this.bLEDs & bitLED);
var fOn = !!(bLEDs & bitLED);
if (bitLED & (bitLED-1)) {
fOn = !(this.bLEDs & ~bitLED);
fOn = !(bLEDs & ~bitLED);
}
this.setLED(control, fOn);
}
@ -783,8 +795,13 @@ Keyboard.prototype.checkSoftKeysToRelease = function()
Keyboard.prototype.outVT100UARTStatus = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "KBDUART.STATUS", null, true);
this.bLEDs = b;
this.updateLEDs();
this.bVT100Status = b;
this.updateLEDs(b & Keyboard.VT100.STATUS.LEDS);
/*
if (b & Keyboard.VT100.STATUS.START) {
console.log("keyboard scan initiated");
}
*/
};
/*