MediaWiki:Sitenotice:
2024-03-02: The wiki ran out of disk space, so things were not working. This has been resolved by adding another 5GB of quota ;-) Thanks to Tim Lindner for reporting the issues. 2020-05-17: If a page gives you an error about some revision not being found, just EDIT the page and the old page should appear in the editor. If it does, just SAVE that and the page should be restored. OS-9 Al (talk) 12:22, 17 May 2020 (CDT)

Terminal over Serial

From CoCopedia - The Tandy/Radio Shack Color Computer Wiki
Jump to navigation Jump to search

Using a CoCo as a terminal

The Color Computer can act as a terminal device either out through the bitbanger serial port or using add-on hardware such as the Deluxe RS232 Pak. In the early days, it was common to connect via a modem to communicate with remote systems, but nowadays its more common to use a null modem cable to connect to a nearby modern PC.

One will need to use terminal software. There are a variety:

DECB / RSDOS

* These packages support the RS-232 pak
** This package expects the 6551 ACIA chip to be at $FF6C instead of the standard RS-232 Pak IO base of $FF68

OS9

  • KBCom
  • SuperComm
  • xcom9
  • osterm
  • Others (search the Archive for 'comm' and 'term')

Connecting to a Linux shell over null modem

Once one has their terminal software on the CoCo working, one will need to configure agetty to listen on the Linux machine to provide a login prompt and start a shell. One can test this with:

   sudo setsid getty ttyUSB0

This will provide only a single session but is good for testing. Make sure to included setsid otherwise certain ioctl() calls won't work. Once working, configure your system to run getty through initd or the system daemon. This will vary by distribution but most modern distributions will normally support something like:

   systemctl enable serial-getty@ttyUSB0.service

followed by

   systemctl start serial-getty@ttyUSB0.service

Modify ttyUSB0 in the above examples to the appropriate device for the system, such as ttyS0 or ttyUSB1.

If using a USB connection one may instead get creative with a /etc/udev/rule.d to spawn a prompt only when connected.

TERM setting in Linux

The TERM setting instructs programs within Linux on how to have the terminal reposition the cursor or clear the screen. The settings are controlled through the termcap and terminfo databases. Very often, applications use the terminfo or ncurses library to abstract away the hard work of parsing the databases and performing the screen manipulation.

Linux will generally default to a vt100 or similar terminal type for a serial connection. Depending upon the terminal software used, this should be modified to something more appropriate:

  • dumb will work with most coco terminal software, but will not allow any manipulation of cursor positioning or screen clearing, meaning software that uses the ncurses library will not work, like vi, nano, top, etc. Technically, dumb expects an 80 column display, so even this mode may give some trouble for some terminal software.
  • pcansi will (mostly) work for Twilight terminal and other packages that sought compatibility with 90s era PC BBSs.
  • coco3 will work for many OS9-based communication packages. This termcap entry uses control codes described on page 689 of the OS-9 L2 Manual

One can adjust the terminal once in the shell with:

   export TERM=pcansi

Advanced termcap/terminfo

If one of the default termcap entries aren't working for one's chosen terminal software, one will need to find the control codes for their terminal software of choice and build an appropriate entry. This may require looking through the terminal software's documentation or contacting the creator. Use 'infocmp' to dump an existing termcap file and 'tic' to compile a new one. 'man terminfo' to get a list of the fields and their syntax.

Many early terminal software packages implement a subset of the vt52 terminal:

  • Videotex had many control codes available; see page 7 of the Videotex manual. The Direct Connect Modem Pak ROM seems to be compatible with these codes as well.
  • Similarly, Vidtex (Compuserv's software) also had many control codes available; see page 44/Chapter 7 of the Vidtex manual

For these, create a file like this, named videotex.ti:

       videotex|TRS-80 Videotex terminal program,
       am,
       cols#32, lines#16,
       bel=^G, clear=\EH\Ej, cub1=\ED, cud1=\EB, cuf1=\EC,
       cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, ed=\EJ, el=\EK,
       home=\EH, kbs=^H, kcuu1=\^,

Then compile this by running

   tic videotex.ti

This will create a new file in ~/.terminfo/v/videotext. To use this entry, use

   export TERM=videotex

The Deluxe RS232 Pak ROM doesn't handle vt52-style control codes (locking up if it receives one!), so the following terminfo works ok. Make a new file named deluxers232.ti:

       deluxers232|TRS-80 Color Computer Deluxe RS232 Pak,
       am,
       cols#32, lines#16,
       bel=^G, cr=\r, cud1=\n, ind=\n,
       kbs=^H, clear=^L, kcuu1=\032, cub1=^H,

Then run

   tic deluxers232.ti

to create ~/.terminfo/d/deluxers232 and use it by entering

   export TERM=deluxers232

This won't allow for any ncurses-based applications, but will at least have some idea of the screen size and allow for backspace.

File transfers in Linux

One logged into a Linux shell, one may want to transfer files. Many terminal software packages support the XModem protocol. Use the 'rx' and 'sx' commands in the Linux CLI to transfer files via XModem.

Using a terminal (or terminal emulator software) to connect to an OS9 or NitrOS9 shell on a CoCo

Standard serial devices are:

  • /T1 the bitbanger port
  • /T2 An RS-232 Pak in the first MPI slot
  • /T3 An RS-232 Pak in the another MPI slot
  • /M1 A direct connect modem pak (or another RS232 pack modified for base IO address $FF6C) in the first MPI slot
  • /M2 A direct connect modem pak (or another RS232 pack modified for base IO address $FF6C) in another MPI slot

Depending upon the OS9/NOS9 build, this may involve loading additional modules (such as scf/sc6551.dr and scf/t2_sc6551.dd).

Configure the serial device on OS9 or NitrOS9 using the 'tuneport' and/or 'xmode' commands. One will need to match the baud rate on both sides of the connection.

Once the port is configured, start a shell on the OS9 side with:

   shell i=/T2&

Replace /T2 with whatever is appropriate for the system's configuration. This will start a shell one can access from a PC's terminal software, such as Teraterm on Windows or Miniterm/Minicom/screen on Linux.