Jump to content

Lessons from the Macintosh ADB bus (keyboard)


neutrino
 Share

Recommended Posts

IIGS/Macintosh users seem to have taken the plunge to reverse engineer the original code to implement the ADB bus. I thought maybe there's some lessons that can used for the X16 keyboard interfacing..

https://68kmla.org/bb/index.php?threads/mac-se-adb-controller.38363/#post-415047 - Mac SE ADB Controller (2021-07-06)

Scott Squires:
"This is the firmware extracted from the ADB controller chip (342S0440-B) from a Mac SE. The chip is a PIC16CR54."

tashtari:

"The firmware does not make use of the PIC16F54's built-in timer and only uses the instruction clock for timing. It also does not use the watchdog timer, and hence doesn't make use of the OPTION register at all."

"looks like the code is meant to accept a lot of variance in the device's timing."

"The firmware uses the uppermost eight bytes of its teensy twenty-five-byte SRAM as a data buffer (ADB frames contain a maximum of eight bytes)."

"Based on usage, I'm reasonably sure that pins 8, 9, and 10 (RB2, RB3, and RB4; CB1, CB2, and PB3 from the VIA according to the bomarc schematic) are outputs from the PIC, and that pins 17 and 18 (RA0 and RA1; PB4 and PB5 from the VIA according to the bomarc schematic) are inputs to the PIC."

"Looking at the code some more, based on the timing in sending the '1' start bit, I think the external clock is 2 MHz exactly.

Also, further confusing the issue about the data direction registers, there are a pair of subprograms that ostensibly clock a byte into and out of the VIA using the same pin in both directions (pin 9, RB3, CB2 on the VIA). I had previously thought this was an output. This doesn't make sense unless the PIC's GPIO ports are open-collector - a 1 meaning let float and a 0 meaning pull to ground."

"The MiST project has an implementation of the ADB controller wired up to a model of the VIA. "

https://github.com/mist-devel/plus_too/blob/master/adb.v

"here it is, a working port of the Mac SE ADB controller to the PIC16F88, and thusly a pin-compatible drop-in replacement."

https://68kmla.org/bb/index.php?threads/mac-se-adb-controller.38363/post-458217

Pinout:

https://en.wikipedia.org/wiki/Apple_Desktop_Bus

Theoretical speed is 125 kbit/s over the single bi-directional wire used in half-duplex operation though.

 

×   Your link has been automatically embedded.   Display as a link instead

Edited by neutrino
Link to comment
Share on other sites

The Macintosh 128k/512k/Plus serial keyboard interface is also reverse engineered, in this case for a PS/2 to a Macintosh adapter using a STM32F0DISCOVERY:

https://www.synack.net/~bbraun/mackbd/index.html - Mac Keyboard Interface

"The keyboard has exclusive control over the clock, and the data line is bidirectional, although the computer can be thought of as the "master". The keyboard cannot initiate communication with the computer."

Adapter code:

https://synack.net/~bbraun/macsrc/mackbd-0.4.tar.bz2

PS/2 side protocol:

http://www.computer-engineering.org/ps2protocol

Macintosh side protocol:

http://www.mac.linux-m68k.org/devel/plushw.php

"a Synertek SY6522 Versatile Interface Adapter (VIA) for the mouse and keyboard"

"The Macintosh keyboard and numeric keypad each contain an Intel 8021 microprocessor that scans the keys. The 8021 contains ROM and RAM,"

Intel 8021 = https://en.wikipedia.org/wiki/Intel_MCS-48

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use