Merge branch 'next-release'
This commit is contained in:
commit
e58e57bd75
11 changed files with 965 additions and 946 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -133,9 +133,10 @@ function SerialPort8080(parmsSerial) {
|
||||||
this.connection = this.sendData = null;
|
this.connection = this.sendData = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Export all functions required by initConnection(); currently, this is the bare minimum, with no flow control.
|
* Export all functions required by initConnection(); currently, this is the bare minimum (no flow control yet).
|
||||||
*/
|
*/
|
||||||
this['exports'] = {
|
this['exports'] = {
|
||||||
|
'connect': this.initConnection,
|
||||||
'receiveData': this.receiveData
|
'receiveData': this.receiveData
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -421,31 +422,44 @@ SerialPort8080.prototype.initBus = function(cmp, bus, cpu, dbg)
|
||||||
* receiveData(data): called when we have data to transmit; aliased internally to sendData(data)
|
* receiveData(data): called when we have data to transmit; aliased internally to sendData(data)
|
||||||
*
|
*
|
||||||
* For now, we're not going to worry about communication in the other direction, because when the target component
|
* For now, we're not going to worry about communication in the other direction, because when the target component
|
||||||
* performs its own initConnection(), it will find our receiveByte(b) function, at which point communication in both
|
* performs its own initConnection(), it will find our receiveData() function, at which point communication in both
|
||||||
* directions should be established.
|
* directions should be established.
|
||||||
*
|
*
|
||||||
|
* For added robustness, if the target machine initializes much more slowly than we do, and our connection attempt
|
||||||
|
* fails, that's OK, because when it finally initializes, its initConnection() will call our initConnection();
|
||||||
|
* if we've already initialized, no harm done.
|
||||||
|
*
|
||||||
* @this {SerialPort8080}
|
* @this {SerialPort8080}
|
||||||
*/
|
*/
|
||||||
SerialPort8080.prototype.initConnection = function()
|
SerialPort8080.prototype.initConnection = function()
|
||||||
{
|
{
|
||||||
var sConnection = this.cmp.getMachineParm("connection");
|
if (!this.connection) {
|
||||||
if (sConnection) {
|
var sConnection = this.cmp.getMachineParm("connection");
|
||||||
var asParts = sConnection.split('->');
|
if (sConnection) {
|
||||||
if (asParts.length == 2) {
|
var asParts = sConnection.split('->');
|
||||||
var sSourceID = str.trim(asParts[0]);
|
if (asParts.length == 2) {
|
||||||
if (sSourceID != this.idComponent) return; // this connection string is intended for another instance
|
var sSourceID = str.trim(asParts[0]);
|
||||||
var sTargetID = str.trim(asParts[1]);
|
if (sSourceID != this.idComponent) return; // this connection string is intended for another instance
|
||||||
this.connection = Component.getComponentByID(sTargetID);
|
var sTargetID = str.trim(asParts[1]);
|
||||||
if (this.connection) {
|
this.connection = Component.getComponentByID(sTargetID);
|
||||||
var exports = this.connection['exports'];
|
if (this.connection) {
|
||||||
if (exports) {
|
var exports = this.connection['exports'];
|
||||||
this.sendData = exports['receiveData'];
|
if (exports) {
|
||||||
this.status(this.idMachine + '.' + sSourceID + " connected to " + sTargetID);
|
var fnConnect = exports['connect'];
|
||||||
return;
|
if (fnConnect) fnConnect.call(this.connection);
|
||||||
|
this.sendData = exports['receiveData'];
|
||||||
|
if (this.sendData) {
|
||||||
|
this.status(this.idMachine + '.' + sSourceID + " connected to " + sTargetID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Changed from notice() to status() because sometimes a connection fails simply because one of us is a laggard.
|
||||||
|
*/
|
||||||
|
this.status("Unable to establish connection: " + sConnection);
|
||||||
}
|
}
|
||||||
this.notice("Unable to establish connection: " + sConnection);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -462,11 +476,10 @@ SerialPort8080.prototype.powerUp = function(data, fRepower)
|
||||||
if (!fRepower) {
|
if (!fRepower) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We needed to wait until now to make our first inter-machine connection attempt;
|
* This is as late as we can currently wait to make our first inter-machine connection attempt;
|
||||||
* doing this in initBus() was still too early, because initBus() is called in the context
|
* even so, the target machine's initialization process may still be ongoing, so any connection
|
||||||
* of onInit() processing for all machines of the same type (eg, PCx86), and if we're
|
* may be not fully resolved until the target machine performs its own initConnection(), which will
|
||||||
* trying to connect to the port of a machine of a DIFFERENT type (eg, PC8080), it may not
|
* in turn invoke our initConnection() again.
|
||||||
* have been initialized yet.
|
|
||||||
*/
|
*/
|
||||||
this.initConnection();
|
this.initConnection();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,9 +143,10 @@ function SerialPort(parmsSerial) {
|
||||||
this.connection = this.sendData = null;
|
this.connection = this.sendData = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Export all functions required by initConnection(); currently, this is the bare minimum, with no flow control.
|
* Export all functions required by initConnection(); currently, this is the bare minimum (no flow control yet).
|
||||||
*/
|
*/
|
||||||
this['exports'] = {
|
this['exports'] = {
|
||||||
|
'connect': this.initConnection,
|
||||||
'receiveData': this.receiveData
|
'receiveData': this.receiveData
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -482,31 +483,44 @@ SerialPort.prototype.initBus = function(cmp, bus, cpu, dbg)
|
||||||
* receiveData(data): called when we have data to transmit; aliased internally to sendData(data)
|
* receiveData(data): called when we have data to transmit; aliased internally to sendData(data)
|
||||||
*
|
*
|
||||||
* For now, we're not going to worry about communication in the other direction, because when the target component
|
* For now, we're not going to worry about communication in the other direction, because when the target component
|
||||||
* performs its own initConnection(), it will find our receiveByte(b) function, at which point communication in both
|
* performs its own initConnection(), it will find our receiveData() function, at which point communication in both
|
||||||
* directions should be established.
|
* directions should be established.
|
||||||
*
|
*
|
||||||
|
* For added robustness, if the target machine initializes much more slowly than we do, and our connection attempt
|
||||||
|
* fails, that's OK, because when it finally initializes, its initConnection() will call our initConnection();
|
||||||
|
* if we've already initialized, no harm done.
|
||||||
|
*
|
||||||
* @this {SerialPort}
|
* @this {SerialPort}
|
||||||
*/
|
*/
|
||||||
SerialPort.prototype.initConnection = function()
|
SerialPort.prototype.initConnection = function()
|
||||||
{
|
{
|
||||||
var sConnection = this.cmp.getMachineParm("connection");
|
if (!this.connection) {
|
||||||
if (sConnection) {
|
var sConnection = this.cmp.getMachineParm("connection");
|
||||||
var asParts = sConnection.split('->');
|
if (sConnection) {
|
||||||
if (asParts.length == 2) {
|
var asParts = sConnection.split('->');
|
||||||
var sSourceID = str.trim(asParts[0]);
|
if (asParts.length == 2) {
|
||||||
if (sSourceID != this.idComponent) return; // this connection string is intended for another instance
|
var sSourceID = str.trim(asParts[0]);
|
||||||
var sTargetID = str.trim(asParts[1]);
|
if (sSourceID != this.idComponent) return; // this connection string is intended for another instance
|
||||||
this.connection = Component.getComponentByID(sTargetID);
|
var sTargetID = str.trim(asParts[1]);
|
||||||
if (this.connection) {
|
this.connection = Component.getComponentByID(sTargetID);
|
||||||
var exports = this.connection['exports'];
|
if (this.connection) {
|
||||||
if (exports) {
|
var exports = this.connection['exports'];
|
||||||
this.sendData = exports['receiveData'];
|
if (exports) {
|
||||||
this.status(this.idMachine + '.' + sSourceID + " connected to " + sTargetID);
|
var fnConnect = exports['connect'];
|
||||||
return;
|
if (fnConnect) fnConnect.call(this.connection);
|
||||||
|
this.sendData = exports['receiveData'];
|
||||||
|
if (this.sendData) {
|
||||||
|
this.status(this.idMachine + '.' + sSourceID + " connected to " + sTargetID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Changed from notice() to status() because sometimes a connection fails simply because one of us is a laggard.
|
||||||
|
*/
|
||||||
|
this.status("Unable to establish connection: " + sConnection);
|
||||||
}
|
}
|
||||||
this.notice("Unable to establish connection: " + sConnection);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -523,11 +537,10 @@ SerialPort.prototype.powerUp = function(data, fRepower)
|
||||||
if (!fRepower) {
|
if (!fRepower) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We needed to wait until now to make our first inter-machine connection attempt;
|
* This is as late as we can currently wait to make our first inter-machine connection attempt;
|
||||||
* doing this in initBus() was still too early, because initBus() is called in the context
|
* even so, the target machine's initialization process may still be ongoing, so any connection
|
||||||
* of onInit() processing for all machines of the same type (eg, PCx86), and if we're
|
* may be not fully resolved until the target machine performs its own initConnection(), which will
|
||||||
* trying to connect to the port of a machine of a DIFFERENT type (eg, PC8080), it may not
|
* in turn invoke our initConnection() again.
|
||||||
* have been initialized yet.
|
|
||||||
*/
|
*/
|
||||||
this.initConnection();
|
this.initConnection();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -226,17 +226,9 @@ Component.subclass = function(subclass, superclass, methods, statics)
|
||||||
* various resources used by that machine.
|
* various resources used by that machine.
|
||||||
*/
|
*/
|
||||||
if (window) {
|
if (window) {
|
||||||
if (!window['PCjs']) {
|
if (!window['PCjs']) window['PCjs'] = {};
|
||||||
window['PCjs'] = {
|
Component.machines = window['PCjs']['Machines'] || (window['PCjs']['Machines'] = {});
|
||||||
'Machines': {},
|
Component.components = window['PCjs']['Components'] || (window['PCjs']['Components'] = []);
|
||||||
'Components': []
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Alias the new global objects above to their original property names, to minimize code changes.
|
|
||||||
*/
|
|
||||||
Component.machines = window['PCjs']['Machines'];
|
|
||||||
Component.components = window['PCjs']['Components'];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue