A (PC8080) VT100 can now connect to a (PCx86) IBM PC AT; only problem seems to be flow control now.

Also, each PCjs debugger can now be independently accessed from an external debugger (eg, "pcx86('ver')" or "pc8080('ver')"); the global '$' symbol is no longer used for debugger access.
TODO: There are still many places where GLOBALVAR should be replaced with PCX86.GLOBALVAR or PC8080.GLOBALVAR as appropriate (which I've finally started doing in each debugger.js file).
This commit is contained in:
Jeff Parsons 2016-08-18 16:46:34 -07:00
commit 5ed8f13840
45 changed files with 10989 additions and 1417 deletions

View file

@ -97,7 +97,16 @@ function SerialPort(parmsSerial) {
this.consoleOutput = null;
/**
* controlIOBuffer is a DOM element, if any, bound to the port (currently used for output only; see echoByte()).
* controlIOBuffer is a DOM element bound to the port (currently used for output only; see transmitByte()).
*
* Example: CTTY COM2
*
* The CTTY DOS command redirects all CON I/O to the specified serial port (eg, COM2), which it assumes is
* connected to a serial terminal, and therefore anything it *transmits* via COM2 will be displayed by the
* terminal. It further assumes that anything typed on such a terminal is NOT displayed, so as DOS *receives*
* serial input, DOS *transmits* the appropriate characters back to the terminal via COM2.
*
* As a result, controlIOBuffer only needs to be updated by the transmitByte() function.
*
* @type {Object}
*/
@ -105,7 +114,7 @@ function SerialPort(parmsSerial) {
/*
* If controlIOBuffer is being used AND 'tabSize' is set, then we make an attempt to monitor the characters
* being echoed via echoByte(), maintain a logical column position, and convert any tabs into the appropriate
* being echoed via transmitByte(), maintain a logical column position, and convert any tabs into the appropriate
* number of spaces.
*
* charBOL, if nonzero, is a character to automatically output at the beginning of every line. This probably
@ -128,7 +137,7 @@ function SerialPort(parmsSerial) {
}
/*
* No connection until initBus() invokes initConnection().
* No connection until initConnection() is called.
*/
this.sDataReceived = "";
this.connection = this.sendData = null;
@ -146,7 +155,7 @@ function SerialPort(parmsSerial) {
* property {number} iAdapter
* property {number} portBase
* property {number} nIRQ
* property {Object} controlIOBuffer is a DOM element, if any, bound to the port (for rudimentary output; see echoByte())
* property {Object} controlIOBuffer is a DOM element bound to the port (for rudimentary output; see transmitByte())
*
* NOTE: This class declaration started as a way of informing the code inspector of the controlIOBuffer property,
* which remained undefined until a setBinding() call set it later, but I've since decided that explicitly
@ -459,8 +468,6 @@ SerialPort.prototype.initBus = function(cmp, bus, cpu, dbg)
bus.addPortInputTable(this, SerialPort.aPortInput, this.portBase);
bus.addPortOutputTable(this, SerialPort.aPortOutput, this.portBase);
this.initConnection();
this.setReady();
};
@ -487,14 +494,14 @@ SerialPort.prototype.initConnection = function()
var asParts = sConnection.split('->');
if (asParts.length == 2) {
var sSourceID = str.trim(asParts[0]);
if (sSourceID != this.idComponent) return; // this connection string is meant for another instance
if (sSourceID != this.idComponent) return; // this connection string is intended for another instance
var sTargetID = str.trim(asParts[1]);
this.connection = Component.getComponentByID(sTargetID);
if (this.connection) {
var exports = this.connection['exports'];
if (exports) {
this.sendData = exports['receiveData'];
this.printMessage(this.idMachine + '.' + sSourceID + " connected to " + sTargetID, true);
this.status(this.idMachine + '.' + sSourceID + " connected to " + sTargetID);
return;
}
}
@ -514,6 +521,16 @@ SerialPort.prototype.initConnection = function()
SerialPort.prototype.powerUp = function(data, fRepower)
{
if (!fRepower) {
/*
* We needed to wait until now to make our first inter-machine connection attempt;
* doing this in initBus() was still too early, because initBus() is called in the context
* of onInit() processing for all machines of the same type (eg, PCx86), and if we're
* trying to connect to the port of a machine of a DIFFERENT type (eg, PC8080), it may not
* have been initialized yet.
*/
this.initConnection();
if (!data || !this.restore) {
this.reset();
} else {
@ -803,7 +820,7 @@ SerialPort.prototype.outTHR = function(port, bOut, addrFrom)
} else {
this.bTHR = bOut;
this.bLSR &= ~(SerialPort.LSR.THRE | SerialPort.LSR.TSRE);
if (this.echoByte(bOut)) {
if (this.transmitByte(bOut)) {
this.bLSR |= (SerialPort.LSR.THRE | SerialPort.LSR.TSRE);
/*
* QUESTION: Does this mean we should also flush/zero bTHR?
@ -888,14 +905,24 @@ SerialPort.prototype.updateIRR = function()
};
/**
* echoByte(b)
* transmitByte(b)
*
* @this {SerialPort}
* @param {number} b
* @return {boolean} true if echoed, false if not
* @return {boolean} true if transmitted, false if not
*/
SerialPort.prototype.echoByte = function(b)
SerialPort.prototype.transmitByte = function(b)
{
var fTransmitted = false;
this.printMessage("transmitByte(" + str.toHexByte(b) + ")");
if (this.sendData) {
if (this.sendData.call(this.connection, b)) {
fTransmitted = true;
}
}
if (this.controlIOBuffer) {
if (b == 0x0D) {
this.iLogicalCol = 0;
@ -908,8 +935,9 @@ SerialPort.prototype.echoByte = function(b)
if (this.iLogicalCol > 0) this.iLogicalCol--;
}
else {
var s = String.fromCharCode(b);
var nChars = (b >= 0x20? 1 : 0);
var s = str.toASCIICode(b); // formerly: String.fromCharCode(b);
var nChars = s.length; // formerly: (b >= 0x20? 1 : 0);
if (b < 0x20 && nChars == 1) nChars = 0;
if (b == 0x09) {
var tabSize = this.tabSize || 8;
nChars = tabSize - (this.iLogicalCol % tabSize);
@ -920,9 +948,9 @@ SerialPort.prototype.echoByte = function(b)
this.controlIOBuffer.scrollTop = this.controlIOBuffer.scrollHeight;
this.iLogicalCol += nChars;
}
return true;
fTransmitted = true;
}
if (this.consoleOutput != null) {
else if (this.consoleOutput != null) {
if (b == 0x0A || this.consoleOutput.length >= 1024) {
this.println(this.consoleOutput);
this.consoleOutput = "";
@ -930,9 +958,10 @@ SerialPort.prototype.echoByte = function(b)
if (b != 0x0A) {
this.consoleOutput += String.fromCharCode(b);
}
return true;
fTransmitted = true;
}
return false;
return fTransmitted;
};
/*