This subroutine gets a keycode from the keyboard. If the buffer is not empty
then a value is read and removed from the buffer. If the buffer is empty then
the function waits for a keyboard input. The value of K assigned such that if
the high byte is equal to 0 then the low byte is the ASCII value for the key
pressed. If the high byte is equal to 1 then the low byte is the scan code for
a Function key or an ALT key combination (the scan code is then K-256).