1 /* pro_kb.c: keyboard controller
2
3 Copyright (c) 1997-2003, Tarik Isani (xhomer@isani.org)
4
5 This file is part of Xhomer.
6
7 Xhomer is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2
9 as published by the Free Software Foundation.
10
11 Xhomer is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Xhomer; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
22 /* TBD:
23 */
24
25 #ifdef PRO
26 #include "pdp11_defs.h"
27
28
29 struct sercall *pro_kb_orig;
30 LOCAL struct sercall pro_kb_new;
31
32
33 /* Character I/O routines */
34
pro_kb_get()35 int pro_kb_get ()
36 {
37 int key;
38
39 key = pro_kb_orig->get(PRO_SER_KB);
40
41 /* Filter input characters for emulator commands */
42
43 if (key != PRO_NOCHAR)
44 key = pro_menu(key);
45
46 return key;
47 }
48
49
50 /* Keyboard controller registers */
51
pro_kb_rd(int pa)52 int pro_kb_rd (int pa)
53 {
54 return pro_2661kb_rd(pa);
55 }
56
57
pro_kb_wr(int data,int pa,int access)58 void pro_kb_wr (int data, int pa, int access)
59 {
60 pro_2661kb_wr(data, pa, access);
61 }
62
63
64 /* Intercept "get" routine and insert call to filter routine */
65 /* This should be called whenever pro_kb is reassigned */
66
pro_kb_filter()67 void pro_kb_filter ()
68 {
69 /* Copy original serial structure, and change kb.get link */
70
71 pro_kb_new.get = &pro_kb_get;
72 pro_kb_new.put = pro_kb->put;
73 pro_kb_new.ctrl_get = pro_kb->ctrl_get;
74 pro_kb_new.ctrl_put = pro_kb->ctrl_put;
75 pro_kb_new.reset = pro_kb->reset;
76 pro_kb_new.exit = pro_kb->exit;
77
78 pro_kb_orig = pro_kb;
79 pro_kb = &pro_kb_new;
80 }
81
82
pro_kb_reset()83 void pro_kb_reset ()
84 {
85 pro_2661kb_reset();
86 pro_kb_open();
87 }
88
89
pro_kb_open()90 void pro_kb_open ()
91 {
92 pro_kb_filter();
93 pro_2661kb_open();
94 }
95
96
pro_kb_exit()97 void pro_kb_exit ()
98 {
99 pro_kb->exit(PRO_SER_KB);
100 }
101 #endif
102