Dual (connected) terminal configs should be working better, now that both transmitted and received data is clocked according to their respective baud rates
This commit is contained in:
parent
140e1cf094
commit
9d289b54da
8 changed files with 218 additions and 209 deletions
|
|
@ -6,7 +6,7 @@ one of several JavaScript Machines in the [PCjs Project](https://github.com/jeff
|
|||
includes:
|
||||
|
||||
* [PCx86](/docs/pcx86/), an x86-based IBM PC and PC-compatible emulator
|
||||
* [PC8080](/modules/pc8080/), a 8080-based machine emulator (e.g., [Space Invaders](/devices/pc8080/machine/invaders/), [VT100](/devices/pc8080/machine/vt100/))
|
||||
* [PC8080](/modules/pc8080/), a 8080-based machine emulator (e.g., [Space Invaders](/devices/pc8080/machine/invaders/), [VT100 Terminal](/devices/pc8080/machine/vt100/))
|
||||
* [C1Pjs](/docs/c1pjs/), a 6502-based emulation of the Ohio Scientific [Challenger 1P](/devices/c1p/)
|
||||
|
||||
All PCjs computer simulations are written entirely in [JavaScript](/modules/). No Flash, Java or other plugins are
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Device Configurations
|
|||
All PCjs machines are built from the following sets of devices:
|
||||
|
||||
* [6502-based Devices](c1p/) (e.g., [Challenger 1P](c1p/machine/))
|
||||
* [8080-based Devices](pc8080/) (e.g., [Space Invaders](pc8080/machine/invaders/), [VT100](pc8080/machine/vt100/))
|
||||
* [8080-based Devices](pc8080/) (e.g., [Space Invaders](pc8080/machine/invaders/), [VT100 Terminal](pc8080/machine/vt100/))
|
||||
* [8086-based Devices](pcx86/) (e.g., [IBM PC and compatibles](pcx86/machine/))
|
||||
|
||||
These devices are user-installable components that you would typically find in a real personal computer,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ PC8080 Machine Configurations
|
|||
The following 8080-based machines are currently available:
|
||||
|
||||
* [8080 Exerciser](exerciser/)
|
||||
* [Space Invaders (1978)](invaders/) (with [Debugger](invaders/debugger/))
|
||||
* [DEC VT100 Terminal](vt100/) (with [Debugger](vt100/debugger/))
|
||||
* [Space Invaders (1978)](invaders/) ([Debugger](invaders/debugger/))
|
||||
* [DEC VT100 Terminal](vt100/) ([Debugger](vt100/debugger/))
|
||||
|
||||
Check out the [Dual VT100 Terminals](vt100/dual/) for a demo of two PCjs machines communicating over a *virtual* serial connection.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ machines:
|
|||
DEC VT100 Terminal
|
||||
------------------
|
||||
|
||||
This is a PCjs work-in-progress emulation of another 8080-based machine: the VT100 Terminal.
|
||||
This is a PCjs emulation of another 8080-based machine: the VT100 Terminal.
|
||||
|
||||
Unlike other VT100 emulators, it is not simply an emulation of VT100 protocols. It is a simulation of the original VT100
|
||||
machine, running the [VT100 Firmware](/devices/pc8080/rom/vt100/) inside the [PC8080](/modules/pc8080/) CPU emulator.
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ machines:
|
|||
type: pc8080
|
||||
debugger: true
|
||||
autoStart: true
|
||||
messages: serial|mem|port
|
||||
messages: mem|port
|
||||
config: /devices/pc8080/machine/vt100/debugger/machine.xml
|
||||
connection: serialPort=vt100b.serialPort
|
||||
- id: vt100b
|
||||
type: pc8080
|
||||
debugger: true
|
||||
autoStart: true
|
||||
messages: serial|mem|port
|
||||
messages: mem|port
|
||||
config: /devices/pc8080/machine/vt100/debugger/machine.xml
|
||||
connection: serialPort=vt100a.serialPort
|
||||
---
|
||||
|
|
@ -22,7 +22,7 @@ machines:
|
|||
Dual VT100 Terminals with Debuggers
|
||||
-----------------------------------
|
||||
|
||||
[Dual VT100 Terminals](../) with Debuggers attached.
|
||||
Here are [Dual VT100 Terminals](../) with the PCjs Debugger attached to each.
|
||||
|
||||
{% include machine.html id="vt100a" %}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,13 +118,14 @@ function SerialPort(parmsSerial) {
|
|||
/*
|
||||
* No connection until initBus() invokes initConnection().
|
||||
*/
|
||||
this.connection = this.sendByte = null;
|
||||
this.sDataReceived = "";
|
||||
this.connection = this.sendData = null;
|
||||
|
||||
/*
|
||||
* Export all functions required by initConnection(); currently, this is the bare minimum, with no flow control.
|
||||
*/
|
||||
this['exports'] = {
|
||||
'receiveByte': this.receiveByte
|
||||
'receiveData': this.receiveData
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -329,8 +330,7 @@ SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
*/
|
||||
sValue = sValue.replace(/\\n/g, "\n").replace(/\\r/g, "\r");
|
||||
control.onclick = function onClickTest(event) {
|
||||
serial.sDataReceived = sValue;
|
||||
serial.receiveData();
|
||||
serial.receiveData(sValue);
|
||||
/*
|
||||
* Give focus back to the machine (since clicking the button takes focus away).
|
||||
*/
|
||||
|
|
@ -362,11 +362,9 @@ SerialPort.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
|
||||
var serial = this;
|
||||
this.timerReceiveNext = this.cpu.addTimer(function() {
|
||||
serial.printMessage("timerReceiveNext()");
|
||||
serial.receiveData();
|
||||
});
|
||||
this.timerTransmitNext = this.cpu.addTimer(function() {
|
||||
serial.printMessage("timerTransmitNext()");
|
||||
serial.transmitData();
|
||||
});
|
||||
|
||||
|
|
@ -388,7 +386,7 @@ SerialPort.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
*
|
||||
* If the target component is found, then verify that it has exported functions with the following names:
|
||||
*
|
||||
* receiveByte(b): called by us when we have a byte to transmit; aliased internally to sendByte(b)
|
||||
* 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
|
||||
* performs its own initConnection(), it will find our receiveByte(b) function, at which point communication in both
|
||||
|
|
@ -409,7 +407,7 @@ SerialPort.prototype.initConnection = function()
|
|||
if (this.connection) {
|
||||
var exports = this.connection['exports'];
|
||||
if (exports) {
|
||||
this.sendByte = exports['receiveByte'];
|
||||
this.sendData = exports['receiveData'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -560,11 +558,10 @@ SerialPort.prototype.getBaudTimeout = function(maskRate)
|
|||
*/
|
||||
SerialPort.prototype.receiveByte = function(b)
|
||||
{
|
||||
this.printMessage("receiveByte(" + str.toHexByte(b) + "): " + str.toHexByte(this.bStatus));
|
||||
this.printMessage("receiveByte(" + str.toHexByte(b) + "), status=" + str.toHexByte(this.bStatus));
|
||||
if (!(this.bStatus & SerialPort.UART8251.STATUS.RECV_FULL)) {
|
||||
this.bDataIn = b;
|
||||
this.bStatus |= SerialPort.UART8251.STATUS.RECV_FULL;
|
||||
this.printMessage("receiveByte(" + str.toHexByte(b) + "): " + str.toHexByte(this.bStatus) + " (requesting interrupt)");
|
||||
this.cpu.requestINTR(this.nIRQ);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -572,17 +569,26 @@ SerialPort.prototype.receiveByte = function(b)
|
|||
};
|
||||
|
||||
/**
|
||||
* receiveData()
|
||||
* receiveData(data)
|
||||
*
|
||||
* Helper for clocking received data at the expected RECV_RATE.
|
||||
*
|
||||
* Currently, this is only use for test data that we "cram" down the terminal's throat, ensuring that we don't
|
||||
* cram it too rapidly.
|
||||
* When we're cramming test data down the terminal's throat, that data will typically be in the form
|
||||
* of a string. When we're called by another component, data will typically be a number (ie, byte). If no
|
||||
* data is specified at all, then all we do is "clock" any remaining data into the receiver.
|
||||
*
|
||||
* @this {SerialPort}
|
||||
* @param {number|string|undefined} [data]
|
||||
*/
|
||||
SerialPort.prototype.receiveData = function()
|
||||
SerialPort.prototype.receiveData = function(data)
|
||||
{
|
||||
if (data != null) {
|
||||
if (typeof data != "number") {
|
||||
this.sDataReceived = data;
|
||||
} else {
|
||||
this.sDataReceived += String.fromCharCode(data);
|
||||
}
|
||||
}
|
||||
if (this.sDataReceived) {
|
||||
if (this.receiveByte(this.sDataReceived.charCodeAt(0))) {
|
||||
this.sDataReceived = this.sDataReceived.substr(1);
|
||||
|
|
@ -604,8 +610,10 @@ SerialPort.prototype.transmitByte = function(b)
|
|||
{
|
||||
var fTransmitted = false;
|
||||
|
||||
if (this.sendByte) {
|
||||
if (this.sendByte.call(this.connection, b)) {
|
||||
this.printMessage("transmitByte(" + str.toHexByte(b) + ")");
|
||||
|
||||
if (this.sendData) {
|
||||
if (this.sendData.call(this.connection, b)) {
|
||||
fTransmitted = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
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