Skip to content

External Keyboard Protocol

Matthias Melcher edited this page May 12, 2024 · 7 revisions

If a keyboard is connected to the external Interconnect Port, a serial connection is established in a peculiar way. The original keyboard comes with a DIN port and need the Interconnect dongle. The dongle forwards derail port 0 RXD, TXD, HandshakeIn and Handshake out.

Looking at the data exchange on the internal serial port that is connected to the differential inverter, it seems that the keyboard uses the handshake lines to send keystrokes.

The keyboard sends on ~DTR at 10kbps, 8N1, LSB first.

When first connected, the keyboard announces itself to the Newton.

  • A: RTS->L, DTR->H, TXD->H, Power->H
  • B: A+15us Power->L
  • C: A+120us TXD->L, RXD->H
  • D: C+15us TXD->H, RXD->L
  • E: D+120us PortSel0->L
  • F: A+247.23ms Power->H
  • G: A+247.31ms ~DTR sends an MNP encoded block:
0x16·0x10·0x02·0x64·0x5F·0x69·0x64·0x00
0x00·0x00·0x0C·0x6B·0x79·0x62·0x64·0x61
0x70·0x70·0x6C·0x00·0x00·0x00·0x01·0x6E
0x6F·0x66·0x6D·0x00·0x00·0x00·0x00·0x10
0x03·0xDD·0xE7
\x16\x10\x02d_id\0\0\0\x0Ckybdappl\0\0\0\x01nofm\0\0\0\0\x10\x03\xDD\xE7
  • H: G+Data+18ms: SerPortSel->H, Power->L, TDX->L, DTR->L, RTS->H
  • I: H+73ms: Power->H(8us)->L, TXD->H(120u)->L(15u)->H, DTR->H, RTS->L
  • J: I+237ms: Power->H,
  • K: J+1us: DTR sends the same block again:
0x16·0x10·0x02·0x64·0x5F·0x69·0x64·0x00
0x00·0x00·0x0C·0x6B·0x79·0x62·0x64·0x61
0x70·0x70·0x6C·0x00·0x00·0x00·0x01·0x6E
0x6F·0x66·0x6D·0x00·0x00·0x00·0x00·0x10
0x03·0xDD·0xE7
\x16\x10\x02d_id\0\0\0\x0Ckybdappl\0\0\0\x01nofm\0\0\0\0\x10\x03\xDD\xE7
  • L: K+88ms->L

From now on, the keyboard sends key events.

Key events are sent as single bytes. H level (5V) corresponds to logic 1, 0V is logic 0. The key code are the same as for Classic Mac keyboards. Bit 7 is set for a key-down event, bit 7 is clear for a key-up event.

Keycodes are for example 'A' = 0x01, 'S' = 0x02, 'D' = 0x03, etc. .