2 #include <machine/console.h>
8 unsigned short kbuffer[KBLEN];
12 const int quertycodes[48+1]={41, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,\
13 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 43,\
14 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45,\
15 46, 47, 48, 49, 50, 51, 52, 53, 57, 0};
16 const char chars[48] = {'`','1','2','3','4','5','6','7','8','9','0','-','=',\
17 'q','w','e','r','t','y','u','i','o','p','[',']','\\',\
18 'a','s','d','f','g','h','j','k','l',';','\'','z','x',\
19 'c','v','b','n','m',',','.','/',' '};
22 static int initkeyb(KBDDEVICE *pkd);
23 static void restorekeyb(void);
24 static void TTY_GetModifierInfo(int *modifiers);
25 static int getkey(MWUCHAR *buf, int *modifiers);
26 static int kbhit(void);
37 * Return the possible modifiers for the keyboard.
40 static void TTY_GetModifierInfo(int *modifiers)
42 *modifiers = 0; /* no modifiers available */
45 static int initkeyb(KBDDEVICE *pkd)
47 VGLKeyboardInit(VGL_CODEKEYS);
48 memset(states, FALSE, (sizeof states));
53 static void restorekeyb(void)
60 unsigned short result, i;
64 while((result = VGLKeyboardGetCh()) != 0) {
74 for(i=0;quertycodes[i]!=0;i++)
75 if(result == quertycodes[i]) {
81 if (isasymbol == FALSE)
84 states[result] = state;
89 if(klen == KBLEN) /* Buffer is full, drop some pieces */
90 memcpy(kbuffer, kbuffer + 1, --klen);
91 kbuffer[klen++] = result;
95 int GetAsyncKeyState(int key)
101 static int getkey(MWUCHAR *buf, int *modifiers)
105 while(kbhit() != TRUE);
107 memcpy(kbuffer, kbuffer + 1, --klen);
113 static int kbhit(void)