BUG: BIOS data area and keyboard flags not working

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
Post Reply
Steve6375
Posts: 25
Joined: 4. Jul 2013, 22:19

BUG: BIOS data area and keyboard flags not working

Post by Steve6375 »

The BIOS data area uses various bits to keep the keyboard status on an IBM PC-compatible BIOS.
I noticed that VBOX does not fully implement this.
For instance, if you press the right-ctrl key, then memory location 0x496 bit 2 should be set, but it is not
Also, many of the 0x418 bits do not work under VBox.

The following is a grub4dos batch file KeyCheck.g4b.
I made a bootable USB drive and installed grub4dos to it using RMPrepUSB - Install Grub4dos - MBR=Yes. The grldr file was copied across to the USB drive.
Then I added the code below as a batch file \KeyCheck.g4b,
Now boot to the USB drive under VBox to the grub4dos console and run /KeyCheck.g4b
The same USBdrive when booted from a real system gives the correct results, but under VBOX, many keys do not work.

Code: Select all

!BAT
# Use BIOS Data Area to get keyboard status
# Some may not work under a VM (e.g. right-ctrl, insert on VBox)
# B417 ALT and CTRL will detect both left and right keys

pause --wait=2 Press keys now...

read 0x417 > nul
set /A B417=%@retval% > nul
calc %B417% & 0x80 > nul && echo INSERT
calc %B417% & 0x40 > nul && echo CAPS-LOCK
calc %B417% & 0x20 > nul && echo NUM-LOCK
calc %B417% & 0x10 > nul && echo SCROLL-LOCK
calc %B417% & 0x08 > nul && echo ALT (left or right)
calc %B417% & 0x04 > nul && echo CTRL (left or right)
calc %B417% & 0x02 > nul && echo LEFT-SHIFT
calc %B417% & 0x01 > nul && echo RIGHT-SHIFT

read 0x418 > nul
set /A B418=%@retval% > nul
calc %B418% & 0x80 > nul && echo INSERT KEY DOWN
calc %B418% & 0x40 > nul && echo CAPS-LOCK KEY DOWN
calc %B418% & 0x20 > nul && echo NUM-LOCK KEY DOWN
calc %B418% & 0x10 > nul && echo SCROLL-LOCK DOWN
calc %B418% & 0x08 > nul && echo SUSPEND TOGGLED
calc %B418% & 0x04 > nul && echo SYSTEM KEY DOWN
calc %B418% & 0x02 > nul && echo LEFT-ALT KEY DOWN
calc %B418% & 0x01 > nul && echo LEFT-CTRL KEY DOWN

read 0x497 > nul
set /A B497=%@retval% > nul
calc %B497% & 0x04 > nul && echo CAPS-LOCK LED ON
calc %B497% & 0x02 > nul && echo NUM-LOCK LED ON
calc %B497% & 0x01 > nul && echo SCROLL LOCK LED ON

read 0x496 > nul
set /A B496=%@retval% > nul
calc %B496% & 0x10 > nul && echo 101/102 KEY ENHANCED KBD
calc %B496% & 0x08 > nul && echo RIGHT-ALT GR KEY DOWN
calc %B496% & 0x04 > nul && echo RIGHT-CTRL KEY DOWN

michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: BUG: BIOS data area and keyboard flags not working

Post by michaln »

Do you have a testcase that works with real DOS? That would be much more useful.

At any rate, feel free to submit patches. Here's the code: https://www.virtualbox.org/svn/vbox/tru ... keyboard.c
Steve6375
Posts: 25
Joined: 4. Jul 2013, 22:19

Re: BUG: BIOS data area and keyboard flags not working

Post by Steve6375 »

So from code it seems 0x497 is not supported.
Also, I think right-Ctrl is not working because that is the special hotkey used by VBox - so it is an expected side-affect.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: BUG: BIOS data area and keyboard flags not working

Post by michaln »

Steve6375 wrote:Also, I think right-Ctrl is not working because that is the special hotkey used by VBox - so it is an expected side-affect.
Yes. To be exact, it's the default host key on platforms other than OS X. It can be configured to a different key. But when Right Ctrl is the host key, the guest will not see any activity on that key.
Post Reply