It's Harder Than It Looks

I've been delving into the internals of the VT100, and it's an impressive piece of engineering. The terminal itself is a fairly sophisticated computer in its own right, built around an Intel 8085 processor. You might expect the keyboard to be a simple ASCII affair with a 7-bit interface, which was popular at the time, but it's not. Instead, it's a serial interface, like the later PC, AT and PS/2 keyboards we're all familiar with. Unlike the AT or PS/2 keyboards, though, the VT100 keyboard is bi-directional. The terminal manages the state of the LEDs and bell on the keyboard by sending status words to it.

Not too hard, right? It kind of sounds like SPI, no big deal. But wait!

The DEC engineers, bless their hearts, decided that using three wires for serial data (clock, rxd, txd) was wasteful. Why have separate receive and transmit lines when you can combine them?

Still not too hard, right? I mean that sounds a bit like I2C, just have a master/slave deal. But wait!

"Two wires, that's still wasteful," said the engineers. Why not combine data and clock onto one transmission line? Oh, and this master/slave business, that's unnecessary, let's allow both sides to talk simultaneously. So, that's what they did. The keyboard is asynchronous, bi-directional, and full duplex over one transmission line.

The VT100 keyboard connector is a 1/4" TRS ("Tip-Ring-Sleeve") connector with three physical lines: Ground, +12V, and Data. Both sides can communicate at any time over that data line, there is never any ambiguity. Here's how the "VT100 Technical Manual" (1982, p. 4-34) describes it:

The terminal sends data and clock to the keyboard; the keyboard sends data only. Transmission is asynchronous, full duplex, serial, 8-bit data with one start bit and one stop bit over a single signal line. Four states can exist on the line, representing the two signal states from each end of the line.

Both signals may coexist on the same wire, originate at opposite ends, and simultaneously communicate provided that sensing resistors are put at each end. The interface works by observing the voltage variations on its input (across the sensing resistor) while biasing the input in the opposite direction with its own output signals so that only input variations can cause enough change to exceed the threshold of detection. […]

If one side of the line is at +12 volts and the other is at ground, then by Ohm's Law, the center of the two equal resistors will be at V/2 = 6 volts. If both sides are at 0 or 12, the center will be identically at 0 or 12. Thus the signal line can either have no current flow but with the junction of the two resistors at either 0 or 12 volts, or the junction can be at 6 volts with current flow to the left or to the right, thereby representing the four required states.

Wow!

So, this is what I've gotten myself into. Luckily, the “VT100 Technical Manual” has exhaustive details about the interface and how it works. Over the next few days I'll be posting more about it, as well as building a few test circuits to interface that 4-state signal to a 5V device.