Hi, all,
I made a patch for proper Ctrl-Break handling. This is useful for MS-DOS
or compatible operating systems like FreeDOS.
When Ctrl-Break is detected, it clears the keyboard buffer, sets the
Ctrl-Break flag at [0040h:0071h], invokes int 1Bh and then adds 0000h to
the keyboard buffer. If a non-enhanced keyboard is present, Ctrl-Scroll
Lock works just like Ctrl-Break. This seems to be the "standard" BIOS
behaviour, at least on the PCs I tested.
The patch was tested with MS-DOS 6.22, running under qemu.
I'm new to git (and this is my first SeaBIOS patch ever), so I'm not
sure what's the preferred way to submit patches. I just did a "git diff"
and attached the result. Sorry if that's not the best way :)
Nikolay
diff --git a/src/kbd.c b/src/kbd.c
index 1977c5d..e85f92d 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -406,7 +406,6 @@ __process_key(u8 scancode)
}
// XXX - PrtScr should cause int 0x05
- // XXX - Ctrl+Break should cause int 0x1B
// XXX - SysReq should cause int 0x15/0x85
switch (scancode) {
@@ -474,12 +473,31 @@ __process_key(u8 scancode)
flags1 &= ~KF1_NUM;
break;
- case 0x46: /* Scroll Lock press */
- flags1 |= KF1_SCROLL;
- flags0 ^= KF0_SCROLLACTIVE;
+ case 0x46: /* Scroll Lock or Ctrl-Break press */
+ if (flags2 & KF2_LAST_E0
+ || (!(flags2 & KF2_101KBD) && (flags0 & KF0_CTRLACTIVE))) {
+ // Ctrl-Break press
+ flags2 &= ~KF2_LAST_E0;
+ SET_BDA(kbd_flag2, flags2);
+ SET_BDA(break_flag, 0x80);
+ SET_BDA(kbd_buf_tail, GET_BDA(kbd_buf_head));
+ asm volatile ("int $0x1B":::"memory");
+ enqueue_key(0, 0);
+ } else {
+ // Scroll Lock press
+ flags1 |= KF1_SCROLL;
+ flags0 ^= KF0_SCROLLACTIVE;
+ }
break;
- case 0xc6: /* Scroll Lock release */
- flags1 &= ~KF1_SCROLL;
+ case 0xc6: /* Scroll Lock or Ctrl-Break release */
+ if (flags2 & KF2_LAST_E0
+ || (!(flags2 & KF2_101KBD) && (flags0 & KF0_CTRLACTIVE))) {
+ // Ctrl-Break release
+ // nothing to do
+ } else {
+ // Scroll Lock release
+ flags1 &= ~KF1_SCROLL;
+ }
break;
case 0xe0:
_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios