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