Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/36325

From BetaArchive Wiki

Recognizing the F11 and F12 Keys Using the _KEYBRD_READY PSS ID Number: Q36325 Article last modified on 01-12-1989 PSS database name: S_QuickC

1.01

MS-DOS

Question:

The _bios_keybrd(_KEYBRD_READY) does not recognize the F11 and F12 keys. Is there any way to have them accepted by the _KEYBRD_READY?

Response:

The program below shows that the F11 and F12 are not recognized by _KEYBRD_READY. Run the program, press a key to start the program, then strike the F12 or F11 keys. The keys are not recognized, while other keys work correctly.

The following code demonstrates this problem:

  1. include <stdio.h> #include <bios.h> #include <conio.h> void main(void);

void main() { unsigned service;

 getch();
 while( _bios_keybrd(_KEYBRD_READY) == 0)
     {
     printf(" will it work?\n");
     }

 printf("it worked....     YEA!\n");

}

The problem is that the C run time has hardcoded a check with the value 1 for the _KEYBRD_READY parameter; as a result, although you can pass _bios_keybrd() a 0x11, it will not work correctly. If you want to use _bios_keybrd() instead of a different input scheme, you can do the following:

  1. Do it in MASM.
  2. Modify the C library (take out the hardcoded check). Change the manifest constant ’_KEYBRD_READ’ from 0 to 0x10h hex.
  3. Make the Int 16h call yourself (do not use _bios_keybrd()) with Int86().

Copyright Microsoft Corporation 1989.