• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Mac Plus Keyboard Project Suggestion

trag

Well-known member
The Macintosh Plus (and earlier) keyboard contains a microcontroller. The microcontroller has on-board mask (factory programmed) ROM.

An interesting project would be to read out the contents of the Macintosh keyboard MC ROM, I think.

It may be possible to figure out what the MC must be doing just by knowing the keyboard communications protocol and the mapping of the keyswitches to the IO ports of the MC, but I think it would be nice to know the exact code in Apple's implementation.

I've seen sources that say the original Macintosh keyboard contains an Intel 8049 or an Intel 8021. They are the same family of MCs, but the 8021 has less on-board ROM and fewer IO lines.

I suspect that the original Mac keyboard contains the 8021 and that the Mac Plus keyboard (with keypad) contains the 8049.

Here's an interesting web page with a hack to read out the contents of the 8049 ROM:

http://www.sbprojects.com/projects/8049spy/index.php

Some chip programmers are capable of reading the contents of the 8049 as well. I don't know if the above project will work on the 8021 but it should, provided that the 8021 has an EA pin.

I'd do this myself, but, ha. The chances of me ever getting to it are near zero.

Oh, and interestingly, Jameco still has stock of the 8049 available at $1.49 each.

 

bbraun

Well-known member
FWIW, the ROM of at least one of the keyboards has been dumped, but per my understanding of the forum rules, we can't really talk about that here.

MESS emulates both the Mac and Plus keyboard as an 8021 (implementation here)

I personally only have the original keyboard, although I'm trying to acquire a Plus version (by like 20x for all the compacts I got a while back). But it could be an interesting project to try to build a new keyboard using the same controller...

 

James1095

Well-known member
I suspect the contents of the ROM is not really all that interesting. You can get a pretty good idea of what the code looks like just by viewing the microcontroller as a black box and knowing what the keyboard does. There will be a routine that scans the key matrix continuously, spitting out the appropriate code each time a key is pressed. I would assume that the keystroke buffer is implemented in software in the OS, and auto-repeat of keys likely is as well. Hang a DSO or logic analyzer on the keyboard interface and you can probably work out the details fairly quickly.

I'm pretty sure there is nothing fancy going on, AFAIK the pre-ADB Mac keyboard is a relatively "dumb" device.

 

bbraun

Well-known member
I've looked at doing the keyboard a bit, and it's a little more involved than just putting key codes out on a serial port.

It is my understanding the 8049 has an internal non-reprogrammble ROM. There's a pin to hold high telling it to use an external ROM for development. So for our uses, we'd need an external ROM. The way it accesses the external ROM is via an 8 bit bus that puts the address being fetched on the bus and pulses the address latch enable (ALE) line, then pulses /PSEN to put the data on the bus. I'm not aware of a ROM that behaves that way, so to use it with something like a 27C256 or similar, you'd need additional logic to latch the bus data when ALE is asserted, and feed that to the ROM, then attach /PSEN to /OE of the ROM?

The 8021 had no provision for an external or reprogrammable ROM, it was factory programmed and that's it.

 

James1095

Well-known member
I'm not sure I understand the goal here. Are you trying to learn more about how the original keyboard works, or are you trying to get your own code to run on the microcontroller in the keyboard? If the former, the easiest path is likely watching the interface while interacting with the keyboard. It won't take too long to figure out how it communicates with the host. The early Macs were minimalist to the core, it has to be pretty simple.

 

trag

Well-known member
My thought was to get the original code and examine it to determine if there is anything non-obvious being done in the code. Plus, I assume (dangerous), that Apple did some testing and optimizing to get the timing of the debounce and such to the best values. Extracting/reverse engineering those timings would be useful in a recreation.

Of course, if one builds a replacement keyboard with a different brand/model of keyswitch, those values may not be so useful any more.

Personally, I don't care to recreate the Mac Plus keyboard in an authentic way -- meaning that I don't feel any need to use an 8049 or 8021 as the microcontroller. I do think it would be fun to create new keyboards or adapt old favorite keyboards using a more modern and accessible MC and an adaptation of the old code.

It might be possible to get a perfectly acceptable result by examining the signals from the keyboard, but there is also some value in examining the old code, if for no other reason than to confirm that there's nothing important in there that would be missed or overlooked by just examining the signals. Plus, I think hacking the code out of the OTPROM would be fun.

And why else are we fiddling with these out of date machines, if not for fun?

I have about a dozen brand new (well, never used) Apple IIe Platinum keyboards from when Sun was clearing out stuff. It might be interesting to convert one or more of those into Mac Plus Keyboards. I haven't looked to see if they have a MC on board or just a switch matrix. From the look of the cable, I suspect it's just a switch matrix, but I'm not going on much evidence.

 

uniserver

Well-known member
I wouldn't mind cutting off the cord to my Apple Design Keyboard, and using that some how, i know its ADB… but.

i have a whole box of these crappy Apple Design Keyboards.

 

Gorgonops

Moderator
Staff member
I have about a dozen brand new (well, never used) Apple IIe Platinum keyboards from when Sun was clearing out stuff. It might be interesting to convert one or more of those into Mac Plus Keyboards. I haven't looked to see if they have a MC on board or just a switch matrix. From the look of the cable, I suspect it's just a switch matrix, but I'm not going on much evidence.
I know for certain that the plain IIe (not Platinum) keyboard is just a matrix. Pretty sure the IIe Platinum would be one as well, but I *believe* that the keypad buttons are on a separate matrix with a separate cable from the main keys, which is sort of odd.

 
Top