Appendix F: IKBD Scan Codes

- APPENDIX F -

IKBD SCAN CODES


IKBD Scan Codes


The AES, VDI, and BIOS, all contain functions which return scan codes from the Intelligent Keyboard Controller (IKBD). These scan codes can be used to determine exactly which key was struck (not simply the ASCII value).

One thing that must be considered when relying on scan codes is that they identify a physical vector on the keyboard, not a key definition. The scancode for a letter on an American keyboard, for instance, may be different than the scancode for the same letter on a German keyboard. The XBIOS function Keytbl() can be used to look up the ASCII value assigned to a scancode to ensure that keystrokes are correctly processed.

Scancodes for keyboard modifiers (SHIFT, ALT, etc.) are never returned by an OS call. However, when handling the IKBD directly, the following scancodes may be encountered:
KeyScancode
Left-Shift42 (0x2A)
Right-Shift54 (0x36)
Control29 (0x1D)
Alternate56 (0x38)
Caps Lock58 (0x3A)

The values shown in the following table contain the IKBD scancode of each keyboard key in the high BYTE and the ASCII code in the low BYTE. Keys with no corresponding ASCII value will always have zero as the low byte. These values are valid for all Atari computers with US keyboards:
Key
Unshifted
Key
Shifted
w/CTRL
w/ALT

a
0x1E61
A
0x1E41
0x1E01
0x1E00
b
0x3062
B
0x3042
0x3002
0x3000
c
0x2E63
C
0x2E43
0x2E03
0x2E00
d
0x2064
D
0x2044
0x2004
0x2000
e
0x1265
E
0x1245
0x1205
0x1200
f
0x2166
F
0x2146
0x2106
0x2100
g
0x2267
G
0x2247
0x2207
0x2200
h
0x2368
H
0x2348
0x2308
0x2300
i
0x1769
I
0x1749
0x1709
0x1700
j
0x246A
J
0x244A
0x240A
0x2400
k
0x256B
K
0x254B
0x250B
0x2500
l
0x266C
L
0x264C
0x260C
0x2600
m
0x326D
M
0x324D
0x320D
0x3200
n
0x316E
N
0x314E
0x310E
0x3100
o
0x186F
O
0x184F
0x180F
0x1800
p
0x1970
P
0x1950
0x1910
0x1900
q
0x1071
Q
0x1051
0x1011
0x1000
r
0x1372
R
0x1352
0x1312
0x1300
s
0x1F73
S
0x1F53
0x1F13
0x1F00
t
0x1474
T
0x1454
0x1414
0x1400
u
0x1675
U
0x1655
0x1615
0x1600
v
0x2F76
V
0x2F56
0x2F16
0x2F00
w
0x1177
W
0x1157
0x1117
0x1100
x
0x2D78
X
0x2D58
0x2D18
0x2D00
y
0x1579
Y
0x1559
0x1519
0x1500
z
0x2C7A
Z
0x2C5A
0x2C1A
0x2C00
1
0x0231
!
0x0221
0x0211
0x7800
2
0x0332
@
0x0340
0x0300
0x7900
3
0x0433
#
0x0423
0x0413
0x7A00
4
0x0534
$
0x0524
0x0514
0x7B00
5
0x0635
%
0x0625
0x0615
0x7C00
6
0x0736
^
0x075E
0x071E
0x7D00
7
0x0837
&
0x0826
0x0817
0x7E00
8
0x0938
*
0x092A
0x0918
0x7F00
9
0x0A39
(
0x0A28
0x0A19
0x8000
0
0x0B30
)
0x0B29
0x0B10
0x8100
-
0x0C2D
_
0x0C5F
0x0C1F
0x8200
=
0x0D3D
+
0x0D2B
0x0D1D
0x8300
`
0x2960
~
0x297E
0x2900
0x2960
\
0x2B5C
|
0x2B7C
0x2B1C
0x2B5C
[
0x1A5B
{
0x1A7B
0x1A1B
0x1A5B
]
0x1B5D
}
0x1B7D
0x1B1D
0x1B5D
;
0x273B
:
0x273A
0x271B
0x273B
'
0x2827
"
0x2822
0x2807
0x2827
,
0x332C
<
0x333C
0x330C
0x332C
.
0x342E
>
0x343E
0x340E
0x342E
/
0x352F
?
0x353F
0x250F
0x352E
space
0x3920
0x3920
0x3900
0x3920
esc
0x011B
0x011B
0x011B
0x011B
bksp
0x0E08
0x0E08
0x0E08
0x0E08
del
0x537F
0x537F
0x531F
0x537F
return
0x1C0D
0x1C0D
0x1C0A
0x1C0D
tab
0x0F09
0x0F09
0x0F09
0x0F09
Nmpad (
0x6328
0x6328
0x6308
0x6328
Nmpad )
0x6429
0x6429
0x6409
0x6429
Nmpad /
0x652F
0x652F
0x650F
0x652F
Nmpad *
0x662A
0x662A
0x660A
0x662A
Nmpad _
0x4A2D
0x4A2D
0x4A1F
0x4A2D
Nmpad +
0x4E2B
0x4E2B
0x3E0B
0x4E2B
Nmpad .
0x712E
0x712E
0x710E
0x712E
Nmpad enter
0x720D
0x720D
0x720A
0x720D
Nmpad 0
0x7030
0x7030
0x7010
0x7030
Nmpad 1
0x6D31
0x6D31
0x6D11
0x6D311
Nmpad 2
0x6E32
0x6E32
0x6E00
0x6E321
Nmpad 3
0x6F33
0x6F33
0x6F13
0x6F331
Nmpad 4
0x6A34
0x6A34
0x6A14
0x6A341
Nmpad 5
0x6B35
0x6B35
0x6B15
0x6B351
Nmpad 6
0x6C36
0x6C36
0x6C1E
0x6C361
Nmpad 7
0x6737
0x6737
0x6717
0x67371
Nmpad 8
0x6838
0x6838
0x6818
0x68381
Nmpad 9
0x6939
0x6939
0x6919
0x69391
help
0x6200
0x6200
0x6200
Alt-Help
undo
0x6100
0x6100
0x6100
0x6100
insert
0x5200
0x5230
0x5200
Left Mouse Button
clr/ Home
0x4700
0x4737
0x7700
Right Mouse Button3
up-arrow
0x4800
0x4838
0x4800
Mouse Up3
down-arrow
0x5000
0x5032
0x5000
Mouse Down3
left-arrow
0x4B00
0x4B34
0x7300
Mouse Left3
right-arrow
0x4D00
0x4D36
0x7400
Mouse Right3
F1
0x3B00
F11
0x5400
0x3B00
0x3B00
F2
0x3C00
F12
0x5500
0x3C00
0x3C00
F3
0x3D00
F13
0x5600
0x3D00
0x3D00
F4
0x3E00
F14
0x5700
0x3E00
0x3E00
F5
0x3F00
F15
0x5800
0x3F00
0x3F00
F6
0x4000
F16
0x5900
0x4000
0x4000
F7
0x4100
F17
0x5A00
0x4100
0x4100
F8
0x4200
F18
0x5B00
0x4200
0x4200
F9
0x4300
F19
0x5C00
0x4300
0x4300
F10
0x4400
F20
0x5D00
0x4400
0x4400


Table of Contents | Index