Added support for shifting punctuation and the non numpad numbers in the keyboard driver.

This commit is contained in:
2018-11-11 19:56:51 -06:00
parent 55efa49fae
commit 33ece46ac7
2 changed files with 58 additions and 8 deletions
+57 -6
View File
@@ -46,6 +46,46 @@ unsigned char kbdus[128] =
0, /* All other keys are undefined */
};
unsigned char kbdus_upper[128] =
{
0, 27, '!', '@', '#', '$', '%', '^', '&', '*', /* 9 */
'(', ')', '_', '+', '\b', /* Backspace */
'\t', /* Tab */
'Q', 'W', 'E', 'R', /* 19 */
'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', /* Enter key */
0, /* 29 - Control */
'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', /* 39 */
'\"', '~', 0, /* Left shift */
'|', 'Z', 'X', 'C', 'V', 'B', 'N', /* 49 */
'M', '<', '>', '?', 0, /* Right shift */
'*',
0, /* Alt */
' ', /* Space bar */
0, /* Caps lock */
0, /* 59 - F1 key ... > */
0, 0, 0, 0, 0, 0, 0, 0,
0, /* < ... F10 */
0, /* 69 - Num lock*/
0, /* Scroll Lock */
0, /* Home key */
0, /* Up Arrow */
0, /* Page Up */
'-',
0, /* Left Arrow */
0,
0, /* Right Arrow */
'+',
0, /* 79 - End key*/
0, /* Down Arrow */
0, /* Page Down */
0, /* Insert Key */
0, /* Delete Key */
0, 0, 0,
0, /* F11 Key */
0, /* F12 Key */
0, /* All other keys are undefined */
};
bool shift = false;
/* Handles the keyboard interrupt */
@@ -90,13 +130,24 @@ void keyboard_handler(struct regs *r)
* to the above layout to correspond to 'shift' being
* held. If shift is held using the larger lookup table,
* you would add 128 to the scancode when you look for it */
unsigned char* letter = kbdus[scancode];
if(shift)
{
letter = letter - 32;
}
//unsigned char* letter = kbdus[scancode];
//if(scancode > 0x0F && shift)
//{
//letter = letter - 32;
//}
//else
//{
//letter = proccess_number_keypress(scancode, shift);
//}
//putch(letter);
key_pressed(letter);
if(!shift)
{
key_pressed(kbdus[scancode]);
}
else
{
key_pressed(kbdus_upper[scancode]);
}
}
}
+1 -2
View File
@@ -52,7 +52,6 @@ bool strcmp(char* str1, char* str2)
if(len1 != len2)
{
puts("Lengths different!\n");
return false;
}
for(int i = len1; i >= 0; i--)
@@ -113,7 +112,7 @@ void main()
//puts(5 / 0);
/* ...and leave this loop in. There is an endless loop in
* 'start.asm' also, if you accidentally delete this next line */
for (;;);
for (;;) idle();
}
void idle()