]> git.sur5r.net Git - cc65/blob - include/_pokey.h
Support for self explanatory KBCODE values
[cc65] / include / _pokey.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 _pokey.h                                  */
4 /*                                                                           */
5 /*                Internal include file, do not use directly                 */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com>                           */
10 /* 06-Nov-2018: Christian Krueger: Added defines for keyboard codes          */
11 /*                                                                           */
12 /*                                                                           */
13 /* This software is provided 'as-is', without any expressed or implied       */
14 /* warranty.  In no event will the authors be held liable for any damages    */
15 /* arising from the use of this software.                                    */
16 /*                                                                           */
17 /* Permission is granted to anyone to use this software for any purpose,     */
18 /* including commercial applications, and to alter it and redistribute it    */
19 /* freely, subject to the following restrictions:                            */
20 /*                                                                           */
21 /* 1. The origin of this software must not be misrepresented; you must not   */
22 /*    claim that you wrote the original software. If you use this software   */
23 /*    in a product, an acknowledgment in the product documentation would be  */
24 /*    appreciated but is not required.                                       */
25 /* 2. Altered source versions must be plainly marked as such, and must not   */
26 /*    be misrepresented as being the original software.                      */
27 /* 3. This notice may not be removed or altered from any source              */
28 /*    distribution.                                                          */
29 /*                                                                           */
30 /*****************************************************************************/
31
32
33
34 #ifndef __POKEY_H
35 #define __POKEY_H
36
37
38
39 /* Define a structure with the pokey register offsets */
40 struct __pokey_write {
41     unsigned char   audf1;  /* audio channel #1 frequency */
42     unsigned char   audc1;  /* audio channel #1 control */
43     unsigned char   audf2;  /* audio channel #2 frequency */
44     unsigned char   audc2;  /* audio channel #2 control */
45     unsigned char   audf3;  /* audio channel #3 frequency */
46     unsigned char   audc3;  /* audio channel #3 control */
47     unsigned char   audf4;  /* audio channel #4 frequency */
48     unsigned char   audc4;  /* audio channel #4 control */
49     unsigned char   audctl; /* audio control */
50     unsigned char   stimer; /* start pokey timers */
51     unsigned char   skrest; /* reset serial port status reg. */
52     unsigned char   potgo;  /* start paddle scan sequence */
53     unsigned char   unuse1; /* unused */
54     unsigned char   serout; /* serial port data output */
55     unsigned char   irqen;  /* interrupt request enable */
56     unsigned char   skctl;  /* serial port control */
57 };
58 struct __pokey_read {
59     unsigned char   pot0;   /* paddle 0 value */
60     unsigned char   pot1;   /* paddle 1 value */
61     unsigned char   pot2;   /* paddle 2 value */
62     unsigned char   pot3;   /* paddle 3 value */
63     unsigned char   pot4;   /* paddle 4 value */
64     unsigned char   pot5;   /* paddle 5 value */
65     unsigned char   pot6;   /* paddle 6 value */
66     unsigned char   pot7;   /* paddle 7 value */
67     unsigned char   allpot; /* eight paddle port status */
68     unsigned char   kbcode; /* keyboard code */
69     unsigned char   random; /* random number generator */
70     unsigned char   unuse2; /* unused */
71     unsigned char   unuse3; /* unused */
72     unsigned char   serin;  /* serial port input */
73     unsigned char   irqst;  /* interrupt request status */
74     unsigned char   skstat; /* serial port status */
75 };
76
77
78 /* Keyboard values returned by kbcode */
79
80 #define KEY_NONE        (unsigned char) 0xFF
81
82 #define KEY_0           (unsigned char) 0x32
83 #define KEY_1           (unsigned char) 0x1F
84 #define KEY_2           (unsigned char) 0x1E
85 #define KEY_3           (unsigned char) 0x1A
86 #define KEY_4           (unsigned char) 0x18
87 #define KEY_5           (unsigned char) 0x1D
88 #define KEY_6           (unsigned char) 0x1B
89 #define KEY_7           (unsigned char) 0x33
90 #define KEY_8           (unsigned char) 0x35
91 #define KEY_9           (unsigned char) 0x30
92
93 #define KEY_A           (unsigned char) 0x3F
94 #define KEY_B           (unsigned char) 0x15
95 #define KEY_C           (unsigned char) 0x12
96 #define KEY_D           (unsigned char) 0x3A
97 #define KEY_E           (unsigned char) 0x2A
98 #define KEY_F           (unsigned char) 0x38
99 #define KEY_G           (unsigned char) 0x3D
100 #define KEY_H           (unsigned char) 0x39
101 #define KEY_I           (unsigned char) 0x0D
102 #define KEY_J           (unsigned char) 0x01
103 #define KEY_K           (unsigned char) 0x05
104 #define KEY_L           (unsigned char) 0x00
105 #define KEY_M           (unsigned char) 0x25
106 #define KEY_N           (unsigned char) 0x23
107 #define KEY_O           (unsigned char) 0x08
108 #define KEY_P           (unsigned char) 0x0A
109 #define KEY_Q           (unsigned char) 0x2F
110 #define KEY_R           (unsigned char) 0x28
111 #define KEY_S           (unsigned char) 0x3E
112 #define KEY_T           (unsigned char) 0x2D
113 #define KEY_U           (unsigned char) 0x0B
114 #define KEY_V           (unsigned char) 0x10
115 #define KEY_W           (unsigned char) 0x2E
116 #define KEY_X           (unsigned char) 0x16
117 #define KEY_Y           (unsigned char) 0x2B
118 #define KEY_Z           (unsigned char) 0x17
119
120 #define KEY_COMMA       (unsigned char) 0x20
121 #define KEY_PERIOD      (unsigned char) 0x22
122 #define KEY_SLASH       (unsigned char) 0x26
123 #define KEY_SEMICOLON   (unsigned char) 0x02
124 #define KEY_PLUS        (unsigned char) 0x06
125 #define KEY_ASTERISK    (unsigned char) 0x07
126 #define KEY_DASH        (unsigned char) 0x0E
127 #define KEY_EQUALS      (unsigned char) 0x0F
128 #define KEY_LESSTHAN    (unsigned char) 0x36
129 #define KEY_GREATERTHAN (unsigned char) 0x37
130
131 #define KEY_ESC         (unsigned char) 0x1C
132 #define KEY_TAB         (unsigned char) 0x2C
133 #define KEY_SPACE       (unsigned char) 0x21
134 #define KEY_RETURN      (unsigned char) 0x0C
135 #define KEY_DELETE      (unsigned char) 0x34
136 #define KEY_CAPS        (unsigned char) 0x3C
137 #define KEY_INVERSE     (unsigned char) 0x27
138 #define KEY_HELP        (unsigned char) 0x11
139
140 #define KEY_F1          (unsigned char) 0x03
141 #define KEY_F2          (unsigned char) 0x04
142 #define KEY_F3          (unsigned char) 0x13
143 #define KEY_F4          (unsigned char) 0x14
144
145 #define KEY_CTRL        (unsigned char) 0x80
146 #define KEY_SHIFT       (unsigned char) 0x40
147
148 /* Composed keys */
149
150 #define KEY_EXCLAMATIONMARK     (KEY_1 | KEY_SHIFT)
151 #define KEY_QUOTE               (KEY_2 | KEY_SHIFT)
152 #define KEY_HASH                (KEY_3 | KEY_SHIFT)
153 #define KEY_DOLLAR              (KEY_4 | KEY_SHIFT)
154 #define KEY_PERCENT             (KEY_5 | KEY_SHIFT)
155 #define KEY_AMPERSAND           (KEY_6 | KEY_SHIFT)
156 #define KEY_APOSTROPHE          (KEY_7 | KEY_SHIFT)
157 #define KEY_AT                  (KEY_8 | KEY_SHIFT)
158 #define KEY_OPENINGPARAN        (KEY_9 | KEY_SHIFT)
159 #define KEY_CLOSINGPARAN        (KEY_0 | KEY_SHIFT)
160 #define KEY_UNDERLINE           (KEY_DASH | KEY_SHIFT)
161 #define KEY_BAR                 (KEY_EQUALS | KEY_SHIFT)
162 #define KEY_COLON               (KEY_SEMICOLON | KEY_SHIFT)
163 #define KEY_BACKSLASH           (KEY_PLUS | KEY_SHIFT)
164 #define KEY_CIRCUMFLEX          (KEY_ASTERISK | KEY_SHIFT)
165 #define KEY_OPENINGBRACKET      (KEY_COMMA | KEY_SHIFT)
166 #define KEY_CLOSINGBRACKET      (KEY_PERIOD | KEY_SHIFT)
167 #define KEY_QUESTIONMARK        (KEY_SLASH | KEY_SHIFT)
168 #define KEY_CLEAR               (KEY_LESSTHAN | KEY_SHIFT)
169 #define KEY_INSERT              (KEY_GREATERTHAN | KEY_SHIFT)
170
171 #define KEY_UP      (KEY_UNDERLINE | KEY_CTRL)
172 #define KEY_DOWN    (KEY_EQUALS | KEY_CTRL)
173 #define KEY_LEFT    (KEY_PLUS | KEY_CTRL)
174 #define KEY_RIGHT   (KEY_ASTERISK | KEY_CTRL)
175
176 /* End of _pokey.h */
177 #endif /* #ifndef __POKEY_H */
178