May 13, 2025

Sun 3/60 -- Zilog Serial (SCC)

These notes are from my Sun 3/80 project. The Sun 3/60 uses two of these chips. Each chip has two serial interfaces.
The Sun 3/60 uses the 40 pin chips marked Z8530, just like the Sun 3/160.

There are both Z8030 and Z8530 parts. Forget about the 8030. It is the same inside, but the interface is designed for the Z8000 processor, that nobody ever used. The Sun 3/80 uses the 8530 with a general purpose interface.

They tell you that the the part has 14 write and 7 read registers. That apparently is a lie. In the register descriptions, they describe 16 of each!

Each chip has two channels, so the machine has 4 serial ports.

One handles the keyboard and mouse.
One handles the two back-panel serial ports.

The chip has a 300+ page manual (book). I actually have one on my shelf. #Why 300 pages for a serial port?", you ask. Good question. They call the chip a "multiprotocol" serial port and in 1992 they wre proud of it. Back in those times, a variety of synchronous serial protocols were in use and the networks of today were just getting started. These days, nobody gives a hoot about all that and we just want a good old asynchronous serial port for a console.

In other words, you can ignore the bulk of what is in the book, and try not to trip over extra stuff in control registers.

Addresses

This gets interesting because we have different physical and virtual addresses for this chip. The ROM will eventually enable the MMU and begin using virtual addresses, so you have to be on your toes about which address to use.

On the 3/60, I see these addresses being used in the ROM:

fffe000 for serial A control
fffe002 for serial A data
fffe004 for serial B control
fffe006 for serial A data
The Sun reference manual says that the serial ports are at:
0000_0000 - for keyboard/mouse
0000_2000 - for serial ports A and B (above)

Holding that thought for the moment, we see via print statements tucked into the bootrom that the two SCC chips have the following base addresses:

6200_0000 is the keyboard and mouse
6200_2000 is the A and B serial port

How the game is played

There are 2 pins on the chip of interest to us here. The A/B pin selects which of the two serial channels we are dealing with. The other pin is the C/D pin and though it is labeled Control/Data, it really gives us two modes of dealing with the chip.

We could never use C/D and always let this be low (selecting "C"). Then we have to access whatever register we want by a two step process, sending the selection first, then reading or writing (from the same address mind you) in the second cycle. This would work, and allow access to all the registers. There is one caveat, that is that after every two step cycle, the selection goes back to zero. This means if you don't select anything, you get register 0.

If we do pull C/D high, that explicitly select the data register (internal register 8), bypassing the need to select it.

So we have two shortcuts. We can just read with C low and get register 0, which has the control and status stuff we most commonly want. We can just read/write with D high and get the data register. It also works to just write with C low. There are only 4 register select bits, along with 4 bits to command unusual thing.

What do we see in bootrom code

For the A/B serial ports, we see 4 addresses:
6200_2000 - port A C
6200_2002 - port A D
6200_2004 - port B C
6200_2006 - port B D
The Keyboard is simpler, we see accesses only at two addresses:
6200_0000 - keyboard C
6200_0004 - mouse C
Presumably 0002 and 0006 exist for keyboard and mouse, but I never see them getting used in the bootrom code.
I do see access to the keyboard via the fef0_0000 virtual address.

The same goes for serial A at fef0_2000 and fef0_2004.