Z88 Developers' Notes
Contents   Contents of System Calls

OS_Esc, examine special condition

RST 20H, DEFB $6F

IN:

     A = reason code

     Reason codes are as follows:

     SC_BIT ($00)   Test for Escape. Returns Fc = 1 if escape has been
                    pressed, else Fc = 0.

     SC_ACK ($01)   Acknowledge escape and also flush input buffer.
                    Fz = 1 if there was no escape to acknowledge, else
                    Fz = 0. Note that RC_ESC = SC_ACK so you can acknowledge
                    escape with this call without reloading the accumulator.
                    This also resets the machine timeout.

     SC_SET ($02)   Set escape, ie. simulate an escape condition

     SC_RES ($03)   Reset escape without flushing the input buffer.

     SC_TST ($04)   Test if escape detection is enabled or disabled. Fc = 0
                    always, and A = SC_ENA if it is enabled, A = SC_DIS if
                    it is disabled.

     SC_ENA ($05)   Enable escape detection
     SC_DIS ($06)   Disable escape detection.
OUT:
     if A(in) = SC_BIT then
          Fc = 0, no escape
          Fc = 1, escape detected
     if A(in) = SC_ACK then
          Fc = 0,
          Fz = 1, no escape
          Fz = 0, escape acknowledged, machine timeout reset
     if A(in) = SC_TST then
          Fc = 0
          A = SC_ENA, escape detection enabled
          A = SC_DIS, escape detection disabled
     other A(in) values
          Fc = 0
Registers changed after return:
     ..BCDEHL/IXIY same
     AF....../.... different

Related calls:
GN_Err, display an interactive error box
GN_Esp, return an extended pointer to a system error message
OS_Erc, get error context
OS_Erh, set error handler