36 { SDL_SCANCODE_BACKSPACE, 0x00,
"DEL" },
37 { SDL_SCANCODE_RETURN, 0x01,
"RETURN" },
39 { SDL_SCANCODE_RIGHT, 0x02,
"RIGHT" }, { SDL_SCANCODE_LEFT, 0x02 | 8,
"LEFT*" },
41 { SDL_SCANCODE_F7, 0x03,
"F7" }, { SDL_SCANCODE_F8, 0x03 | 8,
"F8*" },
42 { SDL_SCANCODE_F1, 0x04,
"F1" }, { SDL_SCANCODE_F2, 0x04 | 8,
"F2*" },
43 { SDL_SCANCODE_F3, 0x05,
"F3" }, { SDL_SCANCODE_F4, 0x05 | 8,
"F4*" },
44 { SDL_SCANCODE_F5, 0x06,
"F5" }, { SDL_SCANCODE_F6, 0x06 | 8,
"F6*" },
46 { SDL_SCANCODE_DOWN, 0x07,
"DOWN" }, { SDL_SCANCODE_UP, 0x07 | 8,
"UP*" },
47 { SDL_SCANCODE_3, 0x10,
"3" },
48 { SDL_SCANCODE_W, 0x11,
"W" },
49 { SDL_SCANCODE_A, 0x12,
"A" },
50 { SDL_SCANCODE_4, 0x13,
"4" },
51 { SDL_SCANCODE_Z, 0x14,
"Z" },
52 { SDL_SCANCODE_S, 0x15,
"S" },
53 { SDL_SCANCODE_E, 0x16,
"E" },
54 { SDL_SCANCODE_LSHIFT, 0x17,
"LSHIFT" },
55 { SDL_SCANCODE_5, 0x20,
"5" },
56 { SDL_SCANCODE_R, 0x21,
"R" },
57 { SDL_SCANCODE_D, 0x22,
"D" },
58 { SDL_SCANCODE_6, 0x23,
"6" },
59 { SDL_SCANCODE_C, 0x24,
"C" },
60 { SDL_SCANCODE_F, 0x25,
"F" },
61 { SDL_SCANCODE_T, 0x26,
"T" },
62 { SDL_SCANCODE_X, 0x27,
"X" },
63 { SDL_SCANCODE_7, 0x30,
"7" },
64 { SDL_SCANCODE_Y, 0x31,
"Y" },
65 { SDL_SCANCODE_G, 0x32,
"G" },
66 { SDL_SCANCODE_8, 0x33,
"8" },
67 { SDL_SCANCODE_B, 0x34,
"B" },
68 { SDL_SCANCODE_H, 0x35,
"H" },
69 { SDL_SCANCODE_U, 0x36,
"U" },
70 { SDL_SCANCODE_V, 0x37,
"V" },
71 { SDL_SCANCODE_9, 0x40,
"9" },
72 { SDL_SCANCODE_I, 0x41,
"I" },
73 { SDL_SCANCODE_J, 0x42,
"J" },
74 { SDL_SCANCODE_0, 0x43,
"0" },
75 { SDL_SCANCODE_M, 0x44,
"M" },
76 { SDL_SCANCODE_K, 0x45,
"K" },
77 { SDL_SCANCODE_O, 0x46,
"O" },
78 { SDL_SCANCODE_N, 0x47,
"N" },
79 { SDL_SCANCODE_INSERT, 0x50,
"PLUS" },
80 { SDL_SCANCODE_P, 0x51,
"P" },
81 { SDL_SCANCODE_L, 0x52,
"L" },
82 { SDL_SCANCODE_MINUS, 0x53,
"MINUS" },
83 { SDL_SCANCODE_PERIOD, 0x54,
"PERIOD" },
84 { SDL_SCANCODE_APOSTROPHE, 0x55,
"COLON" },
85 { SDL_SCANCODE_LEFTBRACKET, 0x56,
"AT" },
86 { SDL_SCANCODE_COMMA, 0x57,
"COMMA" },
87 { SDL_SCANCODE_DELETE, 0x60,
"POUND" },
88 { SDL_SCANCODE_RIGHTBRACKET, 0x61,
"ASTERISK" },
89 { SDL_SCANCODE_SEMICOLON, 0x62,
"SEMICOLON" },
90 { SDL_SCANCODE_HOME, 0x63,
"CLR" },
91 { SDL_SCANCODE_RSHIFT, 0x64,
"RSHIFT" },
92 { SDL_SCANCODE_EQUALS, 0x65,
"EQUALS" },
93 { SDL_SCANCODE_BACKSLASH, 0x66,
"UARROW" },
94 { SDL_SCANCODE_SLASH, 0x67,
"SLASH" },
95 { SDL_SCANCODE_1, 0x70,
"1" },
96 { SDL_SCANCODE_GRAVE, 0x71,
"LARROW" },
97 { SDL_SCANCODE_LCTRL, 0x72,
"CTRL" },
98 { SDL_SCANCODE_2, 0x73,
"2" },
99 { SDL_SCANCODE_SPACE, 0x74,
"SPACE" },
100 { SDL_SCANCODE_LALT, 0x75,
"COMMODORE" },
102 { SDL_SCANCODE_RALT, 0x75,
"COMMODORE" },
104 { SDL_SCANCODE_Q, 0x76,
"Q" },
105 { SDL_SCANCODE_END, 0x77,
"RUNSTOP" },
107 { SDL_SCANCODE_ESCAPE, 0x77,
"RUNSTOP" },
122 { SDL_SCANCODE_UNKNOWN, SCRL_KEY_POS,
"NOSCROLL" },
123 { SDL_SCANCODE_TAB, TAB_KEY_POS,
"TAB" },
124 { SDL_SCANCODE_RALT, ALT_KEY_POS,
"ALT" },
125 { SDL_SCANCODE_PAGEUP, C65_KEYBOARD_EXTRA_POS + 3,
"HELP" },
126 { SDL_SCANCODE_UNKNOWN, C65_KEYBOARD_EXTRA_POS + 4,
"F9" },
127 { SDL_SCANCODE_UNKNOWN, C65_KEYBOARD_EXTRA_POS + 5,
"F11" },
128 { SDL_SCANCODE_UNKNOWN, C65_KEYBOARD_EXTRA_POS + 6,
"F13" },
129 { SDL_SCANCODE_ESCAPE, C65_KEYBOARD_EXTRA_POS + 7,
"ESC" },
164 #ifdef FAKE_TYPING_SUPPORT
166 #ifdef C65_FAKE_TYPING_LOAD_SEQS
167 const Uint8 fake_typing_for_go64[] = {
168 0x32,0x46,0x23,0x13,0x01,0x31,0x01, 0xFF
170 const Uint8 fake_typing_for_load64[] = {
171 0x32,0x46,0x23,0x13,0x01,0x31,0x01,
173 0x51,0xFE,0x46,0xFE,0x43,0x57,0x23,0x20,0x01,0x01,
175 0x52,0xFE,0x46,0x73,0xFE,0x61,0xFE,0x73,0xFE,0x01,
177 0x51,0xFE,0x46,0xFE,0x43,0x57,0x23,0x13,0x01,0x01,
182 const Uint8 fake_typing_for_load65[] = {
186 0x51,0x46,0x45,0x16,0x43,0x57,0x23,0x20,0x01,0x01,
188 0x52,0xFE,0x46,0x73,0xFE,0x61,0xFE,0x73,0xFE,0x01,
190 0x51,0x46,0x45,0x16,0x43,0x57,0x23,0x13,0x01,0x01,
202 int c64_fake_typing_enabled = 0;
205 void c64_register_fake_typing (
const Uint8 *keys )
207 c64_fake_typing_enabled = 1;
208 kbd_inject.attention = 0;
209 kbd_inject.typing = keys;
210 kbd_inject.virtual_shift = 0;
214 void c64_stop_fake_typing (
void )
217 c64_fake_typing_enabled = 0;
223 void c64_handle_fake_typing_internals (
Uint8 keysel )
233 kbd_inject.attention++;
234 if (kbd_inject.attention > 25) {
235 kbd_inject.attention = 0;
237 if (kbd_inject.virtual_shift)
239 if (*kbd_inject.typing != 0xFF) {
240 if (*kbd_inject.typing == 0xFE) {
241 kbd_inject.virtual_shift = !kbd_inject.virtual_shift;
247 c64_fake_typing_enabled = 0;
252 if (kbd_inject.next_ok) {
253 kbd_inject.next_ok = 0;
255 Uint8 mask = (cia1.PRA | (~cia1.DDRA)) & 0xFF;
260 kbd_inject.attention++;
262 case 0xFE:
case 0xFD:
case 0xFB:
case 0xF7:
263 case 0xEF:
case 0xDF:
case 0xBF:
case 0x7F:
264 kbd_inject.checked_lines &=
mask;
265 kbd_inject.attention++;
268 printf(
"UNKNOWN SCAN SELECTOR: %02X" NL,
mask);
271 if (!kbd_inject.checked_lines) {
272 kbd_inject.next_ok = 1;
273 kbd_inject.checked_lines = 0xFF;
275 SDL_Event sdlevent = {};
276 sdlevent.type = SDL_KEYDOWN;
277 sdlevent.key.repeat = 0;
279 sdlevent.key.state = SDL_PRESSED;
286 sdlevent.key.keysym.scancode = SDL_SCANCODE_A;