From WikiPrizm
Revision as of 18:19, 18 November 2014 by Gbl08ma (talk | contribs)
Jump to navigationJump to search


Header: fxcg/keyboard.h
Syscall index: 0x0D39
Function signature: void PRGM_GetKey_OS(unsigned char* p)

Reads the keyboard input without blocking.


  • p - pointer to 12 bytes unsigned char array that will receive the keyboard status.


0 if AC/on is pressed, 1 otherwise.


This syscall calls GetKeyWait_OS with KEYWAIT_HALTOFF_TIMEROFF as parameter, hence why it doesn't block.

p receives the keyboard status as a BCD-coded value. If no key is pressed, the BCD value is 0. If the AC/on key is pressed, the BCD value will have exponent 0xF00 and first nibble of the mantissa 1. Otherwise, it the BCD value will contain the key matrix-code, with the row number decremented by 1 to prevent the occurrence of an invalid BCD digit.

To yield the same function result as legacy syscall PRGM_GetKey, one can use this (taken from Simon Lothar's documentation):

int PRGM_GetKey(){
    unsigned char buffer[12];
    KBD_PRGM_GetKey( buffer );
    return ( buffer[1] & 0x0F ) * 10 + ( ( buffer[2]  & 0xF0 )  >> 4 );