My code (well, it's not exactly mine, it's a butchered version of Apple's) runs on a PIC16F87 or 88 - what purposes are you thinking of that would justify a port to another microcontroller? Don't let me stop you if you're looking for a project, mind, I'm just curious.
Ha - you might do well to discourage me from another pointless project! OK, why port it to another MCU?
1. I'd love to claim some high-minded principle, but I'm afraid some of my motivation is that I don't like PICs much ;-) !
2. Having said that, I think there's something to be gained from transcribing the algorithm in more abstract and cleaner terms. e.g. the PIC16F87 could probably implement a much cleaner version as it's a far superior MCU. Or e.g. in the original version the memory fill routines just store W in IND and keep incrementing FSR until it gets to 0. But that only works on the '54, because FSR is a 5-bit reg + bits 5..7 =111₂. So, incrementing FSR when it's set to 0x1111111 => 0, so it doesn't trample on any of the other SFRs in a different reg bank. Also, I've seen some specs which imply ADB timing isn't that
critical, though it might be on a PIC with no interrupts (aaah, see later, timing is +/-3% for host, +/-30% for devices).
3. Digital preservation. I guess this project exists, because some of the PICs are now failing, or have been overloaded by live-plugging ADB devices? The future might not have PIC16F87's to hand (or a Mac enthusiast might not), so it'd be handy to use whatever's to hand, e.g. an Arduino with an adapter board.
4. Apple used different ADB MCUs from the start. The Apple ||gs used an M50740AL.
Which was a Mitsubishi 8-bit device a lot like a 6502, but not exactly the same!
You can see on the data sheet, section 3, about 15% down that the ADB pin is connected to P27 and CNTR - a counter reg? Given all the other functions the chip handles, it must use interrupts and so can't be 100% cycle compatible with the Mac SE's PIC version.
Finally, I found a couple of useful articles for the protocol itself:
But primarily, this is simply interesting to me, so I've no idea if I'd take it any further.
-cheers from Julz