You gave me a big Deja Vu moment. The 8021 keyboard controller died in my Victor 9000 keyboard which led me on a wonderful journey in replacing it with an Arduino Nano. Works a treat but it was very much a personal challenge!
Cool project. 🙂 I also managed to get my IMC-2001 keyboard working (roughly 1984). It had some defect ICs and some broken cables. That keyboard has a MCS-48 clone CPU in it (CIC8039E) and the protocol proved to be simple 7-bit ASCII with a stop bit on serial 19200 baud. There is an additional signaling line leading directly to a register on the motherboard (presumably latching in the current value of the key pressed into a memory mapped byte in memory). And it has a active low reset line for the Apple ][ reset key.
Great use (adaptation) of a typewriter keyboard. Poking at the code you've shared - I wonder if the original programmer used goto's to keep their switch statement orderly, or if it's a quirk introduced by the compiler.
I'd imagine that the original code would have been hand-written assembly. It's actually all strung together with gotos, written as a big state machine, and makes clever use off the 8051 register banks so a lot of state is kept in registers long term (not that the 8051 really has RAM, as such!). The original source would be interesting to see.
@@hjalfiI'd like to see it too. There used to be an Atom (depreciated) plugin that would allow scope-aware renaming of {function and variable} names that I found really useful when un-obstuficating code. I wonder if it has been ported to another editor yet. *EDIT:* better, there are many more 'refactoring' plugins for other editors now than way back when I last searched. *Edit 2:* questionable, not all of them claim to be scope aware...
Most likely, yeah, but simply getting access is a pain. I also wonder whether the sensor failure is because something else is relying on the -5V line upstream of my fix, although I can't imagine what.