It’s Technical Time 🙂

PLEASE! If anyone can add anything to this then please let me know.

As I’ve recently been working on interfacing a PS/2 keyboard to Gemini video cards using a PIC microcontroller I thought I’d share the information that I’ve found. Much of this is from the Gemini manuals for the IVC and SVC cards and from various magazines.

Gemini’s first keyboard was the GM821 (Very originally numbered G613³). This produced 7-bit output with a positive-going strobe.¹ The 59 keys available can produce characters 0x00 to 0x7F, the first half of the ASCII character set. This is typical of ASCII keyboards of the time, in fact the Nascom keyboards could also produce this range (but with multiple keypresses & less convenience). The IVC card, which was contemporary with the GM821, has pin 16 on the keyboard connector marked as “no connection”, leaving just pins for Data 0-6, which makes perfect sense. (Verified here¹¹ – p.48). The GM821 could be connected to the G811 processor card, the IVC and the SVC.³

The function keys could be programmed with characters or strings. Approximately 512k of RAM was available for key definitions – an average of 8 bytes per key if all the available programmable keys were used.

The GM821 produces single-byte codes 0x1E, 0x1F, 0x1C and 0x1D for cursor up, down, left & right respectively. I’ve verified this.

The second keyboard, which eventually replaced the GM821, was the GM827. This had 87 keys and is (according to the 1982 Gemini catalogue) another 7-bit + strobe design.

The SVC card, which was a replacement for the IVC, is designed (in hardware anyway – the manual for MON-V4 says that it accepts 7-bit characters) to accept 8-bit data in both parallel and serial formats. I’ve verified this from the circuit diagram. Pin 16 of the parallel keyboard connector is marked as D7.

Some of the additional keys on the GM827 were used to replicate some of the Shift-Control functions, additionally the function keys were implemented.³ I think that the cursor arrows and the whole numeric pad almost certainly produce two-byte codes as this would make them an extension to the programmable function keys set.

Now, this is where it gets interesting and very relevant to my little project. The function keys are two-byte messages to the controller. The first byte (appears to be) 0x1B, which is Esc, and the second byte is the code for the function key. If the second code is 0x00 then the 2-byte message is treated as Esc. Neither of these bytes requires bit D7 from the keyboard, yet if it is there then why bother with the two-byte system at all? All the required codes could have fitted into the 256 codes available. Perhaps the GM827 doesn’t produce bit D7? The IVC and SVC accept 8-bit control codes from the host¹¹, so they can probably also send them, allowing 8-bit keyboard codes to pass directly.

The replacement for the GM827 was the GM852 low profile keyboard, available as GM852P (parallel) or GM852S (serial). It is, supposedly, a GM827 in a plastic case (and the function key set of the later versions also allow for Ctrl characters as well as normal & shifted). The GM827 and GM852 both use a 8035 processor to scan the keys & produce the ASCII output.According to the 1985 Gemini catalogue, the GM852P and GM852S were both 7-bit ASCII keyboards again. The logic of the SVC card is such that a serial keyboard has to send 1 start and 8 data bits though. It looks as if the most significant data bit is just ignored.

However, I’m wondering if the GM852 was, in fact, 8-bit output rather than 7-bit. The 8035 is a ROMless variant of the MCS-48 microcontroller. Consequently it must be used with a separate ROM chip so there wouldn’t be any mask program change costs. I can’t see any reason to assume that the later keyboards should be 7-bit output. I’d love to be able to verify this but I don’t have a GM852. (Incidentally, the 8035 was also used to generate the music for the Nintendo Donkey Kong arcade game!)

There is a subtle difference in the way that the IVC and SVC handle the keyboard. The IVC looks for a keyboard character on each video frame, i.e. every 20ms. Because of this the STROBE pulse must be longer than 20ms for it to be reliably seen. The SVC uses a normal processor interrupt, which is triggered by the reception of each keyboard character.¹²

¹    IVC software manual p.17
²    SVC hardware manual p.5 & p.8
³   “An IVC Problem?” – 80-Bus News vol.4 no.1 p.4
¹¹ “An Insight into the Gemini IVC and SVC” – 80-Bus News vol.3 no.2 p.46
¹² “An Insight into the Gemini IVC and SVC” – 80-Bus News vol.3 no.3 p.20