[SeaBIOS] [SeaBIOS PATCH] ALT+NUMPAD and INT15 compatiblity patches

Yeong Uk Jo greatpsycho at yahoo.com
Thu Jul 26 08:50:54 CEST 2012


Includes two patches.

1. Add ALT+NUMPAD function to keyboard handler.
2. INT15 AH=80,81,82,90,91 return success like many BIOSes do.

Signed-off-by:  Yeong-uk Jo<greatpsycho at yahoo.com>
---
 src/kbd.c    |   34 +++++++++++++++++++++++-----------
 src/system.c |   26 ++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 11 deletions(-)

diff --git a/src/kbd.c b/src/kbd.c
index e9ea594..b100008 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -358,18 +358,18 @@ static struct scaninfo {
     { 0x4400, 0x5d00, 0x6700, 0x7100, none }, /* F10 */
     {   none,   none,   none,   none, none }, /* Num Lock */
     {   none,   none,   none,   none, none }, /* Scroll Lock */
-    { 0x4700, 0x4737, 0x7700,   none, MNUM }, /* 7 Home */
-    { 0x4800, 0x4838,   none,   none, MNUM }, /* 8 UP */
-    { 0x4900, 0x4939, 0x8400,   none, MNUM }, /* 9 PgUp */
+    { 0x4700, 0x4737, 0x7700, 0xf700, MNUM }, /* 7 Home */
+    { 0x4800, 0x4838,   none, 0xf800, MNUM }, /* 8 UP */
+    { 0x4900, 0x4939, 0x8400, 0xf900, MNUM }, /* 9 PgUp */
     { 0x4a2d, 0x4a2d,   none,   none, none }, /* - */
-    { 0x4b00, 0x4b34, 0x7300,   none, MNUM }, /* 4 Left */
-    { 0x4c00, 0x4c35,   none,   none, MNUM }, /* 5 */
-    { 0x4d00, 0x4d36, 0x7400,   none, MNUM }, /* 6 Right */
+    { 0x4b00, 0x4b34, 0x7300, 0xf400, MNUM }, /* 4 Left */
+    { 0x4c00, 0x4c35,   none, 0xf500, MNUM }, /* 5 */
+    { 0x4d00, 0x4d36, 0x7400, 0xf600, MNUM }, /* 6 Right */
     { 0x4e2b, 0x4e2b,   none,   none, none }, /* + */
-    { 0x4f00, 0x4f31, 0x7500,   none, MNUM }, /* 1 End */
-    { 0x5000, 0x5032,   none,   none, MNUM }, /* 2 Down */
-    { 0x5100, 0x5133, 0x7600,   none, MNUM }, /* 3 PgDn */
-    { 0x5200, 0x5230,   none,   none, MNUM }, /* 0 Ins */
+    { 0x4f00, 0x4f31, 0x7500, 0xf100, MNUM }, /* 1 End */
+    { 0x5000, 0x5032,   none, 0xf200, MNUM }, /* 2 Down */
+    { 0x5100, 0x5133, 0x7600, 0xf300, MNUM }, /* 3 PgDn */
+    { 0x5200, 0x5230,   none, 0xf000, MNUM }, /* 0 Ins */
     { 0x5300, 0x532e,   none,   none, MNUM }, /* Del */
     {   none,   none,   none,   none, none },
     {   none,   none,   none,   none, none },
@@ -385,6 +385,7 @@ __process_key(u8 scancode)
     u8 flags0 = GET_BDA(kbd_flag0);
     u8 flags1 = GET_BDA(kbd_flag1);
     u8 flags2 = GET_BDA(kbd_flag2);
+    u8 asciicode;
 
     if (flags2 & KF2_LAST_E1) {
         // Part of "pause" key (sequence is e1 1d 45 e1 9d c5)
@@ -462,6 +463,13 @@ __process_key(u8 scancode)
             flags2 &= ~KF2_RALT;
         else
             flags1 &= ~KF1_LALT;
+
+        /* Process ALT + NUMPAD */
+        if((asciicode = GET_BDA(alt_keypad)))
+        {
+            enqueue_key(0, asciicode);
+            SET_BDA(alt_keypad, 0);
+        }
         break;
 
     case 0x45: /* Num Lock press */
@@ -506,11 +514,15 @@ __process_key(u8 scancode)
                     , scancode);
             return;
         }
-        u8 asciicode;
         struct scaninfo *info = &scan_to_scanascii[scancode];
         if (flags0 & KF0_ALTACTIVE) {
             asciicode = GET_GLOBAL(info->alt);
             scancode = GET_GLOBAL(info->alt) >> 8;
+            if((scancode & 0xf0) == 0xf0)
+            {
+                SET_BDA(alt_keypad, GET_BDA(alt_keypad) * 10 + (scancode & 0x0f));
+                scancode = 0;
+            }
         } else if (flags0 & KF0_CTRLACTIVE) {
             asciicode = GET_GLOBAL(info->control);
             scancode = GET_GLOBAL(info->control) >> 8;
diff --git a/src/system.c b/src/system.c
index 6658e22..00aba7c 100644
--- a/src/system.c
+++ b/src/system.c
@@ -80,6 +80,27 @@ handle_1552(struct bregs *regs)
     set_code_success(regs);
 }
 
+// Device open
+static void
+handle_1580(struct bregs *regs)
+{
+    set_code_success(regs);
+}
+
+// Device close
+static void
+handle_1581(struct bregs *regs)
+{
+    set_code_success(regs);
+}
+
+// Process termination
+static void
+handle_1582(struct bregs *regs)
+{
+    set_code_success(regs);
+}
+
 static void
 handle_1587(struct bregs *regs)
 {
@@ -230,12 +251,14 @@ handle_1589(struct bregs *regs)
 static void
 handle_1590(struct bregs *regs)
 {
+    set_code_success(regs);
 }
 
 // Interrupt complete.  Called by Int 16h when key becomes available
 static void
 handle_1591(struct bregs *regs)
 {
+    set_code_success(regs);
 }
 
 // keyboard intercept
@@ -349,6 +372,9 @@ handle_15(struct bregs *regs)
     case 0x52: handle_1552(regs); break;
     case 0x53: handle_1553(regs); break;
     case 0x5f: handle_155f(regs); break;
+    case 0x80: handle_1580(regs); break;
+    case 0x81: handle_1581(regs); break;
+    case 0x82: handle_1582(regs); break;
     case 0x83: handle_1583(regs); break;
     case 0x86: handle_1586(regs); break;
     case 0x87: handle_1587(regs); break;
-- 
1.7.10



More information about the SeaBIOS mailing list