Color Computer, Serial and MAME walk into a Bar…

This article is to help people understand using serial ports in MAME. It uses the Color Computer drivers as a real example of the many possibilities.

The Color Computer has a built in serial port. It is commonly referred to as the bit banger. It is located on the back of the computer and labeled serial. It has three lines and ground. TX, RX, and Ready. All of the signals are under the direct control of the CPU. There is no UART on this port.

In MAME this port is called rs232. It is a MAME slot device and can be discovered by using the listslots command line switch.

$ ./mame64 coco2b -listslots
SYSTEM           SLOT NAME        SLOT OPTIONS     SLOT DEVICE NAME
---------------- ---------------- ---------------- ----------------------------
coco2b           rs232            dec_loopback     RS232 Loopback (DEC 12-15336-00)
                                  ie15             IE15 Terminal
                                  keyboard         Serial Keyboard
                                  loopback         RS232 Loopback
                                  null_modem       RS232 Null Modem
                                  printer          Serial Printer
                                  pty              Pseudo terminal
                                  sunkbd           Sun Keyboard Adaptor
                                  swtpc8212        SWTPC8212 Terminal
                                  terminal         Serial Terminal

The slot options are devices that can be attached to the serial port. There are two that let you connect emulated devices to the outside world. Null_moden and pty. In this article we will be discussing null_modem.

Let us attach a null_modem to the CoCo and see how that affects the media options available:

$ ./mame64 coco2b -rs232 null_modem -listmedia
SYSTEM           MEDIA NAME       (brief)    IMAGE FILE EXTENSIONS SUPPORTED
---------------- --------------------------- -------------------------------
coco2b           cassette         (cass)     .wav  .cas  
                 bitbanger        (bitb)     .     
                 cartridge        (cart)     .ccc  .rom  
                 floppydisk1      (flop1)    .dmk  .jvc  .dsk  .vdk  .sdf  .os9  .d77  .d88  .1dd  .dfi  .hfe  .imd  .ipf  .mfi  .mfm  .td0  .cqm  .cqi  
                 floppydisk2      (flop2)    .dmk  .jvc  .dsk  .vdk  .sdf  .os9  .d77  .d88  .1dd  .dfi  .hfe  .imd  .ipf  .mfi  .mfm  .td0  .cqm  .cqi  
                 harddisk1        (hard1)    .vhd  
                 harddisk2        (hard2)    .vhd

A new media name has been made available: bitbanger (bitb). One way to use this media is to attach a file. Everything sent to the serial port will be copied to the file. But there is a special file name used to enable internet sockets: socket dot.

For example:

 $ ./mame64 coco2b -rs232 null_modem -bitb socket.localhost:6809

This will cause MAME to try to connect to local host on port 6809. If it fails, MAME will opening a listening socket on 6809. Either way it is bi-directional.

Of course ‘localhost’ can be substituted to any fully qualified domain name on the internet.

Baud Rates and other Settings

When a serial program is running on the Color Computer and it sends data to the serial port it is fully in charge of the rate it uses. Unfortunately, there is no way for MAME to know what this rate it. So it must be told.

Screen Shot 2020-10-03 at 10.25.28 AM

In MAME go to the user interface menu and selection machine configuration. There you will see all the rate and other communication settings. They must match what the software is generating.

Expansion Port

The Color Computer has an expansion port on the side that accepts cartridges. Of course there are serial cartridges available.

Here is the command line that will display the available slots devices for the expansion port:

$ ./mame64 coco2b -listslots
SYSTEM           SLOT NAME        SLOT OPTIONS     SLOT DEVICE NAME
---------------- ---------------- ---------------- ----------------------------
                 ext              banked_16k       CoCo Program PAK (Banked)
                                  cc2hdb1          CoCo2 HDB-DOS
                                  cc3hdb1          CoCo3 HDB-DOS
                                  ccpsg            CoCo PSG
                                  cd6809_fdc       Codimex CD-6809 Disk BASIC (1986)
                                  cp450_fdc        Prológica CP-450 BASIC Disco V. 1.0 (1984)
                                  dcmodem          CoCo Direct Connect Modem PAK
                                  fdc              CoCo FDC
                                  fdcv11           CoCo FDC v1.1
                                  games_master     CoCo Games Master Cartridge
                                  multi            CoCo Multi-Pak Interface
                                  orch90           CoCo Orch-90 PAK
                                  pak              CoCo Program PAK
                                  ram              Disto 1024K RAM Cartridge
                                  rs232            CoCo Deluxe RS-232 PAK
                                  ssc              CoCo S/SC PAK

Of the ones listed, the serial devices are: rs232 and dcmodem.
The command to attach an RS232 cartridge to the expansion port is:

$ ./mame64 coco2b -ext rs232 -listslots
SYSTEM           SLOT NAME        SLOT OPTIONS     SLOT DEVICE NAME
---------------- ---------------- ---------------- ----------------------------
coco2b           rs232            dec_loopback     RS232 Loopback (DEC 12-15336-00)
                                  ie15             IE15 Terminal
                                  keyboard         Serial Keyboard
                                  loopback         RS232 Loopback
                                  null_modem       RS232 Null Modem
                                  printer          Serial Printer
                                  pty              Pseudo terminal
                                  sunkbd           Sun Keyboard Adaptor
                                  swtpc8212        SWTPC8212 Terminal
                                  terminal         Serial Terminal

                 ext:rs232:port   dec_loopback     RS232 Loopback (DEC 12-15336-00)
                                  ie15             IE15 Terminal
                                  keyboard         Serial Keyboard
                                  loopback         RS232 Loopback
                                  null_modem       RS232 Null Modem
                                  printer          Serial Printer
                                  pty              Pseudo terminal
                                  sunkbd           Sun Keyboard Adaptor
                                  swtpc8212        SWTPC8212 Terminal
                                  terminal         Serial Terminal

You will now see there are two serial ports available. Each can have their own null_modem devices attached:

$ ./mame64 coco2b -rs232 null_modem -ext rs232 -ext:rs232:port null_modem -listmedia
SYSTEM           MEDIA NAME       (brief)    IMAGE FILE EXTENSIONS SUPPORTED
---------------- --------------------------- -------------------------------
coco2b           cassette         (cass)     .wav  .cas  
                 bitbanger1       (bitb1)    .     
                 cartridge        (cart)     .ccc  .rom  
                 bitbanger2       (bitb2)    .     
                 harddisk1        (hard1)    .vhd  
                 harddisk2        (hard2)    .vhd

When this is done you will now see two bitbanger media attachments points available. Each could have a socket dot ‘fake’ file to direct it to the outside world.

Multi-Pak

Attaching a serial cartridge to the expansion port means you can not have disk drives as well. Radio Shack’s answer to this problem was the Multi-Pak interface. It allowed four cartridges to be attached to the expansion port at a single time. They were all connected at the same time with some limitations. Here are some example commands to use serial cards with the Multi-Pak.

$ ./mame64 coco2b -ext multi -ext:multi:slot3 rs232 ext:multi:slot3:rs232:port null_modem

This will start a coco2b driver with a Multi-Pak, Floppy disk in slot 4 (the default) and a RS232 pal in slot 3. There will be a bitb1 and bitb2 media attachment points.
It is worth noting the serial interrupt is a switch signal in the Multi-Pak. This means the interrupt will only make it to the CoCo if the switch is set to the slot that the RS232 cartridge resides in.