6 ADB - The Untold Story: Space Aliens Ate My Mouse
7 http://developer.apple.com/legacy/mac/library/#technotes/hw/hw_01.html
8 Apple IIgs Hardware Reference Second Edition [p80(Chapter6 p121)]
9 ftp://ftp.apple.asimov.net/pub/apple_II/documentation/Apple%20IIgs%20Hardware%20Reference.pdf
11 http://72.0.193.250/Documentation/macppc/adbkeycodes/
12 http://m0115.web.fc2.com/m0115.jpg
13 [Inside Macintosh volume V, pages 191-192]
15 http://kbdbabel.sourceforge.net/doc/kbd_signaling_pcxt_ps2_adb.pdf
16 ADB Overview & History
17 http://en.wikipedia.org/wiki/Apple_Desktop_Bus
18 Microchip Application Note: ADB device(with code for PIC16C)
19 http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011062
20 AVR ATtiny2131 ADB to PS/2 converter(Japanese)
21 http://hp.vector.co.jp/authors/VA000177/html/KeyBoardA5DEA5CBA5A2II.html
26 ADB female socket from the front:
32 |________| <--- bottom
36 ADB female socket from bottom:
46 2: Power SW(low when press Power key)
54 ADB command is 1byte and consists of 4bit-address, 2bit-command
55 type and 2bit-register. The commands are always sent by Host.
59 | | | |------------ address
60 | |-------- command type
64 ------------------------------------------------------
65 - - - - 0 0 0 0 Send Request(reset all devices)
66 A A A A 0 0 0 1 Flush(reset a device)
67 - - - - 0 0 1 0 Reserved
68 - - - - 0 0 1 1 Reserved
69 - - - - 0 1 - - Reserved
70 A A A A 1 0 R R Listen(write to a device)
71 A A A A 1 1 R R Talk(read from a device)
73 The command to read keycodes from keyboard is 0x2C which
74 consist of keyboard address 2 and Talk against register 0.
81 0: application(keyobard uses this to store its data.)
83 2: application(keyboard uses this for LEDs and state of modifiers)
89 This is a minimum information for keyboard communication.
90 See "Resources" for detail.
94 ~~~~____________~~||||||||||||__~~~~~_~~|||||||||||||||__~~~~
96 |800us | |7 Command 0| | | |15-64 Data 0|Stopbit(0)
97 +Attention | | | +Startbit(1)
98 +Startbit(1) | +Tlt(140-260us)
109 bit0 low time: 60-70% of bit cell(42-91us)
110 bit1 low time: 30-40% of bit cell(21-52us)
111 bit cell time: 70-130us
112 [from Apple IIgs Hardware Reference Second Edition]
114 Criterion for bit0/1:
115 After 55us if line is low/high then bit is 0/1.
117 Attention & start bit:
118 Host asserts low in 560-1040us then places start bit(1).
121 Bus stays high in 140-260us then device places start bit(1).
124 Host asserts low in 2.8-5.2ms. All devices are forced to reset.
126 Send request from device(Srq):
127 Device can request to send at commad(Global only?) stop bit.
128 keep low for 300us to request.
131 Keyboard Data(Register0)
132 This 16bit data can contains two keycodes and two released flags.
133 First keycode is palced in upper byte. When one keyocode is sent,
135 Release flag is 1 when key is released.
137 1514 . . . . . 8 7 6 . . . . . 0
138 | | | | | | | | | +-+-+-+-+-+-+- Keycode2
139 | | | | | | | | +--------------- Released2(1 when the key is released)
140 | +-+-+-+-+-+-+----------------- Keycode1
141 +------------------------------- Released1(1 when the key is released)
144 Scancode consists of 7bit keycode and 1bit release flag.
145 Device can send two keycodes at once. If just one keycode is sent
146 keycode1 contains it and keyocode2 is 0xFF.
149 You can read the state from PSW line(active low) however
150 the switch has a special scancode 0x7F7F, so you can
151 also read from Data line. It uses 0xFFFF for release scancode.
153 Keyboard LEDs & state of keys(Register2)
154 This register hold current state of three LEDs and nine keys.
155 The state of LEDs can be changed by sending Listen command.
157 1514 . . . . . . 7 6 5 . 3 2 1 0
158 | | | | | | | | | | | | | | | +- LED1(NumLock)
159 | | | | | | | | | | | | | | +--- LED2(CapsLock)
160 | | | | | | | | | | | | | +----- LED3(ScrollLock)
161 | | | | | | | | | | +-+-+------- Reserved
162 | | | | | | | | | +------------- ScrollLock
163 | | | | | | | | +--------------- NumLock
164 | | | | | | | +----------------- Apple/Command
165 | | | | | | +------------------- Option
166 | | | | | +--------------------- Shift
167 | | | | +----------------------- Control
168 | | | +------------------------- Reset/Power
169 | | +--------------------------- CapsLock
170 | +----------------------------- Delete
171 +------------------------------- Reserved