Cross-machine serial port connections are only half-working (need to defer initConnection() until all machines on the page have initialized their bus)

This commit is contained in:
Jeff Parsons 2016-08-18 11:30:22 -07:00
commit 0e4ad76b94
27 changed files with 1269 additions and 1191 deletions

View file

@ -35,9 +35,9 @@ if (NODE) {
var str = require("../../shared/lib/strlib");
var usr = require("../../shared/lib/usrlib");
var Component = require("../../shared/lib/component");
var State = require("../../shared/lib/state");
var Memory8080 = require("./memory");
var Messages8080= require("./messages");
var State8080 = require("./state");
}
/**

View file

@ -36,9 +36,9 @@ if (NODE) {
var usr = require("../../shared/lib/usrlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
var State = require("../../shared/lib/state");
var CPUDef8080 = require("./cpudef");
var Messages8080= require("./messages");
var State8080 = require("./state");
}
/**

View file

@ -38,13 +38,13 @@ if (NODE) {
var UserAPI = require("../../shared/lib/userapi");
var ReportAPI = require("../../shared/lib/reportapi");
var Component = require("../../shared/lib/component");
var State = require("../../shared/lib/state");
/*
* TODO: I'm confused why WebStorm complains if the following require() is missing in THIS file but not other files.
*/
var PC8080 = require("./defines");
var Bus8080 = require("./bus");
var Messages8080= require("./messages");
var State8080 = require("./state");
}
/**

View file

@ -35,11 +35,11 @@ if (NODE) {
var str = require("../../shared/lib/strlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
var State = require("../../shared/lib/state");
var CPUDef8080 = require("./cpudef");
var CPU8080 = require("./cpu");
var Messages8080= require("./messages");
var Memory8080 = require("./memory");
var State8080 = require("./state");
}
/**

View file

@ -37,12 +37,12 @@ if (DEBUGGER) {
var usr = require("../../shared/lib/usrlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
var State = require("../../shared/lib/state");
var CPUDef8080 = require("./cpudef");
var CPU8080 = require("./cpu");
var Keyboard8080= require("./keyboard");
var Messages8080= require("./messages");
var Memory8080 = require("./memory");
var State8080 = require("./state");
}
}

View file

@ -35,9 +35,9 @@ if (NODE) {
var str = require("../../shared/lib/strlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
var State = require("../../shared/lib/state");
var Memory8080 = require("./memory");
var ROM8080 = require("./rom");
var State8080 = require("./state");
}
/**

View file

@ -35,8 +35,8 @@ if (NODE) {
var str = require("../../shared/lib/strlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
var State = require("../../shared/lib/state");
var Messages8080= require("./messages");
var State8080 = require("./state");
}
/**
@ -404,8 +404,8 @@ SerialPort8080.prototype.initBus = function(cmp, bus, cpu, dbg)
/**
* initConnection()
*
* If a machine 'connection' parameter exists of the form "<sourcePort>=<targetMachine>.<targetPort>",
* and "<sourcePort>" matches our idComponent, then look for a component with id "<targetMachine>.<targetPort>".
* If a machine 'connection' parameter exists of the form "{sourcePort}->{targetMachine}.{targetPort}",
* and "{sourcePort}" matches our idComponent, then look for a component with id "{targetMachine}.{targetPort}".
*
* If the target component is found, then verify that it has exported functions with the following names:
*
@ -421,20 +421,22 @@ SerialPort8080.prototype.initConnection = function()
{
var sConnection = this.cmp.getMachineParm("connection");
if (sConnection) {
var asParts = sConnection.split('=');
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
var sTargetID = str.trim(asParts[1]);
if (sSourceID == this.idComponent) {
this.connection = Component.getComponentByID(sTargetID);
if (this.connection) {
var exports = this.connection['exports'];
if (exports) {
this.sendData = exports['receiveData'];
}
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);
return;
}
}
}
this.notice("Unable to establish connection: " + sConnection);
}
};

View file

@ -36,10 +36,10 @@ if (NODE) {
var web = require("../../shared/lib/weblib");
var DumpAPI = require("../../shared/lib/dumpapi");
var Component = require("../../shared/lib/component");
var State = require("../../shared/lib/state");
var ChipSet8080 = require("./chipset");
var Memory8080 = require("./memory");
var Messages8080= require("./messages");
var State8080 = require("./state");
}
/**