### Serial (RS-232) Ports

trs80gp can map serial ports to TCP/IP connections or emulate 2 and 3 button serial mice. To have a serial port connect to a TCP/IP server use `-r host:port` or open Serial → Port A, fill in the hostname and port and choose "TCP/IP Connect". Or the serial port can listen on a TCP/IP port with `-r @port` or use "TCP/IP Listen" in the serial port dialog box. Most machines have a single serial port, the Model 2 line has two ports accessible on the command line with `-rA` and `-rB`.

trs80gp instances can now be "wired" together through serial ports. The ultimate setup is one trs80gp running Model 16 Xenix with two trs80gp's attached running DT-1 terminals. But here's a simple example of hooking two DT-1 terminal emulations together.

         trs80gp -mdt1 -r :4000
         trs80gp -mdt1 -r @4000

Characters typed on one of the DT-1's will appear on the second one. Assuming everything is working. If it does not work check the "Status" indicator of each serial port. Both sides should note they are "connected". But the "@" side may only show "Listening..." or the other side "Connecting..." both indicating no connection has been made. Or "-unbound-" if there has been some error.

To break a connection unselect the "Enable" checkbox in the dialog box. The other side may not see the loss of connection so you may need to manually manage "unplugging" on both sides. trs80gp is not quite ready to be an internet "dial-up" BBS.

The status will also show the current transmission settings of the serial port. Baud rate, bits per word, parity and number of stop bits. These do not affect TCP/IP connections but the emulation will limit transmit and receive speeds based on port setup. Most original TRS-80 hardware could be set up to have different transmit and receive speeds. That unlikely configuration will be hidden from view. In the Model 2 line the higher baud rate settings are not exact. trs80gp will display the exact baud rate (feature or bug? You tell me).

As a convenience trs80gp can launch DT-1 and Videotex terminals directly from the command line or in the serial port connection dialog. For example, you might launch a two terminal Xenix system with:

         trs80gp -m6000 -h xenix33.cfg -rA :dt1 -rB :dt1

Or you can choose the desired terminal from the dropdown in the serial port connection dialog and then click the "Enabled" checkbox to launch it. Either way, these terminals will act as a unit with the main trs80gp emulator. If you exit the main emulator the terminals will also be forced to exit.

On Linux and Mac a serial port can be hooked up to a hardware serial port by specifying the device name. trs80gp cannot do this on Windows as yet. In most cases:

        trs80gp -r /dev/ttyUSB0

will hook the serial port up to the first USB to serial port converter on the hoat machine. When the emulated machine changes the baud rate or other communication parameters of the emulated serial port they will be propagated to the real serial port.

Serial port devices cannot be opened by most ordinary (non-root) users by default in linux. There are various ways around this problem but one way is to add yourself to the `dialout` group with:

        sudo usermod -a -G dialout $USER

#### Model 1 RS-232 Sense Switches

The Model 1 RS-232 board had 8 DIP switches the manual refers to as "sense switches". These do not directly control the hardware but serve as a way to set communication defaults like the baud rate. Model I programs have the option of reading them to set defaults. On the Model 1 the Serial menu has extra entries to control each switch individually and some convenience menus to set the baud rate directly. The sense switch settings are saved automatically and will appear the same the next time trs80gp is run again in Model 1 mode.