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 Female socket from the front
33 2: Power SW(low when press Power key)
40 ADB command is 1byte and consists of 4bit-address, 2bit-command
41 type and 2bit-register. The commands are always sent by Host.
45 | | | |------------ address
46 | |-------- command type
50 ------------------------------------------------------
51 - - - - 0 0 0 0 Send Request(reset all devices)
52 A A A A 0 0 0 1 Flush(reset a device)
53 - - - - 0 0 1 0 Reserved
54 - - - - 0 0 1 1 Reserved
55 - - - - 0 1 - - Reserved
56 A A A A 1 0 R R Listen(write to a device)
57 A A A A 1 1 R R Talk(read from a device)
59 The command to read keycodes from keyboard is 0x2C which
60 consist of keyboard address 2 and Talk against register 0.
67 0: application(keyobard uses this to store its data.)
69 2: application(keyboard uses this for LEDs and state of modifiers)
75 This is a minimum information for keyboard communication.
76 See "Resources" for detail.
80 ~~~~____________~~||||||||||||__~~~~~_~~|||||||||||||||__~~~~
82 |800us | |7 Command 0| | | |15-64 Data 0|Stopbit(0)
83 +Attention | | | +Startbit(1)
84 +Startbit(1) | +Tlt(140-260us)
95 bit0 low time: 60-70% of bit cell(42-91us)
96 bit1 low time: 30-40% of bit cell(21-52us)
97 bit cell time: 70-130us
98 [from Apple IIgs Hardware Reference Second Edition]
100 Criterion for bit0/1:
101 After 55us if line is low/high then bit is 0/1.
103 Attention & start bit:
104 Host asserts low in 560-1040us then places start bit(1).
107 Bus stays high in 140-260us then device places start bit(1).
110 Host asserts low in 2.8-5.2ms. All devices are forced to reset.
112 Send request from device(Srq):
113 Device can request to send at commad(Global only?) stop bit.
114 keep low for 300us to request.
117 Keyboard Data(Register0)
118 This 16bit data can contains two keycodes and two released flags.
119 First keycode is palced in upper byte. When one keyocode is sent,
121 Release flag is 1 when key is released.
123 1514 . . . . . 8 7 6 . . . . . 0
124 | | | | | | | | | +-+-+-+-+-+-+- Keycode2
125 | | | | | | | | +--------------- Released2(1 when the key is released)
126 | +-+-+-+-+-+-+----------------- Keycode1
127 +------------------------------- Released1(1 when the key is released)
130 Scancode consists of 7bit keycode and 1bit release flag.
131 Device can send two keycodes at once. If just one keycode is sent
132 keycode1 contains it and keyocode2 is 0xFF.
135 You can read the state from PSW line(active low) however
136 the switch has a special scancode 0x7F7F, so you can
137 also read from Data line. It uses 0xFFFF for release scancode.
139 Keyboard LEDs & state of keys(Register2)
140 This register hold current state of three LEDs and nine keys.
141 The state of LEDs can be changed by sending Listen command.
143 1514 . . . . . . 7 6 5 . 3 2 1 0
144 | | | | | | | | | | | | | | | +- LED1(NumLock)
145 | | | | | | | | | | | | | | +--- LED2(CapsLock)
146 | | | | | | | | | | | | | +----- LED3(ScrollLock)
147 | | | | | | | | | | +-+-+------- Reserved
148 | | | | | | | | | +------------- ScrollLock
149 | | | | | | | | +--------------- NumLock
150 | | | | | | | +----------------- Apple/Command
151 | | | | | | +------------------- Option
152 | | | | | +--------------------- Shift
153 | | | | +----------------------- Control
154 | | | +------------------------- Reset/Power
155 | | +--------------------------- CapsLock
156 | +----------------------------- Delete
157 +------------------------------- Reserved