Monday, January 9, 2012

Basic CoCo Architecture

This seems like a good opportunity to provide an overview of the CoCo's technical details.  Such an overview should be helpful in understanding some upcoming topics around the development of Fahrfall.

Chipset Overview

The design of the CoCo is based upon a reference design in the back of the datasheet for the Motorola MC6883.  This reference design is built around a handful of LSI chips from Motorola:
  • 6809 (CPU)
  • 6883 (SAM)
  • 6847 (VDG)
  • 6821 (PIA)
The CPU is one of the most powerful of its era.  The hardware includes two 8-bit accumulators A and B, which can be concatenated together and referenced as the D register.  A number of 16-bit accommodations in the instruction set make use of the D register, and it is convenient for data movement.  The 6809 also includes a hardware multiply instruction, for when that operation is necessary.  (Alas, there is no divide instruction!)  Finally, the 6809 was specifically built for running position independent code.  This gives it a wealth of branching and data indexing capabilities not present in most of its contemporaries.

The SAM (Synchronous Address Multiplexer) glues the rest of the system together.  This device controls access to the DRAM in the system, and provides the refresh signals for the DRAM as well.  The 6883 also does the address decoding for the rest of the base CoCo system, providing chip selects for the other on-board devices and a couple for the expansion slot as well.  The 6883 also controls the clock, allowing for a choice between two different clock speeds.  Finally, the SAM integrates with the VDG in order to enable the CPU and the VDG to share the DRAM without interfering with one another.  This final feature also allows for some extra videos modes not available with the VDG alone.

The VDG (Video Display Generator) is, of course, what puts the graphics on the screen.  The 6847 is a utilitarian chip, providing a modest variety of both text and graphics modes in a limited variety of colors.  "Semi-graphics" modes are available as well, with more simultaneous colors but less flexibility.  The modest feature list gets even more modest as one tries to take advantage of certain features -- higher resolutions are only available in either black-green or black-white combinations; the colorful graphics modes have to pick between two fixed four-color palettes; and the "semi-graphics" modes are very low resolution.  Still, the device can produce credible displays for the era.  Also, the SAM/VDG combination allows for some higher-resolution "semi-graphics" modes that are less of a compromise to use.

Two PIA (Peripheral Interface Adapter) chips round-out the set.  Each PIA provides two 8-bit digital I/O ports, as well as two 1-bit inputs and two other 1-bit I/O signals.  The PIAs are used to implement all of the other peripherals that are part of the CoCo, with the exception of the expansion port.

Other Peripherals

One of the most important devices remaining to be described is the 6-bit Digital to Analog Converter (DAC).  The DAC is used to output audio to the television and to transmit data to the cassette recorder interface.  It is also used in conjunction with an on-board comparator circuit to digitize values from the joysticks.  The input to the DAC comes from one of the PIA ports.

A two-channel analog multiplexor is part of the CoCo.  One side is used to select between three audio sources: the DAC; the cassette input; and the expansion port.  The other side is used to select between the two joysticks and each of their axes.  The joystick axes connect to the other input of the comparator mentioned above.  The selection for the multiplexor channels is done via two of the 1-bit outputs from the PIAs.

Two PIA ports are used to scan the keyboard.  The handful of remaining PIA bits are used to implement the cassette player input (including motor control!), the serial port (with the help of some level shifters), and a 1-bit sound option.  A couple of the bits used for the keyboard scan are reused to also monitor the buttons on the joysticks.  The remaining 1-bit inputs of the PIAs are used to enable interrupt generation from the VDG, the expansion port, and the serial port's Carrier Detect bit.

Is That All?

Well, this is running a bit long...I didn't even get to the expansion port!  Hopefully I didn't lose anyone.  I could probably go into more details, but anyone that really wants more details can probably find them on their own.  I suppose that I just wanted to provide a feel for how much the guys that put the CoCo together did to make the most of what they had available.

Anyway, in upcoming posts I hope to discuss things like what video mode I am using for Fahrfall, how to generate music and sound effects on the CoCo, how to read joysticks, etc.  Hopefully the background provided above makes those posts a bit more digestible.

More to come!


  1. Just figured I'd put a note that while the 6809 has a hardware multiply instruction, it does not, in fact, have a hardware divide instruction.

    1. Quite right, of course. If I had actually used either of those operations in Fahrfall then I probably would have gotten that right... :-)