Cocoacrumbs

Cocoacrumbs

All of the buildings, all of those cars
were once just a dream
in somebody's head
Mercy Street - Peter Gabriel

Cocoacrumbs

5 minutes read

Pic 1

Overview

After a long hiatus, which is easily explained as I’ve been working on my most complex project yet. And even more nostalgia I’m afraid… For the last few months I’ve been working on creating an old fashioned video terminal (circa 1980’s) using chips of that era as well (I inherited a ton of TTL chips when my work decided they didn’t need their small electronics lab anymore.). It’s my first digital project in decades and it might still be a bit rough around the edges (my Z80 skills aren’t what they were used to as well I’m afraid).

The full set up. The green Terminal board plugged in a (blue) RC2014 system.

The requirements I had in my head were:

  • Use the 6845 CRT controller chip.
  • Drive a VGA monitor (640 x 480 resolution).
  • Support 115.200 baud (other baud rates are a nice extra).
  • Minimally support 80 characters on 25 lines.
  • Have a usable subset of the ANSI/VT100 standard.
  • Support colour.
  • Use a PS/2 keyboard (a PS/2 mouse would be a nice extra).
  • Have a connector for the RC2014 bus for power and RX/TX.
  • Should be able to work on its own as well (meaning some provision for power/reset and external serial port connector).
  • Use common, of the shelf chips (except for the 6845 which is not in production anymore). I.e. no PAL’s, GAL’s, FPGA’s, etc.
  • Fit everything onto one PCB.

Why the 6845?

No rational reason I’m afraid except for nostalgia again. I used to have a BBC Model B home computer during my youth which used a 6845 and I remember playing around with various register settings to e.g. change the shape of the cursor. Since then I always toyed with the idea to build something around the 6845. And that time has come now :-)

Terminal board plugged into a RC2014 computer.

Which 6845?

The desire to use a VGA monitor meant that the required video frequencies were about twice as high as was common at the time the 6845 was developed. For the wanted 640 by 480 resolution, the following frequencies are specified (Video Timings: VGA, SVGA, 720p, 1080p gives a very nice overview and explanation of the various timings and frequencies involved):

Name          640x480 (60 frames/second)
Aspect Ratio         4:3

Pixel Clock       25.175 MHz
Pixel Time          39.7 ns ±0.5%
Horizontal Freq.  31.469 kHz
Line Time           31.8 μs
Vertical Freq.    59.940 Hz
Frame Time          16.7 ms

Horizontal Timings
Active Pixels        640
Front Porch           16
Sync Width            96
Back Porch            48
Blanking Total       160
Total Pixels         800
Sync Polarity        neg

Vertical Timings
Active Lines         480
Front Porch           10
Sync Width             2
Back Porch            33
Blanking Total        45
Total Lines          525
Sync Polarity        neg

Active Pixels    307,200 

From the pixel clock (the term dot clock is often used as well), we can derive the character clock which will be used to drive the 6845. If we want 80 characters per line, then each character is 640 / 80 = 8 pixels wide. The character clock is then 25.175 MHz / 8 = 3.147 MHz.

That’s quite high and most produced 6845’s can only handle 1 to 2 MHz character clocks. Luckily, there are a few versions of the 6845 capable of handling such frequencies. E.g. the HD68B45SP, made by Hitachi, can handle frequencies up to 3.7 MHz.

Once I had a working prototype, I tried using a 2MHz version (the MC68B45P from Motorola) and it ran fine as well. What’s more, this one ran actually quite a lot cooler than the 3.7 MHz Hitachi one. Ever since, the 2 MHz stayed on the board and it has already ran many weeks continuously without any problem.

A 2 MHz 68B45P running happily at 3.147 MHz.

CPU

The terminal needs some brains as well to support the serial port and interpret the ANSI commands. I chose the Zilog Z180 because it has 2 serial ports on board which meant a huge space saving for the PCB. The Z180 can also run pretty fast, up to 33 MHz. Here the Z180 runs at 18.432 MHz which is a convenient frequency to derive various baud rates from.

Close up of the terminal board with the square Z180 chip in its PLCC socket and the ROM still in a ZIF socket.

Keyboard

I wanted to connect a keyboard directly to the terminal as well. This typically means a PS/2 keyboard which can still be found. Or by using a USB to PS/2 adapter if you want to use your preferred USB keyboard.

This is the only place where I decided not to use period correct chips and I opted by using an ATMEGA328P (from Arduino Uno fame) instead. Mostly out of space considerations. The board is already 10 by 20 cm’s big. Adding the required 8242 chip and its supporting chips would make the board significantly bigger again.

Next to that, several libraries for the Arduino ecosystem already exist for decoding the PS/2 protocol. That saved me quite some time as well. I settled on the PS2KeyAdvanced Library from techpaul.

This ATMEGA328P talks to the Z180 on its second serial port at 115.200 baud.

4 generations of PCB layouts. Each new generation both smaller but more capable.

Can you show something?

I’ve uploaded 2 [silent] video clips to YouTube putting the terminal through its paces.

This video clip shows the terminal running at 115.200 baud and connected to my RC2014 system running CP/M with WordStar 4 and Turbo Pascal 3. At the end I show the setting screens as well.

This video clip shows the same WordStar 4 and Turbo Pascal 3 on my RC2014 system but now running at, a still usable, 9.600 baud.

In part 2 I’ll discuss the hardware.

Recent posts

See more

Categories

About

Cocoacrumbs