Attached is a cleaned up version of my keyboard patch.
|^^^ | | |^^| |^^^ Drew Northup, N1XIM |^^| | |^^^ \ / /^^\ /^^~
|__ | | | | | |__| | |___ \/ |__| |__
| | | | | | www.plex86.org | | | /\ | | | \
___| |__| |__| |___ web.syr.edu/~suoc/ | |___ |___ / \ \__/ \__/
Index: user/plugins/bochs/iodev/keyboard.cc
===================================================================
RCS file: /cvsroot-plex86/plex86/user/plugins/bochs/iodev/keyboard.cc,v
retrieving revision 1.5
diff -u -r1.5 keyboard.cc
--- user/plugins/bochs/iodev/keyboard.cc 2000/12/14 15:58:51 1.5
+++ user/plugins/bochs/iodev/keyboard.cc 2001/06/12 05:46:27
@@ -554,7 +554,11 @@
void
bx_keyb_c::gen_scancode(Bit32u key)
{
- Bit8u scancode;
+ //this change makes the scancodes 16-bit
+ //I started to add more scancodes in the section below also
+ //Drew Northup, N1XIM 2001.02.23 (yyyy.mm.dd)
+ //Bit8u scancode;
+ Bit16u scancode;
if (bx_dbg.record_io) {
fprintf((FILE*)bx_dbg.record_io, "gen_scancode %lld %x\n",
bx_pc_system.time_ticks(), key);
@@ -578,12 +582,13 @@
switch (key & 0xff) {
case BX_KEY_CTRL_L: scancode = 0x1d; break;
- case BX_KEY_CTRL_R: scancode = 0x1d; break;
+ case BX_KEY_CTRL_R: scancode = 0xe01d; break;
case BX_KEY_SHIFT_L: scancode = 0x2a; break;
case BX_KEY_SHIFT_R: scancode = 0x36; break;
case BX_KEY_ESC: scancode = 0x01; break;
case BX_KEY_ALT_L: scancode = 0x38; break;
+ case BX_KEY_ALT_R: scancode = 0xe038; break;
case BX_KEY_A: scancode = 0x1e; break;
case BX_KEY_B: scancode = 0x30; break;
@@ -644,40 +649,40 @@
case BX_KEY_LEFT:
//bx_printf("# Grey left-arrow key not on 83-key keyboard\n");
- scancode = 0x4b; break;
+ scancode = 0xe04b; break;
case BX_KEY_RIGHT:
//bx_printf("# Grey right-arrow key not on 83-key keyboard\n");
- scancode = 0x4d; break;
+ scancode = 0xe04d; break;
case BX_KEY_UP:
//bx_printf("# Grey up-arrow key not on 83-key keyboard\n");
- scancode = 0x48; break;
+ scancode = 0xe048; break;
case BX_KEY_DOWN:
//bx_printf("# Grey down-arrow key not on 83-key keyboard\n");
- scancode = 0x50; break;
+ scancode = 0xe050; break;
case BX_KEY_KP_LEFT: scancode = 0x4b; break;
case BX_KEY_KP_RIGHT: scancode = 0x4d; break;
case BX_KEY_KP_UP: scancode = 0x48; break;
case BX_KEY_KP_DOWN: scancode = 0x50; break;
- case BX_KEY_INSERT:
- bx_printf("# Grey insert key not on 83-key keyboard\n");
- return;
- case BX_KEY_DELETE:
- bx_printf("# Grey delete key not on 83-key keyboard\n");
- return;
- case BX_KEY_HOME:
- bx_printf("# Grey home key not on 83-key keyboard\n");
- return;
- case BX_KEY_END:
- bx_printf("# Grey end key not on 83-key keyboard\n");
- return;
- case BX_KEY_PAGE_UP:
- bx_printf("# Grey page-up key not on 83-key keyboard\n");
- return;
- case BX_KEY_PAGE_DOWN:
- bx_printf("# Grey page-down key not on 83-key keyboard\n");
- return;
+ case BX_KEY_INSERT: scancode = 0xe052; break;
+ //bx_printf("# Grey insert key not on 83-key keyboard\n");
+ //return;
+ case BX_KEY_DELETE: scancode = 0xE053; break;
+ //bx_printf("# Grey delete key not on 83-key keyboard\n");
+ //return;
+ case BX_KEY_HOME: scancode = 0xe047; break;
+ //bx_printf("# Grey home key not on 83-key keyboard\n");
+ //return;
+ case BX_KEY_END: scancode = 0xe04f; break;
+ //bx_printf("# Grey end key not on 83-key keyboard\n");
+ //return;
+ case BX_KEY_PAGE_UP: scancode = 0xe049; break;
+ //bx_printf("# Grey page-up key not on 83-key keyboard\n");
+ //return;
+ case BX_KEY_PAGE_DOWN: scancode = 0xe051; break;
+ //bx_printf("# Grey page-down key not on 83-key keyboard\n");
+ //return;
case BX_KEY_KP_INSERT: scancode = 0x52; break;
case BX_KEY_KP_DELETE: scancode = 0x53; break;
@@ -689,15 +694,15 @@
case BX_KEY_KP_ADD: scancode = 0x4e; break;
case BX_KEY_KP_SUBTRACT: scancode = 0x4a; break;
case BX_KEY_KP_5: scancode = 0x4c; break;
- case BX_KEY_KP_ENTER:
- bx_printf("# Grey Enter key not on 83-key keyboard\n");
- return;
- case BX_KEY_KP_MULTIPLY:
- bx_printf("# Grey Multiply key not on 83-key keyboard\n");
- return;
- case BX_KEY_KP_DIVIDE:
- bx_printf("# Grey Divide key not on 83-key keyboard\n");
- return;
+ case BX_KEY_KP_ENTER: scancode = 0xe01c; break;
+ //bx_printf("# Grey Enter key not on 83-key keyboard\n");
+ //return;
+ case BX_KEY_KP_MULTIPLY: scancode = 0x37; break;
+ //bx_printf("# Grey Multiply key not on 83-key keyboard\n");
+ //return;
+ case BX_KEY_KP_DIVIDE: scancode = 0xe035; break;
+ //bx_printf("# Grey Divide key not on 83-key keyboard\n");
+ //return;
case BX_KEY_NUM_LOCK: scancode = 0x45; break;
case BX_KEY_F1: scancode = 0x3b; break;
@@ -710,6 +715,8 @@
case BX_KEY_F8: scancode = 0x42; break;
case BX_KEY_F9: scancode = 0x43; break;
case BX_KEY_F10: scancode = 0x44; break;
+ case BX_KEY_F11: scancode = 0x57; break;
+ case BX_KEY_F12: scancode = 0x58; break;
default:
bx_printf("# bx_keyb_c::gen_scancode : Unhandled %u\n",
@@ -836,7 +843,7 @@
void
-bx_keyb_c::kbd_enQ(Bit8u scancode)
+bx_keyb_c::kbd_enQ(Bit16u scancode) //I changed this to 16-bits Drew Northup, N1XIM
+2001.02.23
{
int tail;
Index: user/plugins/bochs/iodev/keyboard.h
===================================================================
RCS file: /cvsroot-plex86/plex86/user/plugins/bochs/iodev/keyboard.h,v
retrieving revision 1.2
diff -u -r1.2 keyboard.h
--- user/plugins/bochs/iodev/keyboard.h 2000/08/13 20:25:20 1.2
+++ user/plugins/bochs/iodev/keyboard.h 2001/06/12 05:46:28
@@ -81,7 +81,7 @@
Boolean aux_clock_enabled;
Boolean allow_irq1;
Boolean allow_irq12;
- Bit8u kbd_output_buffer;
+ Bit16u kbd_output_buffer; //changed to 16-bit Drew Northup, N1XIM 2001.02.23
Bit8u aux_output_buffer;
Bit8u last_comm;
Bit8u expecting_port60h;
@@ -170,7 +170,7 @@
BX_KEY_SMF void set_aux_clock_enable(Bit8u value);
BX_KEY_SMF void kbd_ctrl_to_kbd(Bit8u value);
BX_KEY_SMF void kbd_ctrl_to_mouse(Bit8u value);
- BX_KEY_SMF void kbd_enQ(Bit8u scancode);
+ BX_KEY_SMF void kbd_enQ(Bit16u scancode); //changed to 16-bit Drew Northup,
+N1XIM 2001.02.23
BX_KEY_SMF void kbd_enQ_imm(Bit8u val);
BX_KEY_SMF void activate_timer(void);
BX_KEY_SMF void controller_enQ(Bit8u data, unsigned source);