Apple Desktop Bus
| Apple Desktop Bus | |
|---|---|
| ADB connector (female socket) | |
| Type | Computer peripheral interface |
| Designer | Steve Wozniak |
| Design date | 1985-1986 |
| Manufacturer | Apple Computer |
| Production | 1986-1999 |
| Superseded | USB |
| External | Yes |
| Hot-pluggable | Technically capable but not recommended |
| Cable | 4-conductor shielded |
| Pins | 4 |
| Connector | Mini-DIN 4 (same as S-Video) |
| Electrical | Single data line, open collector |
| Maximum devices | 16 |
| Protocol | Serial, self-clocking |
| Data signal | Bidirectional serial |
| Data rate | 10-125 kbit/s |
| Style | Serial |
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.
History and Development
[edit | edit source]Origins
[edit | edit source]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.
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.
Implementation Timeline
[edit | edit source]- 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
[edit | edit source]Physical Interface
[edit | edit source]| Pin | Signal | Description | Specifications |
|---|---|---|---|
| 1 | ADB Data | Bidirectional serial data | Open collector, 5V pull-up |
| 2 | PSW | Power switch | Direct connection to power supply |
| 3 | +5V | Power supply | 500mA total, 100mA per device max |
| 4 | GND | Ground reference | Common ground |
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.
Electrical Characteristics
[edit | edit source]- Bus topology: Multi-drop, daisy-chain capable
- 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
[edit | edit source]Bit Encoding
[edit | edit source]ADB uses self-clocking duty-cycle modulation where each bit period is 100μs:
- 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
[edit | edit source]Each ADB transaction consists of:
- Attention signal: Host pulls bus low for 800μs
- 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
[edit | edit source]Commands are 8 bits structured as:
- Bits 7-4: Device address (0-15)
- Bits 3-2: Command type
- Bits 1-0: Register number
| Command | Binary | Description | Action |
|---|---|---|---|
| SendReset | 00 | System reset | All devices reset to default state |
| Flush | 01 | Flush device | Clear device buffer for specified register |
| Reserved | 10 | Reserved | Not used |
| Reserved | 11 | Reserved | Not used |
| Listen | 10 | Write to device | Host sends data to device register |
| Talk | 11 | Read from device | Device sends register contents to host |
Device Registers
[edit | edit source]Each ADB device implements four registers:
| Register | Purpose | Size | Description |
|---|---|---|---|
| 0 | Device data | 2-8 bytes | Primary data (keyboard keys, mouse movement) |
| 1 | Device-specific | Variable | Extended features or configuration |
| 2 | Device-specific | Variable | Additional features (e.g., keyboard LEDs) |
| 3 | Status/Command | 2 bytes | Device ID, address, and handler ID |
Register 3 Format
[edit | edit source]Register 3 contains device identification and configuration:
- Bits 15-8: Exceptional event flags (device-specific)
- Bits 7-0: Device handler ID
- Bits 11-8: Device address (when read)
- Service Request Enable: Bit 13
Device Addressing and Enumeration
[edit | edit source]Default Addresses
[edit | edit source]| Address | Device Type | Notes |
|---|---|---|
| $0 | Reserved | SendReset command |
| $1 | Security dongles | Copy protection devices |
| $2 | Keyboards | All keyboards default to this |
| $3 | Mice/Pointing devices | Mice, trackballs, trackpads |
| $4 | Graphics tablets | Absolute positioning devices |
| $5 | Reserved | Vendor-specific |
| $6 | Reserved | Vendor-specific |
| $7 | Reserved | Vendor-specific |
| $8-$E | Relocated devices | Collision resolution addresses |
| $F | Reserved | Global polling address |
Enumeration Process
[edit | edit source]The ADB Manager performs device enumeration at startup:
- Reset: SendReset command clears all devices
- 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
[edit | edit source]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
[edit | edit source]Device handlers define how the host interprets device data. Standard handler IDs include:
| Handler ID | Device Type | Description |
|---|---|---|
| $00 | Self-test fail | Device failed internal diagnostics |
| $01 | Standard mouse | 100 CPI relative positioning |
| $02 | Standard keyboard | Original keyboard protocol |
| $03 | Extended keyboard | Supports extended key codes |
| $04 | ISO keyboard | International layout support |
| $05-$07 | Reserved keyboards | Vendor-specific |
| $08-$0F | Reserved mice | Vendor-specific |
| $10-$1F | Graphics tablets | Absolute positioning devices |
| $20-$2F | Other devices | Joysticks, special controllers |
| $30-$FD | Vendor-specific | Custom implementations |
| $FE | Change address | Special collision resolution |
| $FF | Self-test pass | Device diagnostics successful |
Hardware Implementation
[edit | edit source]Host Controllers
[edit | edit source]Different Apple systems used various ADB controller implementations:
| System | Controller Type | Implementation Details |
|---|---|---|
| Apple IIGS | Custom ASIC | Integrated with Mega II chip |
| Macintosh SE | PIC16CR54 | Microchip microcontroller (Apple-branded) |
| Macintosh II/IIx | VIA + transceiver | 6522 VIA with discrete transceiver |
| Macintosh IIfx | IOP processor | Dedicated I/O processor |
| Macintosh Portable | Power Manager | Integrated with PMU chip |
| PowerBook series | PMU | Power Management Unit integration |
| Later Macs | Cuda/Egret | Combined ADB and power management |
VIA Implementation
[edit | edit source]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:
- State 0: Even byte from application
- State 1:: Odd byte from application
- State 2:: Even byte to application
- State 3:: Odd byte to application
Standard Devices
[edit | edit source]Keyboards
[edit | edit source]ADB keyboards implemented two protocols:
Standard Keyboard Protocol:
- Register 0: Two key events (2 bytes)
- Each byte: Key code (7 bits) + up/down flag (1 bit)
- Rollover: 2-key guaranteed
Extended Keyboard Protocol:
- Distinguishes left/right modifiers
- 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
[edit | edit source]Standard Mouse Protocol:
- 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:
- Supports multiple buttons
- Higher precision movement data
- Additional registers for extended features
- Handler ID varies by capability
Graphics Tablets
[edit | edit source]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
[edit | edit source]Hot-Swapping
[edit | edit source]While ADB protocol supports hot-swapping, most implementations were unsafe:
- 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
[edit | edit source]- Multiple identical devices caused address collisions
- Resolution process could fail with >3 identical devices
- Some devices had non-random address generation
Performance Limitations
[edit | edit source]- 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
[edit | edit source]- Total power:: 500mA at 5V for entire bus
- Per device:: 100mA maximum
- PowerBooks:: Reduced to 200mA total on battery
Software Support
[edit | edit source]ADB Manager
[edit | edit source]The ADB Manager in Mac OS handled:
- Device enumeration and address assignment
- Polling active devices
- Service request handling
- Device handler installation and management
- Register read/write operations
Key ADB Manager routines:
- 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
[edit | edit source]- Apple IIGS:: GS/OS with built-in ADB support
- 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
[edit | edit source]ADB to USB Adapters
[edit | edit source]- Griffin iMate: Original commercial adapter (discontinued)
- Wombat: Modern bidirectional ADB-USB converter
- Belkin F5U118: Simple ADB to USB adapter
USB to ADB Adapters
[edit | edit source]- Wombat: Allows USB devices on ADB Macs
- DIY solutions: Arduino-based converters
Replacement Controllers
[edit | edit source]- PIC16F87/88: Drop-in replacement for failed SE controllers
- Custom ASICs: Modern reproductions for restoration
Legacy and Impact
[edit | edit source]ADB represented several important innovations:
- First successful hot-pluggable peripheral bus (though implementation issues limited this)
- Automatic device enumeration and configuration predating USB
- Low-cost implementation enabling affordable peripherals
- Power distribution through the peripheral bus
- Collision detection and resolution without user intervention
The protocol influenced later designs:
- USB adopted similar enumeration concepts
- NeXT used ADB on some models
- Protocol concepts influenced FireWire development
- Demonstrated viability of serial peripheral buses
Technical Documentation
[edit | edit source]Patents
[edit | edit source]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
[edit | edit source]- 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
[edit | edit source]Apple Devices
[edit | edit source]- Apple Keyboard (M0116)
- Apple Extended Keyboard (M0115)
- Apple Extended Keyboard II (M3501)
- Apple Adjustable Keyboard (M1242)
- AppleDesign Keyboard (M2980)
- Apple Desktop Bus Mouse (A9M0331/G5431/M0142)
- Apple Desktop Bus Mouse II (M2706)
- Graphics tablets (various models)
Third-Party Devices
[edit | edit source]- Kensington TurboMouse trackballs
- Gravis GamePad and MouseStick
- Wacom ArtZ graphics tablets
- CalComp DrawingBoard tablets
- CoStar LabelWriter printers
- Hardware copy-protection dongles
- Modems and telecommunications devices
Protocol Details
[edit | edit source]Complete Timing Specifications
[edit | edit source]The ADB protocol operates with precise timing requirements for all signal transitions:
| Signal Type | Duration | Tolerance | Description |
|---|---|---|---|
| Reset pulse | 3000 μs | Minimum | Host pulls bus low for 3 ms or more to reset all devices |
| Attention | 800 μs | ±3% | Host pulls bus low to initiate transaction |
| Sync | 70 μs | ±10% | Bus high between attention and command |
| Bit cell (total) | 100 μs | ±3% | Total time for one bit transmission |
| Logic 0 low time | 65 μs | ±3% | Low portion of logic 0 bit cell |
| Logic 0 high time | 35 μs | ±3% | High portion of logic 0 bit cell |
| Logic 1 low time | 35 μs | ±3% | Low portion of logic 1 bit cell |
| Logic 1 high time | 65 μs | ±3% | High portion of logic 1 bit cell |
| Stop bit | 0 | Always | Stop bit is always logic 0 |
| Service Request | 300 μs | Minimum | Device extends stop bit low to assert SRQ |
| Tlt (Stop-to-start) | 140-260 μs | Range | Bus high between command and data |
| SRQ detection window | 65-300 μs | Range | Period when devices can assert service request |
Transaction State Machine
[edit | edit source]Each ADB transaction follows a structured sequence:
- Idle State: Bus remains high, devices wait for attention signal
- Attention Phase: Host pulls bus low for 800 μs
- Sync Phase: Bus high for 70 μs
- Command Transmission: 8 command bits + stop bit
- Service Request Window: Devices can assert SRQ during stop bit low time
- Tlt Period: Bus high for 140-260 μs
- Data Transfer: Start bit + 2-8 data bytes + stop bit
- Return to Idle: Transaction complete
Collision Detection Mechanism
[edit | edit source]The collision detection system enables automatic address resolution:
Collision Detection Process:
- Device begins transmitting its data
- Monitors bus state while transmitting
- If transmitted '1' but bus reads '0', collision detected
- Device immediately stops transmission
- Sets internal collision flag
- Remains silent for next transaction to its address
Collision Resolution Algorithm: When multiple devices share an address:
- Host sends Talk Register 3 to shared address
- All devices attempt to respond simultaneously
- Devices detecting collision stop transmitting
- Non-colliding device completes transmission
- Host sends Listen Register 3 with new address ($8-$E) and handler ID $FE
- Only non-colliding device moves to new address
- Process repeats until no collisions remain
Service Request Mechanism
[edit | edit source]The Service Request (SRQ) signal allows devices to request host attention without being polled:
SRQ Assertion:
- Device pulls bus low during stop bit of any command
- Must maintain low for minimum 300 μs total
- Can only assert if command was not addressed to requesting device
- SRQ does not cancel the current transaction
Host Response to SRQ:
- Detects extended stop bit duration
- Completes current transaction
- Polls Register 0 of all devices sequentially
- Device with data becomes new active device
- Continues polling active device until next SRQ
Extended Protocol Specifications
[edit | edit source]Extended Keyboard Protocol
[edit | edit source]The Extended Keyboard Protocol distinguishes between left and right modifier keys:
| Register | Format | Description |
|---|---|---|
| 0 | 2 bytes | Two key events: 7-bit keycode + 1-bit up/down flag each |
| 1 | Undefined | Reserved for vendor use |
| 2 | 2 bytes | LED status and modifier key states |
| 3 | 2 bytes | Device address and handler ID |
Register 2 Extended Format:
- Bit 0: Num Lock LED (0=off, 1=on)
- Bit 1: Caps Lock LED
- Bit 2: Scroll Lock LED
- Bit 3: Compose LED
- Bit 4: Kana LED
- Bit 5: Power LED
- Bit 6: Reserved
- Bit 7: Delete key state
Extended Keycodes:
- $32: Left Shift
- $38: Right Shift
- $37: Left Command
- $3C: Right Command
- $3A: Left Option
- $3D: Right Option
- $36: Left Control
- $3E: Right Control
Extended Mouse Protocol
[edit | edit source]The Extended Mouse Protocol (Handler ID $04) supports multiple buttons and higher precision:
Standard Mouse Protocol (Handler ID $01):
- Register 0: 2 bytes
- Byte 0: Button state (bit 7) + X delta (bits 6-0, signed)
- Byte 1: Button state (bit 7) + Y delta (bits 6-0, signed)
- Resolution: 100±10 counts per inch
- Movement range: -64 to +63 per packet
Enhanced Resolution (Handler ID $02):
- Same format as standard protocol
- Resolution increased to 200±10 counts per inch
Extended Protocol Features:
- Support for up to 8 buttons
- 16-bit movement deltas
- Configurable resolution up to 400 CPI
- Scroll wheel support (vendor-specific)
Complete Handler ID Registry
[edit | edit source]Device Handler IDs identify specific device types and operational modes:
| Handler ID | Device Category | Description | Notes |
|---|---|---|---|
| $00 | System | Self-test failed | Device diagnostics failure |
| $01 | Keyboard | Apple Keyboard | Original keyboard protocol |
| $02 | Keyboard | Apple Extended Keyboard | Standard extended keyboard |
| $03 | Keyboard | Extended Protocol | Distinguishes left/right modifiers |
| $04 | Keyboard | ISO Layout | International keyboard support |
| $05 | Keyboard | Apple Adjustable Keyboard | Ergonomic split keyboard |
| $06-$07 | Keyboard | Reserved | Future keyboard types |
| $08 | Keyboard | JIS Layout | Japanese keyboard |
| $09-$0F | Keyboard | Vendor-specific | Third-party keyboards |
| $01 | Mouse | Standard Mouse | 100 CPI, single button |
| $02 | Mouse | 200 CPI Mouse | Enhanced resolution |
| $03 | Mouse | Mouse Systems A3 | Three-button mouse |
| $04 | Mouse | Extended Mouse | Multi-button support |
| $05-$0F | Mouse | Vendor-specific | Third-party mice |
| $10-$1F | Tablet | Graphics tablets | Absolute positioning devices |
| $20 | Joystick | Standard joystick | Game controllers |
| $21-$2F | Other | Special devices | Miscellaneous input |
| $30-$3F | Reserved | Apple reserved | Future Apple devices |
| $40-$FD | Vendor | Vendor-specific | Custom implementations |
| $FE | System | Change address | Collision resolution command |
| $FF | System | Self-test passed | Device diagnostics success |
Advanced Implementation Details
[edit | edit source]Electrical Specifications
[edit | edit source]| Parameter | Specification | Notes |
|---|---|---|
| Bus voltage | 5.0V ± 5% | Supplied by host |
| Logic high (VIH) | 2.0V minimum | TTL compatible |
| Logic low (VIL) | 0.8V maximum | TTL compatible |
| Output low (VOL) | 0.4V maximum | At 4mA sink current |
| Pull-up resistance | 470Ω - 1kΩ | External resistor required |
| Bus capacitance | 200pF maximum | Per device |
| Rise time | 1.0μs maximum | 10% to 90% |
| Fall time | 300ns maximum | 90% to 10% |
| Current per device | 100mA maximum | From +5V supply |
| Total bus current | 500mA maximum | All devices combined |
Reset and Initialization Sequence
[edit | edit source]Power-On Reset:
- Host asserts reset (bus low) for minimum 3ms
- Devices wait up to 1 second for initialization
- Host begins enumeration at default addresses
- Devices respond with Register 3 contents
- Collision resolution if multiple devices present
- Handler installation for recognized devices
- Normal polling operations begin
Soft Reset (SendReset Command):
- Command: Address $0, Command $0, Register $0
- All devices reset to startup state
- Devices clear pending actions
- Return to default addresses
- Preserve handler ID settings
Data Register Formats
[edit | edit source]Register 0 (Primary Data):
- Always contains device's main data
- Must have data available when asserting SRQ
- 2-8 bytes depending on device type
- Updated only when new data available
Register 1 (Device-Specific):
- Vendor-defined functionality
- Configuration storage
- Extended data for complex devices
- Not standardized by Apple
Register 2 (Device-Specific):
- Secondary configuration
- LED control (keyboards)
- Button mapping (mice)
- Calibration data (tablets)
Register 3 (Status/Configuration):
| Bits | Field | Description |
|---|---|---|
| 15-8 | Exceptional Event | Device-specific flags |
| 15 | Reserved | Always 0 |
| 14 | Exception | Device exception occurred |
| 13 | SRQ Enable | Service requests enabled |
| 12-8 | Device Flags | Device-specific status |
| 7-0 | Handler ID | Current device handler |
Error Handling and Recovery
[edit | edit source]Timeout Handling:
- No response timeout: 260μs after Tlt
- Incomplete data timeout: 130μs between bytes
- Host marks device as non-responsive
- Periodic retry attempts every 1 second
CRC and Data Integrity:
- No built-in error detection
- Devices responsible for data validation
- Host can request retransmission via Talk command
- Application-level checksums recommended for critical data
Bus Recovery:
- Detect bus stuck low > 1ms
- Issue reset pulse
- Wait for bus to return high
- Resume normal operations
- Log error for diagnostic purposes
Troubleshooting
[edit | edit source]Common Problems
[edit | edit source]| 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
[edit | edit source]- ADB Parser: Classic Mac OS tool for bus analysis
- TechTool: Hardware diagnostic suite
- MacsBug: Low-level debugging access to ADB