Skip to content

Instantly share code, notes, and snippets.

@MMcM
Last active August 30, 2020 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MMcM/4d1708be13efedab8770a8125b1ab220 to your computer and use it in GitHub Desktop.
Save MMcM/4d1708be13efedab8770a8125b1ab220 to your computer and use it in GitHub Desktop.
HDS Concept AVT-APL+ Keyboard

HDS Concept AVT-APL+ Keyboard

A Keytronics foam and foil keyboard for an APL capable terminal from 1984.

Protocol

The keyboard just sends idle low, 9600 baud ASCII, with special codes for function keys. It is therefore rather impractical to have it implement a USB keyboard.

Communication in the other direction turns on the LEDs (L1, L2, L3, L4, CAPS LOCK) with a bit mask with odd parity.

Connections

The cable from the keyboard has a DIN-5 connector.

DIN J2 Color Signal
1 1 Red GND
2 2 Brown RXD (from kbd)
3 4 Orange +5V
4 5 Yellow GND
5 6 Gray TXD (to kbd)

ASCII codes

Printing characters match the regular and shifted ASCII codes from the corresponding non-APL keyboard.

Function keys have the eighth bit set.

Legends Code Shift
RESET BREAK C3 C4
PRINT SCRN C8 C9
CMD C1 C2
PRINT C6 C7
F1 INSERT A0 B0
F2 DEL CHAR A1 B1
F3 DEL INS L A2 B2
F4 ERASE A3 B3
F5 SEND A4 B4
F6 A5 B5
F7 A6 B6
F8 A7 B7
F9 A8 B8
F10 A9 B9
F11 AA BA
F12 AB BB
PAGE CA CB
HOME SAVE C5
UP NEXT LINE CC CC
SETUP C0 C0
SCROL CD CE
LEFT ← CF CF
DOWN NEXT VALUE D0 D0
RIGHT → D1 D1
HALT ESCAPE F9 FA
1 ¨ ! 31 21
2 ¯ @ 32 40
3 < # 33 23
4 ≤ $ 34 24
5 = % 35 25
6 ≥ ^ 36 5E
7 ≠ & 37 26
8 ≠ * 38 2A
9 ∨ ( 39 28
0 ∧ ) 30 29
+ - = 2D 5F
× ÷ + = 3D 2B
◊ $ ~ ` 60 7E
BACK SPACE F6 F7
BTAB TAB F8 D4
Q ? 71 51
W ⍵ 77 57
E ∈ 65 45
R ⍴ 72 52
T ∼ 74 54
Y ↑ 79 59
U ↓ 75 55
I ⍳ 69 49
O ○ 6F 4F
P ⋆ 70 50
← → 5B 5D
⊢ ⊣ 5C 7C
LINE FEED F2 F3
DEL F4 F5
CAPS LOCK D6 D6
A ⍺ 61 41
S ⌈ 73 53
D ⌊ 64 44
F _ 66 46
G ∇ 67 47
H ∆ 68 48
J ∘ 6A 4A
K ' 6B 4B
L ⎕ 6C 4C
[ ( ; : 3B 3A
] ) ' " 27 22
{ } 7B 7D
RETURN F0 F1
STAT D2 D3
Z ⊂ 7A 5A
X ⊃ 78 58
C ∩ 63 43
V ∪ 76 56
B ⊥ 62 42
N ⊤ 6E 4E
M ' 6D 4D
, ; < 2C 3C
. : > 2E 3E
/ \ ? 2F 3F
SPACE 20 20
F13 PF1 81 BC
F14 PF2 82 BD
F15 PF3 83 BE
F16 PF4 84 BF
7 91 91
8 92 92
9 93 93
- 88 88
4 8E 8E
5 8F 8F
6 90 90
, 86 86
1 8B 8B
2 8C 8C
3 8D 8D
ENTER 85 85
0 8A 8A
. 89 89
#include <util/parity.h>
void setup() {
Serial.begin(115200);
while (!Serial) {
}
Serial1.begin(9600, SERIAL_8N1_RXINV_TXINV);
pinMode(13, OUTPUT);
}
void loop() {
if (Serial1.available()) {
uint8_t ch = Serial1.read();
Serial.println(ch, HEX);
}
static uint32_t last_time = millis();
uint32_t now = millis();
if (now - last_time > 1000) {
static uint8_t n = 0;
uint8_t ch = n | (parity_even_bit(n) ? 0x00 : 0x20);
Serial1.write(ch);
n = (n + 1) & 0x1F;
last_time = now;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment