Jump to content

Apple Desktop Bus: Difference between revisions

From RetroTechCollection
Created page with "{{Infobox connector | name = Apple Desktop Bus | logo = 150px | type = Computer peripheral interface | designer = Steve Wozniak | design_date = 1985-1986 | manufacturer = Apple Computer | production = 1986-1999 | superseded = USB | external = Yes | hotplug = Technically capable but not recommended | cable = 4-conductor shielded | pins = 4 | connector = Mini-..."
 
Fix two red links: point the Macintosh Portable mention at the hosted service manual, and unlink the non-existent Universal Serial Bus page
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Infobox connector
{{Infobox connector
| name        = Apple Desktop Bus
| name        = Apple Desktop Bus
| logo        = [[File:ADB_logo.svg|150px]]
| logo        = [[File:Apple Desktop Bus (icon).svg|150px]]
| type        = Computer peripheral interface
| type        = Computer peripheral interface
| designer    = [[Steve Wozniak]]
| designer    = Apple Computer
| design_date  = 1985-1986
| design_date  = 1985-1986
| manufacturer = [[Apple Computer]]
| manufacturer = Apple Computer
| production  = 1986-1999
| production  = 1986-1999
| superseded  = [[Universal Serial Bus|USB]]
| superseded  = USB
| external    = Yes
| external    = Yes
| hotplug      = Technically capable but not recommended
| hotplug      = No - Apple's documentation warns against it
| cable        = 4-conductor shielded
| cable        = 4-conductor shielded, 5 m maximum
| pins        = 4
| pins        = 4
| connector    = Mini-DIN 4 (same as S-Video)
| connector    = Mini-DIN 4 (same shell as S-Video)
| electrical  = Single data line, open collector
| electrical  = Single data line, open collector, 470 ohm pull-up
| maximum_devices = 16
| maximum_devices = 16 addressable; more than 3 per port not recommended
| protocol    = Serial, self-clocking
| protocol    = Serial, self-clocking, single-master
| data_signal  = Bidirectional serial
| data_signal  = Bidirectional serial
| data_rate    = 10-125 kbit/s
| data_rate    = ~10 kbit/s (100 us bit cell)
| style        = Serial
| style        = Serial
| pinout_caption = ADB connector (female socket)
| pinout_caption = ADB connector (female socket)
}}
|pinout=[[File:Apple Desktop Bus Connector Pinout.png|150px]]}}
<templatestyles src="Template:StyledTable/styles.css" />
The '''Apple Desktop Bus''' ('''ADB''') is Apple's single-master, multislave bit-serial bus for low-speed input devices — keyboards, mice, graphics tablets and the like. Apple describes it as connecting "up to 16 low-speed input devices".<ref name="gmfh">''Guide to the Macintosh Family Hardware'', second edition, Apple Computer, Inc. / Addison-Wesley, 1990 — hosted on this wiki as [[:File:Apple Guide to the Macintosh Family Hardware 2nd Edition 1990.pdf]]. Chapter 8, "Apple Desktop Bus", pages 287–326: bus overview (single-master multislave, up to 16 devices, ADB transceiver IC described as a 4-bit microcontroller, two connectors wired in parallel, four-conductor shielded cable, the warning against unplugging a device while the computer is running, the 500 mA total bus limit, the 5 m cable length and 100 pF/m capacitance limits, and the note that daisy-chaining more than three devices on one port is not recommended); Table 8-1 connector signal assignments; Table 8-2 transceiver electrical characteristics; Table 8-4 register 0 in the Apple Standard Mouse and the accompanying note on 100 ±10 and 200 ±10 counts per inch; Tables 8-7 and 8-8 registers 0 and 2 in the Apple Standard Keyboard; Tables 8-10 and 8-11 registers 0 and 2 in the Apple Extended Keyboard; Table 8-12 transaction states; Table 8-13 command byte syntax; Table 8-14 the full timing specification; Table 8-15 device register 3; Table 8-16 device addresses; Table 8-17 reserved Device Handler IDs; the collision-detection, polling (11 ms) and error-condition sections. Chapter 9, "Floppy Disk Interfaces", is the source for the floppy-drive material.</ref> It was introduced on the [[Apple IIGS]] in September 1986 and carried across the Macintosh line from the [[Macintosh SE]] and [[Macintosh II]] in 1987 until USB replaced it at the end of the 1990s.


'''Apple Desktop Bus''' ('''ADB''') is a proprietary bit-serial peripheral bus connecting low-speed input devices to computers. Designed by [[Steve Wozniak]] and introduced on the [[Apple IIGS]] in September 1986, ADB was created to provide a simple, low-cost method for connecting keyboards, mice, and other input devices in a daisy-chain configuration without requiring hubs. The technology was quickly adopted for the [[Macintosh]] line beginning with the [[Macintosh SE]] and [[Macintosh II]] in March 1987, and remained Apple's standard peripheral interface until its replacement by [[USB]] in 1998-1999.
On most Macintosh models the bus hardware is three things: an '''ADB transceiver IC''' — which Apple describes as a 4-bit microcontroller — that drives the bus and reads device status; the '''VIA''', which is how the CPU talks to the transceiver; and '''two 4-pin ADB connectors wired in parallel''' on the rear panel. The [[Macintosh Portable Service Source|Macintosh Portable]] is the exception: there the Power Manager IC performs the transceiver function, and the Macintosh IIfx uses the IOP custom IC instead.<ref name="gmfh" />


== History and Development ==
== Physical Interface ==


=== Origins ===
=== Connector ===
During the early development of the Macintosh in the 1980s, Apple engineers had selected the sophisticated Zilog 8530 for serial communications. However, this solution was expensive and complex for simple input devices. Steve Wozniak, working on the Apple IIGS project in 1985-1986, developed ADB as a simpler, more cost-effective alternative that could support multiple devices on a single bus.
{| class="wikitable styled-table" style="width:75%;"
|+'''ADB connector signal assignments'''<ref name="gmfh" />
! Pin !! Signal !! Description
|-
| 1 || ADB || Bidirectional data bus, used for input and output. Open-collector, pulled up to +5 V through a '''470 Ω''' resistor on the computer's main logic board
|-
| 2 || POWER.ON || On the Macintosh II family, a key on the ADB keyboard momentarily grounds this pin to pin 4 to switch on the power supply. '''On other models this pin is not connected'''
|-
| 3 || +5 V || +5 volts
|-
| 4 || GND || Ground
|}


The design philosophy emphasized simplicity and low cost while maintaining reliability. Wozniak's solution used a single data line with self-clocking signals, eliminating the need for separate clock lines and reducing component count. The protocol was sophisticated enough to support device enumeration, collision detection, and service requests, yet simple enough to implement with minimal hardware.
Pin 2 is '''POWER.ON''', not "PSW"; it is a momentary ground path to pin 4, not a "direct connection to the power supply".


=== Implementation Timeline ===
The shell is the same 4-pin mini-DIN used for S-Video, which is why S-Video cables get pressed into service. Do not: some S-Video cables bridge or omit conductors, and the pin functions do not correspond.
* '''September 1986:''' First implementation in Apple IIGS
* '''March 1987:''' Adopted by Macintosh SE and Macintosh II
* '''1987-1998:''' Standard on all desktop Macintosh computers
* '''1991-1998:''' Used in PowerBook line
* '''1989-1996:''' Implemented in some [[NeXT]] computer models
* '''1998:''' Phased out with introduction of [[iMac]] G3 (USB-based)
* '''1999:''' Last external ADB port on [[Power Macintosh G3 (Blue and White)]]
* '''2000-2005:''' Internal ADB protocol continued in some PowerBooks for built-in keyboards/trackpads


== Technical Specifications ==
=== Electrical characteristics ===
 
{| class="wikitable styled-table" style="width:75%;"
=== Physical Interface ===
|+'''ADB transceiver electrical characteristics'''<ref name="gmfh" />
{| class="wikitable" style="width:60%; text-align:center;"
! Parameter !! Minimum !! Maximum
|+'''ADB Connector Pinout (Mini-DIN 4)'''
|-
! Pin !! Signal !! Description !! Specifications
| Low input signal voltage || −0.2 V || 0.8 V
|-
| High input signal voltage || 2.4 V || 5.0 V
|-
|-
| 1 || ADB Data || Bidirectional serial data || Open collector, 5V pull-up
| Low output signal voltage || — || 0.45 V (at 12 mA)
|-
|-
| 2 || PSW || Power switch || Direct connection to power supply
| High output signal voltage || 2.4 V || —
|-
|-
| 3 || +5V || Power supply || 500mA total, 100mA per device max
| Device output current when off || — || −20 µA (at 0.4 V)
|-
|-
| 4 || GND || Ground reference || Common ground
| Device input capacitance || — || 150 pF
|}
|}


The connector is physically identical to the 4-pin mini-DIN used for S-Video, leading to potential confusion. However, pins 1 and 2 are bridged in some S-Video cables, which can cause catastrophic damage if used with ADB devices.
Apple gives no rise-time or fall-time figure, and no per-device current limit. What it does give is a '''bus total''': "ADB devices may use the +5 volts supplied by the bus, but all the ADB devices combined must not draw more than a total of '''500 mA'''."<ref name="gmfh" /> A widely repeated "100 mA per device maximum" does not appear in Apple's documentation and is not reproduced here.


=== Electrical Characteristics ===
=== Cable and chain length ===
* '''Bus topology:''' Multi-drop, daisy-chain capable
Cables should be '''no longer than 5 metres''', and cable capacitance should not exceed '''100 picofarads per metre'''.<ref name="gmfh" /> On device count Apple is blunt: "Although the ADB transceiver is capable of addressing up to 16 different peripheral devices, daisy-chaining more than 3 devices on one ADB port is not recommended because of connector resistance and signal degradation."<ref name="gmfh" /> Long chains and cheap extension leads are a real cause of intermittent mice and keyboards.
* '''Signal type:''' Open collector with 5V pull-up resistors
* '''Logic levels:''' TTL compatible (0V = low, 5V = high)
* '''Cable length:''' Maximum 5 meters total bus length
* '''Power distribution:''' 500mA at 5V total available
* '''Device power limit:''' 100mA per device maximum


=== Protocol Specifications ===
== Protocol ==


==== Bit Encoding ====
=== Bit cells ===
ADB uses self-clocking duty-cycle modulation where each bit period is 100μs:
Each command or data bit is encoded as a '''bit cell''': a low voltage on the bus, a rising edge, a high voltage, and a final falling edge. A 0 is distinguished from a 1 by the relative length of the low time. Every command and data packet ends with a '''stop bit''' — a 0 bit with the same low time as any other 0, but which does not necessarily have a second falling edge.<ref name="gmfh" />
* '''Logic 0:''' 65μs low, 35μs high
* '''Logic 1:''' 35μs low, 65μs high
* '''Start bit:''' Always logic 1
* '''Stop bit:''' Always logic 0


==== Transaction Structure ====
{| class="wikitable styled-table" style="width:90%;"
Each ADB transaction consists of:
|+'''ADB timing specifications''' (Apple Table 8-14)<ref name="gmfh" />
# '''Attention signal:''' Host pulls bus low for 800μs
! Parameter !! Nominal !! Host tolerance !! Device tolerance
# '''Sync signal:''' Bus high for 70μs
# '''Command byte:''' 8 bits transmitted by host
# '''Stop bit:''' Logic 0
# '''Service Request window:''' 65-300μs (device can assert SRQ)
# '''Stop-to-start time (Tlt):''' 140-260μs bus high
# '''Data transfer:''' 2-8 bytes (if applicable)
 
==== Command Format ====
Commands are 8 bits structured as:
* '''Bits 7-4:''' Device address (0-15)
* '''Bits 3-2:''' Command type
* '''Bits 1-0:''' Register number
 
{| class="wikitable" style="width:70%; text-align:center;"
|+'''ADB Command Types'''
! Command !! Binary !! Description !! Action
|-
|-
| SendReset || 00 || System reset || All devices reset to default state
| Bit-cell time || 100 µs || ±3% || ±30%
|-
|-
| Flush || 01 || Flush device || Clear device buffer for specified register
| "0" low time || 65 µs || 65% of bit-cell time ±5% || 65% of bit-cell time ±5%
|-
|-
| Reserved || 10 || Reserved || Not used
| "1" low time || 35 µs || 35% of bit-cell time ±5% || 35% of bit-cell time ±5%
|-
|-
| Reserved || 11 || Reserved || Not used
| Attention low time || 800 µs || ±3% || —
|-
|-
| Listen || 10 || Write to device || Host sends data to device register
| Sync high time || 65 µs || ±3% || —
|-
|-
| Talk || 11 || Read from device || Device sends register contents to host
| Stop bit low time || 70 µs || ±3% || ±30%
|}
 
=== Device Registers ===
Each ADB device implements four registers:
 
{| class="wikitable" style="width:80%; text-align:center;"
|+'''Standard ADB Register Definitions'''
! Register !! Purpose !! Size !! Description
|-
|-
| 0 || Device data || 2-8 bytes || Primary data (keyboard keys, mouse movement)
| Global Reset low time || 3 ms || 3 ms minimum || 3 ms minimum
|-
|-
| 1 || Device-specific || Variable || Extended features or configuration
| Service Request low time || 300 µs || — || ±30%
|-
|-
| 2 || Device-specific || Variable || Additional features (e.g., keyboard LEDs)
| Stop-bit-to-start-bit time || 200 µs || 140 µs min, 260 µs max || 140 µs min, 260 µs max
|-
| 3 || Status/Command || 2 bytes || Device ID, address, and handler ID
|}
|}


==== Register 3 Format ====
Two things about this table are easy to get wrong. '''Sync is 65 µs high and the stop bit is 70 µs low''' — several online summaries transpose them. And the bit cell is '''100 µs''', so the bus runs at roughly '''10 kbit/s'''. A figure of "125 kbit/s theoretical" circulates widely; it does not follow from Apple's own timing table and is not used here.
Register 3 contains device identification and configuration:
 
* '''Bits 15-8:''' Exceptional event flags (device-specific)
=== Transactions ===
* '''Bits 7-0:''' Device handler ID
A transaction is a command sent by the computer followed by a data packet sent by either the computer or the device.<ref name="gmfh" />
* '''Bits 11-8:''' Device address (when read)
 
* '''Service Request Enable:''' Bit 13
* A '''command''' consists of an Attention signal, a Sync signal, one command byte, and one stop bit.
* A '''data packet''' consists of a start bit, two to eight 8-bit data bytes, and one stop bit.


== Device Addressing and Enumeration ==
=== Command byte ===
Every command byte is a 4-bit device address, a 2-bit command code and a 2-bit register code. There are '''four''' commands, not six:<ref name="gmfh" />


=== Default Addresses ===
{| class="wikitable styled-table" style="width:85%;"
{| class="wikitable" style="width:60%; text-align:center;"
|+'''ADB command byte syntax''' (Apple Table 8-13)
|+'''ADB Default Device Addresses'''
! Bits 7–4 (address) !! Bits 3–2 (command) !! Bits 1–0 (register) !! Command
! Address !! Device Type !! Notes
|-
| x x x x || 0 0 || 0 0 || SendReset
|-
|-
| $0 || Reserved || SendReset command
| A3 A2 A1 A0 || 0 0 || 0 1 || Flush
|-
|-
| $1 || Security dongles || Copy protection devices
| x x x x || 0 0 || 1 0 || Reserved
|-
|-
| $2 || Keyboards || All keyboards default to this
| x x x x || 0 0 || 1 1 || Reserved
|-
|-
| $3 || Mice/Pointing devices || Mice, trackballs, trackpads
| x x x x || 0 1 || x x || Reserved
|-
|-
| $4 || Graphics tablets || Absolute positioning devices
| A3 A2 A1 A0 || 1 0 || r1 r0 || Listen
|-
|-
| $5 || Reserved || Vendor-specific
| A3 A2 A1 A0 || 1 1 || r1 r0 || Talk
|}
 
* '''Talk''' reads a register. The device must respond with data '''within 260 µs''' or the computer takes the bus back. A device with nothing to say simply times out — except that it '''must''' respond to Talk Register 3.
* '''Listen''' writes a register.
* '''SendReset''' returns every device on the bus to its power-on state, clearing pending service requests.
* '''Flush''' is defined per device; normally it clears internal registers, losing anything buffered such as type-ahead characters.
 
The commands with command code <code>01</code> are reserved by Apple for future expansion, and nothing should use them.<ref name="gmfh" />
 
=== Signals ===
Four global signals are not addressed to any device. Attention, Sync and Global Reset are always generated by the computer; Service Request is always generated by a device.<ref name="gmfh" />
 
* '''Attention''' — a long low that marks the start of every command, followed by a short high '''Sync''' pulse that establishes the timing of the bits that follow.
* '''Global Reset''' — if the bus stays low for at least '''3.0 ms''', every device interprets it as a Global Reset, releases the bus and resets itself. A bus stuck low is therefore a permanent reset condition and nothing will enumerate.
* '''Service Request''' — a device that is not the active device and has data to send waits until the end of a command and then holds the bus low for 140 to 260 µs, lengthening the stop bit.
 
The second defined error condition is a transaction that never finishes: if the bus stays high beyond the maximum bit-cell time, all devices ignore the command and wait for a new Attention signal.<ref name="gmfh" />
 
=== Transaction states ===
Two lines from the VIA to the transceiver, ST0 and ST1, define the transaction state:<ref name="gmfh" />
 
{| class="wikitable styled-table" style="width:65%;"
|+'''ADB transaction states''' (Apple Table 8-12)
! ST1 !! ST0 !! State
|-
|-
| $6 || Reserved || Vendor-specific
| 0 || 0 || 0: start a new command
|-
|-
| $7 || Reserved || Vendor-specific
| 0 || 1 || 1: transfer data byte (even)
|-
|-
| $8-$E || Relocated devices || Collision resolution addresses
| 1 || 0 || 2: transfer data byte (odd)
|-
|-
| $F || Reserved || Global polling address
| 1 || 1 || 3: idle
|}
|}


=== Enumeration Process ===
'''State 3 is where the bus spends most of its life,''' and it is the key to understanding ADB latency: in the idle state '''the ADB transceiver automatically repeats the last Talk command every 11 ms'''. The default transaction state on startup or reset is 3.<ref name="gmfh" />
The ADB Manager performs device enumeration at startup:


# '''Reset:''' SendReset command clears all devices
== Device Registers ==
# '''Discovery:''' Poll each default address with Talk Register 3
# '''Collision Detection:''' If multiple devices respond:
#* Devices detecting collision stop transmitting
#* Non-colliding device completes transmission
# '''Address Resolution:'''
#* Send Listen Register 3 with new address ($8-$E) and handler ID $FE
#* Only non-colliding device moves to new address
#* Repeat until all devices have unique addresses
# '''Verification::''' Poll new addresses to confirm relocation
# '''Handler Installation::''' Install appropriate device drivers


=== Service Requests ===
An ADB device may have up to four registers, each 2 to 8 bytes.<ref name="gmfh" />
Devices can request service by:
# Pulling bus low during stop bit of any transaction (65-300μs)
# Host detects extended stop bit as Service Request (SRQ)
# Host polls all devices' Register 0 sequentially
# Device with data becomes new active device
# Active device is polled continuously until another SRQ


== Device Handler IDs ==
* '''Register 0''' — the data register. When the ADB Manager polls to find which device asserted a Service Request it sends Talk Register 0 to each device in turn, so a device '''must''' have data in register 0 when it requires service, even if the interesting data is elsewhere.
* '''Register 1''' — device-specific; the device may use it for anything.
* '''Register 2''' — device-specific. On Apple keyboards it carries modifier-key status (and, on the Extended Keyboard, the lock LEDs).
* '''Register 3''' — status and identification.


Device handlers define how the host interprets device data. Standard handler IDs include:
{| class="wikitable styled-table" style="width:70%;"
 
|+'''Bits in device register 3''' (Apple Table 8-15)<ref name="gmfh" />
{| class="wikitable" style="width:70%; text-align:center;"
! Bit !! Description
|+'''Common ADB Handler IDs'''
! Handler ID !! Device Type !! Description
|-
|-
| $00 || Self-test fail || Device failed internal diagnostics
| 15 || Reserved; must be 0
|-
|-
| $01 || Standard mouse || 100 CPI relative positioning
| 14 || Exceptional event, device specific; always 1 if not used
|-
|-
| $02 || Standard keyboard || Original keyboard protocol
| 13 || Service Request enable; 1 = enabled
|-
|-
| $03 || Extended keyboard || Supports extended key codes
| 12 || Reserved; must be 0
|-
|-
| $04 || ISO keyboard || International layout support
| 11–8 || Device address
|-
|-
| $05-$07 || Reserved keyboards || Vendor-specific
| 7–0 || Device Handler ID
|}
 
A device's ability to raise a Service Request can be switched off by clearing bit 13 with a Listen Register 3 command carrying Device Handler ID $00. Apple suggests this to improve service-request response time when several devices are on the bus and not all of them matter to the application in hand.<ref name="gmfh" />
 
== Addressing and Enumeration ==
 
=== Default addresses ===
{| class="wikitable styled-table" style="width:70%;"
|+'''ADB device addresses''' (Apple Table 8-16)<ref name="gmfh" />
! Address !! Device type !! Example
|-
|-
| $08-$0F || Reserved mice || Vendor-specific
| $00–$01 || Reserved || —
|-
|-
| $10-$1F || Graphics tablets || Absolute positioning devices
| $02 || Encoded devices || Keyboard
|-
|-
| $20-$2F || Other devices || Joysticks, special controllers
| $03 || Relative devices || Mouse
|-
|-
| $30-$FD || Vendor-specific || Custom implementations
| $04 || Absolute devices || Graphics tablet
|-
|-
| $FE || Change address || Special collision resolution
| $05–$07 || Reserved || —
|-
|-
| $FF || Self-test pass || Device diagnostics successful
| $08–$0F || Any other || —
|}
|}


== Hardware Implementation ==
Eight addresses are predefined or reserved, leaving eight available for other device types. This is the whole published table — tables circulating elsewhere that assign $01 to "security dongles" or $0F to a "global polling address" are not Apple's.


=== Host Controllers ===
=== Device Handler IDs ===
Different Apple systems used various ADB controller implementations:
The 8-bit Device Handler ID, together with the default address, is what the ADB Manager uses to decide which device driver to call.<ref name="adbmgr">''Inside Macintosh: Devices'', chapter 5, "ADB Manager", Apple Computer, Inc. — hosted on this wiki as [[:File:Inside Macintosh Devices Chapter 5 ADB Manager.pdf]]. ADB overview; the ADB device table; <code>CountADBs</code>, <code>GetIndADB</code>, <code>GetADBInfo</code>, <code>SetADBInfo</code>, <code>ADBOp</code> and <code>ADBReInit</code>; device handlers installed from <code>'ADBS'</code> resources; and the statement that the Apple Extended Keyboard has Device Handler ID $02 at default address $2.</ref> A device with more than one functional mode changes mode when its driver writes a new Handler ID to register 3 — this is how a mouse is switched from 100 to 200 counts per inch, and how the Apple Extended Keyboard is made to distinguish left from right modifiers.


{| class="wikitable" style="width:80%; text-align:center;"
Apple reserves exactly '''four''' Handler ID values for special functions. Every other value must be assigned by Apple Computer, and unrecognised IDs are ignored:<ref name="gmfh" />
|+'''ADB Controller Implementations'''
 
! System !! Controller Type !! Implementation Details
{| class="wikitable styled-table" style="width:90%;"
|+'''Device Handler IDs reserved for special functions''' (Apple Table 8-17)
! ID !! Function
|-
|-
| Apple IIGS || Custom ASIC || Integrated with Mega II chip
| $FF || As Listen Register 3 data, initiates a self-test in the device
|-
|-
| Macintosh SE || PIC16CR54 || Microchip microcontroller (Apple-branded)
| $FE || As Listen Register 3 data, instructs the device to change its address field to the new address sent by the computer '''if no collision has been detected'''
|-
|-
| Macintosh II/IIx || VIA + transceiver || 6522 VIA with discrete transceiver
| $FD || As Listen Register 3 data, instructs the device to change its address field '''if the activator is pressed'''
|-
|-
| Macintosh IIfx || IOP processor || Dedicated I/O processor
| $00 || As Listen Register 3 data, instructs the device to change the address and enable fields to the new values sent by the computer
|-
|-
| Macintosh Portable || Power Manager || Integrated with PMU chip
| $00 || As data returned to a Talk Register 3 command, indicates that the device '''failed a self-test'''
|-
| PowerBook series || PMU || Power Management Unit integration
|-
| Later Macs || Cuda/Egret || Combined ADB and power management
|}
|}


=== VIA Implementation ===
There is no published registry of handler IDs beyond this. Lists that assign ranges to keyboards, mice, tablets and joysticks are not Apple's and are not reproduced here.
On most 68k Macintoshes, ADB was implemented using:
* '''VIA (Versatile Interface Adapter):''' 6522 chip for CPU interface
* '''Transceiver IC:''' Handles bus electrical interface
* '''State lines (ST0, ST1):''' Define transaction states


Transaction states:
=== Collision detection ===
* '''State 0:''' Even byte from application
Every ADB device must be able to detect collisions. A device waits for a free bus — the bus staying high for the stop-bit-to-start-bit time. If it is trying to bring the bus high and another device forces the line low, or another device starts sending before it can assert its start bit, it has '''lost a collision'''. The loser stops transmitting immediately, preserves the data it was sending, and sets an internal collision flag, which is cleared the next time it transmits successfully.<ref name="gmfh" />
* '''State 1::''' Odd byte from application 
* '''State 2::''' Even byte to application
* '''State 3::''' Odd byte to application


== Standard Devices ==
Because a device could fail to detect a collision with another device running on a nearly identical internal clock, Apple specifies that '''each device should attempt to assert its start bit at a random time''' within the stop-bit-to-start-bit window.<ref name="gmfh" />


=== Keyboards ===
=== Enumeration ===
ADB keyboards implemented two protocols:
At startup the Start Manager sends Talk Register 3 to each address. Where more than one device answers, each device that loses the collision sets its flag and disables its movable-address function. The Start Manager then sends Listen Register 3 to that address with Handler ID '''$FE''' and a new address; only the device that did '''not''' detect a collision moves. This repeats until Talk Register 3 at that address times out, at which point one device is moved back to the default address and the Start Manager moves on.<ref name="gmfh" />


'''Standard Keyboard Protocol:'''
=== The activator ===
* Register 0: Two key events (2 bytes)
An ADB device may have a key or button called an '''activator''', intended for multi-user applications that need to identify and locate individual devices. An application can display a message asking the user to press it; the driver then relocates that device with a Listen Register 3 command carrying Handler ID '''$FD'''.<ref name="gmfh" />
* Each byte: Key code (7 bits) + up/down flag (1 bit)
* Rollover: 2-key guaranteed


'''Extended Keyboard Protocol:'''
=== Polling protocol ===
* Distinguishes left/right modifiers
Once addresses are resolved, the ADB Manager sends Talk Register 0 to address '''$03''' — the default active device, usually the mouse — and the transceiver repeats that command '''every 11 ms'''. The last device to send data becomes the active device and is polled every 11 ms until another device asserts a Service Request.<ref name="gmfh" />
* Handler ID change from $02 to $03
* Additional key codes for extended keys
* Used by Apple Extended Keyboard and later models


=== Mice and Pointing Devices ===
When a Service Request arrives, the transceiver raises an interrupt to the VIA, which sets bit 3 of VIA Data register B to 0. The operating system polls that bit, hands control to the ADB Manager, which sends Talk Register 0 to each device until it finds the one asking for service.<ref name="gmfh" />


'''Standard Mouse Protocol:'''
== Hot-plugging ==
* Register 0: Button state and movement deltas (2 bytes)
* Byte 0: Button (bit 7) + X delta (bits 6-0)
* Byte 1: Button (bit 7) + Y delta (bits 6-0)
* Resolution: 100 counts per inch typical
* Movement range: -64 to +63 per packet


'''Extended Mouse Protocol:'''
Apple's warning is explicit: '''"Do not unplug and reattach an ADB device while the computer is running"''' — if you do, the device reverts to its default address while the computer carries on trying to reach it at the address it was assigned at startup, so it simply stops working until the machine is restarted.<ref name="gmfh" />
* Supports multiple buttons
* Higher precision movement data
* Additional registers for extended features
* Handler ID varies by capability


=== Graphics Tablets ===
Repair experience adds a second reason: on many machines the ADB +5 V feed is protected by a fuse on the logic board, and hot-plugging can open it. The fuse type and rating vary between models and Apple's ADB documentation does not describe it, so check the service documentation for the specific machine rather than assuming a value. Claims of a "1.1 A polyfuse" as a general figure are not supported by any Apple document seen here.
Graphics tablets could operate in two modes:
* '''Relative mode::''' Emulates standard mouse
* '''Absolute mode::''' Reports absolute position
* Required vendor-specific drivers
* No standard protocol defined by Apple


== Limitations and Issues ==
== Apple's Own ADB Devices ==


=== Hot-Swapping ===
=== Apple Standard Mouse ===
While ADB protocol supports hot-swapping, most implementations were unsafe:
A rubber-coated steel ball turns two capstans, each driving a slotted '''interrupter wheel'''. Two beams of infrared light shine through the slots onto two detectors offset just enough to produce two square waves '''90° out of phase''' — the ''interrupt'' signal and the ''quadrature'' signal. The quadrature signal precedes the interrupt signal by 90° when the wheel turns one way and trails it when it turns the other. A microprocessor in the mouse counts the edges and also acts as the mouse's ADB transceiver.<ref name="gmfh" />
* '''Problem::''' No current limiting on ADB ports
* '''Risk::''' Hot-swapping could blow motherboard fuse (typically 1.1A polyfuse)
* '''Exceptions::''' PowerBook G3 "Wall Street" had protected ports
* '''Repair::''' Required fuse replacement or expensive motherboard swap


=== Collision Issues ===
{| class="wikitable styled-table" style="width:70%;"
* Multiple identical devices caused address collisions
|+'''ADB transceiver register 0 in the Apple Standard Mouse''' (Apple Table 8-4)<ref name="gmfh" />
* Resolution process could fail with >3 identical devices
! Bit !! Meaning
* Some devices had non-random address generation
|-
| 15 || Button status; '''0 = down'''
|-
| 14–8 || '''Y''' move counts, two's complement. Negative = up, positive = down
|-
| 7 || '''Not used (always 1)'''
|-
| 6–0 || '''X''' move counts, two's complement. Negative = left, positive = right
|}


=== Performance Limitations ===
The first byte carries '''Y''', not X; the move fields are '''7-bit two's complement''', so the range per report is '''−64 to +63'''; and bit 7 is fixed at 1, not a second button. Resolution is '''100 ±10 counts per inch''' at Device Handler ID $0001 and '''200 ±10''' at $0002; the mouse powers up and resets to $0001.<ref name="gmfh" /> See [[Apple Desktop Bus Mouse]] for the device itself.
* '''Bandwidth::''' Limited to 125 kbit/s theoretical (10-50 kbit/s typical)
* '''Latency::''' Polling-based system introduced input lag
* '''Device limit::''' 16 devices maximum, practically fewer
* '''Cable length::''' 5 meters total maximum


=== Power Limitations ===
=== Apple Standard Keyboard ===
* '''Total power::''' 500mA at 5V for entire bus
{| class="wikitable styled-table" style="width:70%;"
* '''Per device::''' 100mA maximum
|+'''Register 0 in the Apple Standard Keyboard''' (Apple Table 8-7)<ref name="gmfh" />
* '''PowerBooks::''' Reduced to 200mA total on battery
! Bit !! Meaning
|-
| 15 || Key status for first key; 0 = down
|-
| 14–8 || Key code for first key; a 7-bit value
|-
| 7 || Key status for second key; 0 = down
|-
| 6–0 || Key code for second key; a 7-bit value
|}


== Software Support ==
'''Two key events fit in one register-0 read''' — this is the origin of ADB keyboards' 2-key reporting, and it is a property of the register format, not of the switch matrix.


=== ADB Manager ===
{| class="wikitable styled-table" style="width:60%;"
The ADB Manager in Mac OS handled:
|+'''Register 2 in the Apple Standard Keyboard''' (Apple Table 8-8)<ref name="gmfh" />
* Device enumeration and address assignment
! Bit !! Key
* Polling active devices
|-
* Service request handling
| 15 || None (reserved)
* Device handler installation and management
|-
* Register read/write operations
| 14 || Delete
|-
| 13 || Caps Lock
|-
| 12 || Reset
|-
| 11 || Control
|-
| 10 || Shift
|-
| 9 || Option
|-
| 8 || Command
|-
| 7–0 || None (reserved)
|}


Key ADB Manager routines:
A '''0''' indicates that the key is down. Note what register 2 is '''not''': on the Apple Standard Keyboard it carries no LED bits at all. Descriptions giving register 2 a "Compose LED", a "Kana LED" or a "Power LED" are inventions.
* '''ADBOp:''' Perform ADB transaction
* '''ADBReset::''' Reset bus and enumerate devices
* '''SetADBInfo::''' Install device handler
* '''GetADBInfo::''' Query device information
* '''CountADBs::''' Return number of devices


=== System Software Compatibility ===
=== Apple Extended Keyboard ===
* '''Apple IIGS::''' GS/OS with built-in ADB support
The Extended Keyboard uses the same register-0 format and an extended register 2:<ref name="gmfh" />
* '''Mac OS::''' System 3.2 through Mac OS 9.2.2
* '''A/UX::''' Full ADB support in Unix environment
* '''NeXT::''' Limited support on some models
* '''BeOS::''' Third-party drivers available
* '''Linux::''' Kernel support for PowerPC Macs


== Modern Usage and Adapters ==
{| class="wikitable styled-table" style="width:60%;"
|+'''Register 2 in the Apple Extended Keyboard''' (Apple Table 8-11)
! Bit !! Meaning
|-
| 15 || None (reserved)
|-
| 14 || Delete
|-
| 13 || Caps Lock
|-
| 12 || Reset
|-
| 11 || Control
|-
| 10 || Shift
|-
| 9 || Option
|-
| 8 || Command
|-
| 7 || Num Lock / Clear
|-
| 6 || Scroll Lock
|-
| 5–3 || None (reserved)
|-
| 2 || LED 3 (Scroll Lock)
|-
| 1 || LED 2 (Caps Lock)
|-
| 0 || LED 1 (Num Lock)
|}
 
A zero indicates a key is down '''or that an LED is on'''. The three LED bits are the only writable ones, and they are set with a '''Listen Register 2''' command.<ref name="gmfh" />
 
Changing the Extended Keyboard's Device Handler ID in register 3 from '''$0002 to $0003''' makes it generate distinct transition codes for the '''right-hand Option and Control keys''' — those two keys only. This is done with a Listen Register 3 command.<ref name="gmfh" />
 
=== Macintosh Portable ===
The Portable is a special case throughout. Its ADB transceiver function is in the Power Manager IC and keyswitch encoding is done by a separate keyboard processor. Its keyboard is a '''keyswitch matrix only, with no active electronics''' — 63 keyswitches on a steel plate. Its trackball is electrically ADB-compatible but uses a few pins of a large shared connector, with default Handler ID $0001 and the same address as a mouse.<ref name="gmfh" />
 
Apple's warning is worth repeating because it is still a live hazard: '''any input device connected to the Macintosh Portable ADB must be a low-power version.''' Keyboards and mice from other Macintosh models are not usable, and connecting them "could cause an unacceptable decrease in the +5 volt supply voltage and result in improper operation".<ref name="gmfh" />
 
== Software ==
 
The ADB Manager is the part of the Operating System that talks to the bus. Applications normally do not touch it — keyboard and mouse input arrives through the Event Manager.<ref name="adbmgr" />


=== ADB to USB Adapters ===
Its published routines are:<ref name="adbmgr" />
* '''Griffin iMate::''' Original commercial adapter (discontinued)
* '''<code>CountADBs</code>''' — counts entries in the ADB device table.
* '''Wombat::''' Modern bidirectional ADB-USB converter
* '''<code>GetIndADB</code>''' — returns information about a device by its index in the table.
* '''Belkin F5U118::''' Simple ADB to USB adapter
* '''<code>GetADBInfo</code>''' — the same information, by address.
* '''<code>SetADBInfo</code>''' — used by a device handler's installation code to set its own entry.
* '''<code>ADBOp</code>''' — transmits a command byte directly. Always executed asynchronously; if the bus is busy the command is queued.
* '''<code>ADBReInit</code>''' — reinitialises the bus.


=== USB to ADB Adapters ===
Device handlers live in <code>'ADBS'</code> resources in the System file; at startup the Start Manager loads and executes them, reads register 3 in each device, and places each device's default address and Device Handler ID in the ADB device table.<ref name="adbmgr" /> Because <code>GetIndADB</code> and <code>GetADBInfo</code> return the device's '''original''' handler ID and default address, they remain a reliable way to identify what a device is even after enumeration has moved it.
* '''Wombat::''' Allows USB devices on ADB Macs
* '''DIY solutions::''' Arduino-based converters


=== Replacement Controllers ===
== Troubleshooting ==
* '''PIC16F87/88::''' Drop-in replacement for failed SE controllers
* '''Custom ASICs::''' Modern reproductions for restoration


== Legacy and Impact ==
=== Nothing enumerates ===
* '''Measure +5 V at pin 3 against pin 4''' at the port with nothing connected.
* '''Pin 1 should idle high''', held up by the 470 Ω pull-up on the logic board. A pin 1 sitting at 0 V with nothing plugged in is a fault on the computer, not the peripheral; and a bus held low for more than 3 ms is a permanent Global Reset condition.
* Check the ADB fuse on the logic board for the specific machine. Blowing it by hot-plugging is the classic cause.


ADB represented several important innovations:
=== Intermittent device ===
* '''First successful hot-pluggable peripheral bus''' (though implementation issues limited this)
* Check continuity of all four conductors end to end, flexing the cable at the strain relief as you go.
* '''Automatic device enumeration and configuration''' predating USB
* Shorten the chain. Apple recommends no more than three devices per port, and 5 m of cable total.
* '''Low-cost implementation''' enabling affordable peripherals
* Total bus draw must stay under 500 mA; a chain of powered accessories can exceed it.
* '''Power distribution''' through the peripheral bus
* '''Collision detection and resolution''' without user intervention


The protocol influenced later designs:
=== Device works alone but not in a chain ===
* USB adopted similar enumeration concepts
This is usually an address collision that failed to resolve, or a device with a defective collision detector. Disconnect everything else, restart, and add devices back one at a time.
* NeXT used ADB on some models
* Protocol concepts influenced FireWire development
* Demonstrated viability of serial peripheral buses


== Technical Documentation ==
=== With an oscilloscope ===
* Look for the '''800 µs Attention''' pulse followed by the '''65 µs Sync''' high.
* Look for the device answering within '''260 µs''' of a Talk command.
* In the idle state you should see the last Talk command repeat '''every 11 ms'''. If the host is transmitting and the device never answers, the fault is in the device; if the host is not transmitting at all, it is not.


=== Patents ===
== Adapters and Modern Use ==
Key Apple patents related to ADB:
* 4,875,158 - Method for requesting service by a device
* 4,910,655 - Apparatus for transferring signals and data
* 4,912,627 - Method for storing information
* 4,918,598 - Method for selectively activating and deactivating devices


=== Developer Resources ===
ADB-to-USB conversion is the usual route to using these devices today. Commercial adapters of the period (notably Griffin's iMate) are long discontinued, and community-built converters come and go. This page does not endorse a particular one; check current sources before buying, and check that whatever you find implements the timing in the table above rather than approximating it.
* '''Inside Macintosh: Devices''' - Complete ADB programming guide
* '''Technical Note HW01''' - "ADB - The Untold Story: Space Aliens Ate My Mouse"
* '''Guide to Macintosh Family Hardware''' - Hardware specifications


== Common ADB Devices ==
== Not to be confused with AppleTalk ==


=== Apple Devices ===
ADB and AppleTalk are different buses with different failure modes, and the wiki holds Apple's own
* [[Apple Keyboard]] (M0116)
material on the AppleTalk side. Apple's '''Macintosh Office (AppleTalk) Technical Procedures''',
* [[Apple Extended Keyboard]] (M0115)
bound into the binder described at
* [[Apple Extended Keyboard II]] (M3501)
[[Service Support Tranning Programs Laserwriter Technical Procedures Jan 1985]], troubleshoots a
* [[Apple Adjustable Keyboard]] (M1242)
LocalTalk network by flowchart — ONE NODE, TWO OR MORE BUT NOT ALL, ALL NODES, FIRST NODE and
* [[AppleDesign Keyboard]] (M2980)
RARE CASE — and its appendix explains '''bus termination problems''', why '''noisy nodes''' break
* [[Apple Desktop Bus Mouse]] (A9M0331/G5431/M0142)
the bus, cable impedance, '''dangling cables''' and '''circular networks'''. Apple notes there that
* [[Apple Desktop Bus Mouse II]] (M2706)
the AppleTalk bus conforms to the EIA electrical interface specification.<ref name="lwtp85">Apple Computer, ''Apple LaserWriter Printer Technical Procedures'', preliminary version for internal use only, sections stamped rev. Jan 85 and rev. Feb 85. Held on this wiki inside the Service Support Training Programs binder scan, described at [[Service Support Tranning Programs Laserwriter Technical Procedures Jan 1985]] ([[:File:Service_Support_Tranning_Programs_Laserwriter_Technical_Procedures_Jan_1985.pdf]]).</ref>
* Graphics tablets (various models)


=== Third-Party Devices ===
For the programming side of AppleTalk rather than the wiring, see
* Kensington TurboMouse trackballs
[[Programming with AppleTalk 1991]]; it contains no electrical data.
* Gravis GamePad and MouseStick
* Wacom ArtZ graphics tablets
* CalComp DrawingBoard tablets
* CoStar LabelWriter printers
* Hardware copy-protection dongles
* Modems and telecommunications devices


== Troubleshooting ==
== See Also ==
* [[Apple Desktop Bus Keyboard]]
* [[Apple Desktop Bus Mouse]]
* [[Apple Desktop Bus Mouse II]]
* [[Apple Extended Keyboard II]]
* [[Apple IIGS]]


=== Common Problems ===
== References ==
{| class="wikitable" style="width:80%; text-align:center;"
|+'''ADB Troubleshooting Guide'''
! Problem !! Possible Cause !! Solution
|-
| No devices recognized || Blown ADB fuse || Replace fuse or motherboard repair
|-
| Intermittent device || Damaged cable || Check continuity, replace if needed
|-
| Device not found || Address collision || Disconnect other devices, restart
|-
| Erratic behavior || Bus termination issue || Check cable length (<5m total)
|-
| Power issues || Overloaded bus || Remove devices, check power draw
|-
| Random disconnects || Failing transceiver || Replace ADB controller
|}


=== Diagnostic Tools ===
<references />
* '''ADB Parser::''' Classic Mac OS tool for bus analysis
* '''TechTool::''' Hardware diagnostic suite
* '''MacsBug::''' Low-level debugging access to ADB


[[Category:Vintage Apple Computers]]
[[Categroy:Apple Vintage Accessories]]
[[Category:Apple Desktop Bus]]
[[Category:Apple Desktop Bus]]
[[Category:Apple Vintage Computers]]
[[Category:Apple Vintage Accessories]]

Latest revision as of 08:46, 27 September 2026

Apple Desktop Bus
ADB connector (female socket)
Type Computer peripheral interface
Designer Apple Computer
Design date 1985-1986
Manufacturer Apple Computer
Production 1986-1999
Superseded USB
External Yes
Hot-pluggable No - Apple's documentation warns against it
Cable 4-conductor shielded, 5 m maximum
Pins 4
Connector Mini-DIN 4 (same shell as S-Video)
Electrical Single data line, open collector, 470 ohm pull-up
Maximum devices 16 addressable; more than 3 per port not recommended
Protocol Serial, self-clocking, single-master
Data signal Bidirectional serial
Data rate ~10 kbit/s (100 us bit cell)
Style Serial

The Apple Desktop Bus (ADB) is Apple's single-master, multislave bit-serial bus for low-speed input devices — keyboards, mice, graphics tablets and the like. Apple describes it as connecting "up to 16 low-speed input devices".[1] It was introduced on the Apple IIGS in September 1986 and carried across the Macintosh line from the Macintosh SE and Macintosh II in 1987 until USB replaced it at the end of the 1990s.

On most Macintosh models the bus hardware is three things: an ADB transceiver IC — which Apple describes as a 4-bit microcontroller — that drives the bus and reads device status; the VIA, which is how the CPU talks to the transceiver; and two 4-pin ADB connectors wired in parallel on the rear panel. The Macintosh Portable is the exception: there the Power Manager IC performs the transceiver function, and the Macintosh IIfx uses the IOP custom IC instead.[1]

Physical Interface

[edit | edit source]

Connector

[edit | edit source]
ADB connector signal assignments[1]
Pin Signal Description
1 ADB Bidirectional data bus, used for input and output. Open-collector, pulled up to +5 V through a 470 Ω resistor on the computer's main logic board
2 POWER.ON On the Macintosh II family, a key on the ADB keyboard momentarily grounds this pin to pin 4 to switch on the power supply. On other models this pin is not connected
3 +5 V +5 volts
4 GND Ground

Pin 2 is POWER.ON, not "PSW"; it is a momentary ground path to pin 4, not a "direct connection to the power supply".

The shell is the same 4-pin mini-DIN used for S-Video, which is why S-Video cables get pressed into service. Do not: some S-Video cables bridge or omit conductors, and the pin functions do not correspond.

Electrical characteristics

[edit | edit source]
ADB transceiver electrical characteristics[1]
Parameter Minimum Maximum
Low input signal voltage −0.2 V 0.8 V
High input signal voltage 2.4 V 5.0 V
Low output signal voltage — 0.45 V (at 12 mA)
High output signal voltage 2.4 V —
Device output current when off — −20 µA (at 0.4 V)
Device input capacitance — 150 pF

Apple gives no rise-time or fall-time figure, and no per-device current limit. What it does give is a bus total: "ADB devices may use the +5 volts supplied by the bus, but all the ADB devices combined must not draw more than a total of 500 mA."[1] A widely repeated "100 mA per device maximum" does not appear in Apple's documentation and is not reproduced here.

Cable and chain length

[edit | edit source]

Cables should be no longer than 5 metres, and cable capacitance should not exceed 100 picofarads per metre.[1] On device count Apple is blunt: "Although the ADB transceiver is capable of addressing up to 16 different peripheral devices, daisy-chaining more than 3 devices on one ADB port is not recommended because of connector resistance and signal degradation."[1] Long chains and cheap extension leads are a real cause of intermittent mice and keyboards.

Protocol

[edit | edit source]

Bit cells

[edit | edit source]

Each command or data bit is encoded as a bit cell: a low voltage on the bus, a rising edge, a high voltage, and a final falling edge. A 0 is distinguished from a 1 by the relative length of the low time. Every command and data packet ends with a stop bit — a 0 bit with the same low time as any other 0, but which does not necessarily have a second falling edge.[1]

ADB timing specifications (Apple Table 8-14)[1]
Parameter Nominal Host tolerance Device tolerance
Bit-cell time 100 µs ±3% ±30%
"0" low time 65 µs 65% of bit-cell time ±5% 65% of bit-cell time ±5%
"1" low time 35 µs 35% of bit-cell time ±5% 35% of bit-cell time ±5%
Attention low time 800 µs ±3% —
Sync high time 65 µs ±3% —
Stop bit low time 70 µs ±3% ±30%
Global Reset low time 3 ms 3 ms minimum 3 ms minimum
Service Request low time 300 µs — ±30%
Stop-bit-to-start-bit time 200 µs 140 µs min, 260 µs max 140 µs min, 260 µs max

Two things about this table are easy to get wrong. Sync is 65 µs high and the stop bit is 70 µs low — several online summaries transpose them. And the bit cell is 100 µs, so the bus runs at roughly 10 kbit/s. A figure of "125 kbit/s theoretical" circulates widely; it does not follow from Apple's own timing table and is not used here.

Transactions

[edit | edit source]

A transaction is a command sent by the computer followed by a data packet sent by either the computer or the device.[1]

  • A command consists of an Attention signal, a Sync signal, one command byte, and one stop bit.
  • A data packet consists of a start bit, two to eight 8-bit data bytes, and one stop bit.

Command byte

[edit | edit source]

Every command byte is a 4-bit device address, a 2-bit command code and a 2-bit register code. There are four commands, not six:[1]

ADB command byte syntax (Apple Table 8-13)
Bits 7–4 (address) Bits 3–2 (command) Bits 1–0 (register) Command
x x x x 0 0 0 0 SendReset
A3 A2 A1 A0 0 0 0 1 Flush
x x x x 0 0 1 0 Reserved
x x x x 0 0 1 1 Reserved
x x x x 0 1 x x Reserved
A3 A2 A1 A0 1 0 r1 r0 Listen
A3 A2 A1 A0 1 1 r1 r0 Talk
  • Talk reads a register. The device must respond with data within 260 µs or the computer takes the bus back. A device with nothing to say simply times out — except that it must respond to Talk Register 3.
  • Listen writes a register.
  • SendReset returns every device on the bus to its power-on state, clearing pending service requests.
  • Flush is defined per device; normally it clears internal registers, losing anything buffered such as type-ahead characters.

The commands with command code 01 are reserved by Apple for future expansion, and nothing should use them.[1]

Signals

[edit | edit source]

Four global signals are not addressed to any device. Attention, Sync and Global Reset are always generated by the computer; Service Request is always generated by a device.[1]

  • Attention — a long low that marks the start of every command, followed by a short high Sync pulse that establishes the timing of the bits that follow.
  • Global Reset — if the bus stays low for at least 3.0 ms, every device interprets it as a Global Reset, releases the bus and resets itself. A bus stuck low is therefore a permanent reset condition and nothing will enumerate.
  • Service Request — a device that is not the active device and has data to send waits until the end of a command and then holds the bus low for 140 to 260 µs, lengthening the stop bit.

The second defined error condition is a transaction that never finishes: if the bus stays high beyond the maximum bit-cell time, all devices ignore the command and wait for a new Attention signal.[1]

Transaction states

[edit | edit source]

Two lines from the VIA to the transceiver, ST0 and ST1, define the transaction state:[1]

ADB transaction states (Apple Table 8-12)
ST1 ST0 State
0 0 0: start a new command
0 1 1: transfer data byte (even)
1 0 2: transfer data byte (odd)
1 1 3: idle

State 3 is where the bus spends most of its life, and it is the key to understanding ADB latency: in the idle state the ADB transceiver automatically repeats the last Talk command every 11 ms. The default transaction state on startup or reset is 3.[1]

Device Registers

[edit | edit source]

An ADB device may have up to four registers, each 2 to 8 bytes.[1]

  • Register 0 — the data register. When the ADB Manager polls to find which device asserted a Service Request it sends Talk Register 0 to each device in turn, so a device must have data in register 0 when it requires service, even if the interesting data is elsewhere.
  • Register 1 — device-specific; the device may use it for anything.
  • Register 2 — device-specific. On Apple keyboards it carries modifier-key status (and, on the Extended Keyboard, the lock LEDs).
  • Register 3 — status and identification.
Bits in device register 3 (Apple Table 8-15)[1]
Bit Description
15 Reserved; must be 0
14 Exceptional event, device specific; always 1 if not used
13 Service Request enable; 1 = enabled
12 Reserved; must be 0
11–8 Device address
7–0 Device Handler ID

A device's ability to raise a Service Request can be switched off by clearing bit 13 with a Listen Register 3 command carrying Device Handler ID $00. Apple suggests this to improve service-request response time when several devices are on the bus and not all of them matter to the application in hand.[1]

Addressing and Enumeration

[edit | edit source]

Default addresses

[edit | edit source]
ADB device addresses (Apple Table 8-16)[1]
Address Device type Example
$00–$01 Reserved —
$02 Encoded devices Keyboard
$03 Relative devices Mouse
$04 Absolute devices Graphics tablet
$05–$07 Reserved —
$08–$0F Any other —

Eight addresses are predefined or reserved, leaving eight available for other device types. This is the whole published table — tables circulating elsewhere that assign $01 to "security dongles" or $0F to a "global polling address" are not Apple's.

Device Handler IDs

[edit | edit source]

The 8-bit Device Handler ID, together with the default address, is what the ADB Manager uses to decide which device driver to call.[2] A device with more than one functional mode changes mode when its driver writes a new Handler ID to register 3 — this is how a mouse is switched from 100 to 200 counts per inch, and how the Apple Extended Keyboard is made to distinguish left from right modifiers.

Apple reserves exactly four Handler ID values for special functions. Every other value must be assigned by Apple Computer, and unrecognised IDs are ignored:[1]

Device Handler IDs reserved for special functions (Apple Table 8-17)
ID Function
$FF As Listen Register 3 data, initiates a self-test in the device
$FE As Listen Register 3 data, instructs the device to change its address field to the new address sent by the computer if no collision has been detected
$FD As Listen Register 3 data, instructs the device to change its address field if the activator is pressed
$00 As Listen Register 3 data, instructs the device to change the address and enable fields to the new values sent by the computer
$00 As data returned to a Talk Register 3 command, indicates that the device failed a self-test

There is no published registry of handler IDs beyond this. Lists that assign ranges to keyboards, mice, tablets and joysticks are not Apple's and are not reproduced here.

Collision detection

[edit | edit source]

Every ADB device must be able to detect collisions. A device waits for a free bus — the bus staying high for the stop-bit-to-start-bit time. If it is trying to bring the bus high and another device forces the line low, or another device starts sending before it can assert its start bit, it has lost a collision. The loser stops transmitting immediately, preserves the data it was sending, and sets an internal collision flag, which is cleared the next time it transmits successfully.[1]

Because a device could fail to detect a collision with another device running on a nearly identical internal clock, Apple specifies that each device should attempt to assert its start bit at a random time within the stop-bit-to-start-bit window.[1]

Enumeration

[edit | edit source]

At startup the Start Manager sends Talk Register 3 to each address. Where more than one device answers, each device that loses the collision sets its flag and disables its movable-address function. The Start Manager then sends Listen Register 3 to that address with Handler ID $FE and a new address; only the device that did not detect a collision moves. This repeats until Talk Register 3 at that address times out, at which point one device is moved back to the default address and the Start Manager moves on.[1]

The activator

[edit | edit source]

An ADB device may have a key or button called an activator, intended for multi-user applications that need to identify and locate individual devices. An application can display a message asking the user to press it; the driver then relocates that device with a Listen Register 3 command carrying Handler ID $FD.[1]

Polling protocol

[edit | edit source]

Once addresses are resolved, the ADB Manager sends Talk Register 0 to address $03 — the default active device, usually the mouse — and the transceiver repeats that command every 11 ms. The last device to send data becomes the active device and is polled every 11 ms until another device asserts a Service Request.[1]

When a Service Request arrives, the transceiver raises an interrupt to the VIA, which sets bit 3 of VIA Data register B to 0. The operating system polls that bit, hands control to the ADB Manager, which sends Talk Register 0 to each device until it finds the one asking for service.[1]

Hot-plugging

[edit | edit source]

Apple's warning is explicit: "Do not unplug and reattach an ADB device while the computer is running" — if you do, the device reverts to its default address while the computer carries on trying to reach it at the address it was assigned at startup, so it simply stops working until the machine is restarted.[1]

Repair experience adds a second reason: on many machines the ADB +5 V feed is protected by a fuse on the logic board, and hot-plugging can open it. The fuse type and rating vary between models and Apple's ADB documentation does not describe it, so check the service documentation for the specific machine rather than assuming a value. Claims of a "1.1 A polyfuse" as a general figure are not supported by any Apple document seen here.

Apple's Own ADB Devices

[edit | edit source]

Apple Standard Mouse

[edit | edit source]

A rubber-coated steel ball turns two capstans, each driving a slotted interrupter wheel. Two beams of infrared light shine through the slots onto two detectors offset just enough to produce two square waves 90° out of phase — the interrupt signal and the quadrature signal. The quadrature signal precedes the interrupt signal by 90° when the wheel turns one way and trails it when it turns the other. A microprocessor in the mouse counts the edges and also acts as the mouse's ADB transceiver.[1]

ADB transceiver register 0 in the Apple Standard Mouse (Apple Table 8-4)[1]
Bit Meaning
15 Button status; 0 = down
14–8 Y move counts, two's complement. Negative = up, positive = down
7 Not used (always 1)
6–0 X move counts, two's complement. Negative = left, positive = right

The first byte carries Y, not X; the move fields are 7-bit two's complement, so the range per report is −64 to +63; and bit 7 is fixed at 1, not a second button. Resolution is 100 ±10 counts per inch at Device Handler ID $0001 and 200 ±10 at $0002; the mouse powers up and resets to $0001.[1] See Apple Desktop Bus Mouse for the device itself.

Apple Standard Keyboard

[edit | edit source]
Register 0 in the Apple Standard Keyboard (Apple Table 8-7)[1]
Bit Meaning
15 Key status for first key; 0 = down
14–8 Key code for first key; a 7-bit value
7 Key status for second key; 0 = down
6–0 Key code for second key; a 7-bit value

Two key events fit in one register-0 read — this is the origin of ADB keyboards' 2-key reporting, and it is a property of the register format, not of the switch matrix.

Register 2 in the Apple Standard Keyboard (Apple Table 8-8)[1]
Bit Key
15 None (reserved)
14 Delete
13 Caps Lock
12 Reset
11 Control
10 Shift
9 Option
8 Command
7–0 None (reserved)

A 0 indicates that the key is down. Note what register 2 is not: on the Apple Standard Keyboard it carries no LED bits at all. Descriptions giving register 2 a "Compose LED", a "Kana LED" or a "Power LED" are inventions.

Apple Extended Keyboard

[edit | edit source]

The Extended Keyboard uses the same register-0 format and an extended register 2:[1]

Register 2 in the Apple Extended Keyboard (Apple Table 8-11)
Bit Meaning
15 None (reserved)
14 Delete
13 Caps Lock
12 Reset
11 Control
10 Shift
9 Option
8 Command
7 Num Lock / Clear
6 Scroll Lock
5–3 None (reserved)
2 LED 3 (Scroll Lock)
1 LED 2 (Caps Lock)
0 LED 1 (Num Lock)

A zero indicates a key is down or that an LED is on. The three LED bits are the only writable ones, and they are set with a Listen Register 2 command.[1]

Changing the Extended Keyboard's Device Handler ID in register 3 from $0002 to $0003 makes it generate distinct transition codes for the right-hand Option and Control keys — those two keys only. This is done with a Listen Register 3 command.[1]

Macintosh Portable

[edit | edit source]

The Portable is a special case throughout. Its ADB transceiver function is in the Power Manager IC and keyswitch encoding is done by a separate keyboard processor. Its keyboard is a keyswitch matrix only, with no active electronics — 63 keyswitches on a steel plate. Its trackball is electrically ADB-compatible but uses a few pins of a large shared connector, with default Handler ID $0001 and the same address as a mouse.[1]

Apple's warning is worth repeating because it is still a live hazard: any input device connected to the Macintosh Portable ADB must be a low-power version. Keyboards and mice from other Macintosh models are not usable, and connecting them "could cause an unacceptable decrease in the +5 volt supply voltage and result in improper operation".[1]

Software

[edit | edit source]

The ADB Manager is the part of the Operating System that talks to the bus. Applications normally do not touch it — keyboard and mouse input arrives through the Event Manager.[2]

Its published routines are:[2]

  • CountADBs — counts entries in the ADB device table.
  • GetIndADB — returns information about a device by its index in the table.
  • GetADBInfo — the same information, by address.
  • SetADBInfo — used by a device handler's installation code to set its own entry.
  • ADBOp — transmits a command byte directly. Always executed asynchronously; if the bus is busy the command is queued.
  • ADBReInit — reinitialises the bus.

Device handlers live in 'ADBS' resources in the System file; at startup the Start Manager loads and executes them, reads register 3 in each device, and places each device's default address and Device Handler ID in the ADB device table.[2] Because GetIndADB and GetADBInfo return the device's original handler ID and default address, they remain a reliable way to identify what a device is even after enumeration has moved it.

Troubleshooting

[edit | edit source]

Nothing enumerates

[edit | edit source]
  • Measure +5 V at pin 3 against pin 4 at the port with nothing connected.
  • Pin 1 should idle high, held up by the 470 Ω pull-up on the logic board. A pin 1 sitting at 0 V with nothing plugged in is a fault on the computer, not the peripheral; and a bus held low for more than 3 ms is a permanent Global Reset condition.
  • Check the ADB fuse on the logic board for the specific machine. Blowing it by hot-plugging is the classic cause.

Intermittent device

[edit | edit source]
  • Check continuity of all four conductors end to end, flexing the cable at the strain relief as you go.
  • Shorten the chain. Apple recommends no more than three devices per port, and 5 m of cable total.
  • Total bus draw must stay under 500 mA; a chain of powered accessories can exceed it.

Device works alone but not in a chain

[edit | edit source]

This is usually an address collision that failed to resolve, or a device with a defective collision detector. Disconnect everything else, restart, and add devices back one at a time.

With an oscilloscope

[edit | edit source]
  • Look for the 800 µs Attention pulse followed by the 65 µs Sync high.
  • Look for the device answering within 260 µs of a Talk command.
  • In the idle state you should see the last Talk command repeat every 11 ms. If the host is transmitting and the device never answers, the fault is in the device; if the host is not transmitting at all, it is not.

Adapters and Modern Use

[edit | edit source]

ADB-to-USB conversion is the usual route to using these devices today. Commercial adapters of the period (notably Griffin's iMate) are long discontinued, and community-built converters come and go. This page does not endorse a particular one; check current sources before buying, and check that whatever you find implements the timing in the table above rather than approximating it.

Not to be confused with AppleTalk

[edit | edit source]

ADB and AppleTalk are different buses with different failure modes, and the wiki holds Apple's own material on the AppleTalk side. Apple's Macintosh Office (AppleTalk) Technical Procedures, bound into the binder described at Service Support Tranning Programs Laserwriter Technical Procedures Jan 1985, troubleshoots a LocalTalk network by flowchart — ONE NODE, TWO OR MORE BUT NOT ALL, ALL NODES, FIRST NODE and RARE CASE — and its appendix explains bus termination problems, why noisy nodes break the bus, cable impedance, dangling cables and circular networks. Apple notes there that the AppleTalk bus conforms to the EIA electrical interface specification.[3]

For the programming side of AppleTalk rather than the wiring, see Programming with AppleTalk 1991; it contains no electrical data.

See Also

[edit | edit source]

References

[edit | edit source]
  1. ↑ 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 1.30 1.31 1.32 1.33 1.34 1.35 1.36 1.37 Guide to the Macintosh Family Hardware, second edition, Apple Computer, Inc. / Addison-Wesley, 1990 — hosted on this wiki as File:Apple Guide to the Macintosh Family Hardware 2nd Edition 1990.pdf. Chapter 8, "Apple Desktop Bus", pages 287–326: bus overview (single-master multislave, up to 16 devices, ADB transceiver IC described as a 4-bit microcontroller, two connectors wired in parallel, four-conductor shielded cable, the warning against unplugging a device while the computer is running, the 500 mA total bus limit, the 5 m cable length and 100 pF/m capacitance limits, and the note that daisy-chaining more than three devices on one port is not recommended); Table 8-1 connector signal assignments; Table 8-2 transceiver electrical characteristics; Table 8-4 register 0 in the Apple Standard Mouse and the accompanying note on 100 ±10 and 200 ±10 counts per inch; Tables 8-7 and 8-8 registers 0 and 2 in the Apple Standard Keyboard; Tables 8-10 and 8-11 registers 0 and 2 in the Apple Extended Keyboard; Table 8-12 transaction states; Table 8-13 command byte syntax; Table 8-14 the full timing specification; Table 8-15 device register 3; Table 8-16 device addresses; Table 8-17 reserved Device Handler IDs; the collision-detection, polling (11 ms) and error-condition sections. Chapter 9, "Floppy Disk Interfaces", is the source for the floppy-drive material.
  2. ↑ 2.0 2.1 2.2 2.3 Inside Macintosh: Devices, chapter 5, "ADB Manager", Apple Computer, Inc. — hosted on this wiki as File:Inside Macintosh Devices Chapter 5 ADB Manager.pdf. ADB overview; the ADB device table; CountADBs, GetIndADB, GetADBInfo, SetADBInfo, ADBOp and ADBReInit; device handlers installed from 'ADBS' resources; and the statement that the Apple Extended Keyboard has Device Handler ID $02 at default address $2.
  3. ↑ Apple Computer, Apple LaserWriter Printer Technical Procedures, preliminary version for internal use only, sections stamped rev. Jan 85 and rev. Feb 85. Held on this wiki inside the Service Support Training Programs binder scan, described at Service Support Tranning Programs Laserwriter Technical Procedures Jan 1985 (File:Service_Support_Tranning_Programs_Laserwriter_Technical_Procedures_Jan_1985.pdf).