Skip to contentSkip to conversation

Fix for DOS keyboard problems

PATCH New Stefan Ring 1 participant 1 message Aug 18, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix for DOS keyboard problems

Scratching an itch for myself, I have created a patch that allows me to use Turbo Pascal and other Turbo Vision-based programs from DOS. I post it here in the hope that someone take a good look, and maybe, there's even a chance of this going into mainline. I verified that it doesn't break keyboard or mouse functionality in Win 3.11, Win 2000 and Linux X11 (from systemrescuecd 1.1.4) as well as some DOS games. Couldn't get win98 to run, unfortunately, so no testing there. However, there is always the chance that it might break some random obscure stuff, and clearly I cannot test everything.

The patch basically exploits the fact that the BIOS IRQ 1 handler always does <disable keyboard> - <read 60h> - <enable keyboard> in this order. We just remember the last value read from port 60h outside this disable/enable block and play it back inside. The keyboard is still very unreliable when a keyboard driver is loaded inside DOS (I assume that the keyboard driver completely disables the BIOS handler). This behavior is also present without my patch, and I personally don't care about it, so this should not be an obstacle.

I also didn't know what to do about kbd_save and kbd_load just because I didn't dig into them to find out what they are used for. The new member should probably be serialized there.

My ultimate hope would be to get this into VirtualBox (see ticket #58 [1]). It should be easy enough to adapt the patch to VirtualBox; I will try to do that within the next few days.

[1] http://www.virtualbox.org/ticket/58