48h KB$GETK get a key
Input - none -
Output B register - ASCII value of key taken from buffer.
Description

Waits for a key press and returns it in the B register.

This routine uses the same code as KB$TEST. If there are no keys in the keyboard buffer, a SLP instruction is executed before next testing for a key, in order to save power. When a key is detected, it is removed from the buffer simply by clearing KBB_WAIT.

The auto-switch-off timeout counter TMW_TOUT is reset to the value in TMW_TCNT at the start of this routine, so the machine will not switch off in this routine for TMW_TCNT seconds.

Registers A and X are preserved.

LZ users, see also KB$CONK.

Example
        OS      KB$GETK                 ;WAIT FOR KEY PRESS
        CMPB    #0Dh
        BEQ     EXEKEY                  ;BRANCH IF EXECUTE KEY

        ;HERE IF ANY OTHER KEY

EXEKEY:
Errors - none -