2 pcboot - bootable PC demo/game kernel
3 Copyright (C) 2018 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY, without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
24 #define KB_DATA_PORT 0x60
25 #define KB_CMD_PORT 0x64
26 #define KB_STATUS_PORT 0x64
30 #define KB_TEST_PASSED 0x55
31 #define KB_TEST_FAILED 0xfc
33 #define KB_STAT_OUTBUF_FULL 0x01
34 #define KB_STAT_INBUF_FULL 0x02
35 #define KB_STAT_SYSFLAG 0x04
36 #define KB_STAT_CMD 0x08
37 #define KB_STAT_ACTIVE 0x10
38 #define KB_STAT_AUX 0x20
39 #define KB_STAT_TIMEOUT 0x40
40 #define KB_STAT_PAR_ERROR 0x80
42 #define KB_CMD_TEST 0xaa
44 /* keyboard commands */
45 #define KB_CMD_GET_CMDBYTE 0x20
46 #define KB_CMD_SET_CMDBYTE 0x60
47 #define KB_CMD_AUX_ENABLE 0xa8
48 #define KB_CMD_READ_OUTPORT 0xd0
49 #define KB_CMD_WRITE_OUTPORT 0xd1
50 #define KB_CMD_PSAUX 0xd4
51 #define KB_CMD_PULSE_RESET 0xfe
53 /* controller command byte bits */
54 #define KB_CCB_KB_INTREN 0x01
55 #define KB_CCB_AUX_INTREN 0x02
56 #define KB_CCB_SYSFLAG 0x04
57 #define KB_CCB_KB_DISABLE 0x10
58 #define KB_CCB_AUX_DISABLE 0x20
59 #define KB_CCB_KB_XLAT 0x40
61 /* psaux commands (use with d4 prefix) */
62 #define AUX_CMD_STREAM_MODE 0xea
63 #define AUX_CMD_READ_MOUSE 0xeb
64 #define AUX_CMD_REMOTE_MODE 0xf0
65 #define AUX_CMD_ENABLE 0xf4
66 #define AUX_CMD_DEFAULTS 0xf6
68 #define AUX_PKT0_LEFTBN 0x01
69 #define AUX_PKT0_RIGHTBN 0x02
70 #define AUX_PKT0_MIDDLEBN 0x04
71 #define AUX_PKT0_ALWAYS1 0x08
72 #define AUX_PKT0_XSIGN 0x10
73 #define AUX_PKT0_YSIGN 0x20
74 #define AUX_PKT0_XOVF 0x40
75 #define AUX_PKT0_YOVF 0x80
77 #define AUX_PKT0_OVF_BITS (AUX_PKT0_XOVF | AUX_PKT0_YOVF)
78 #define AUX_PKT0_BUTTON_BITS \
79 (AUX_PKT0_LEFTBN | AUX_PKT0_RIGHTBN | AUX_PKT0_MIDDLEBN)
81 #endif /* KBREGS_H_ */