#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#include <conio.h>
#include <dos.h>
#include <i86.h>
#endif
#ifdef __DJGPP__
-#include <stdint.h>
#include <dpmi.h>
#include <go32.h>
#include <pc.h>
#include "keyb.h"
#include "scancode.h"
+#include "inttypes.h"
#define KB_INTR 0x9
#define KB_PORT 0x60
case KB_CTRL:
return keystate[KB_LCTRL] + keystate[KB_RCTRL];
}
+
+ if(isalpha(key)) {
+ key = tolower(key);
+ }
return keystate[key];
}
{
int key;
while((key = kb_getkey()) == -1) {
+#ifdef USE_HLT
/* put the processor to sleep while waiting for keypresses, but first
* make sure interrupts are enabled, or we'll sleep forever
*/
halt();
+#endif
}
kb_putback(key);
}
static void INTERRUPT kbintr()
{
unsigned char code;
- int key, press;
+ int key, c, press;
code = inp(KB_PORT);
}
key = scantbl[code];
+ c = (keystate[KB_LSHIFT] | keystate[KB_RSHIFT]) ? scantbl_shift[code] : key;
if(press) {
/* append to buffer */
- last_key = key;
+ last_key = c;
if(buffer_size > 0) {
- buffer[buf_widx] = key;
+ buffer[buf_widx] = c;
ADVANCE(buf_widx);
/* if the write end overtook the read end, advance the read end
* too, to discard the oldest keypress from the buffer