OS_Cli, CLI interface

Register parameters

RST 20H, DEFB $84
 IN:
     A = CL_CNT ($00), get CLI use count

     A = CL_RIM ($01), get raw input
          BC = timeout in 1/100 second ticks
          BC = 0, return immediately if no data
          BC = -1 ($FFFF), wait forever for data

     A = CL_MBC ($02), meta/base to character conversion
          DE = meta (D) / base (E)
               D = $01   SHIFT
                 = $02   CTRL (DIAMOND)
                 = $04   ALT (SQUARE)
                 = $08   special
               E = base character

     A = CL_CMB ($03), character to meta/base conversion
          DE = raw character
               D = 0, E is ISO character
               D = 1, E is special character

     A = CL_INC ($04), increment CLI use count
     A = CL_DEC ($05), decrement CLI use count
     A = CL_RES ($06), reset CLI use count

     A = CL_ACK ($07), acknowledge CLI/Escape
          D = reset mask (zero to reset):
               CLM_SH ($01) = SHIFT (bit)
               CLM_CT ($02) = DIAMOND (bit)

OUT, A(in) = CL_CNT, always:
     Fc = 0
     A  = CLI use count (A = 0 if no active CLI)
     IX = keyboard variable frame

Registers changed after return:
     ..BCDEHL/..IY same
     AF....../IX.. different

OUT, A(in) = CL_RIN, successful:
     Fc = 0
     BC = remaining timeout
     DE = character:
          D = 0, E is ISO character
          D = 1, E is special character
OUT, A(in) = CL_RIN, failed:
     Fc = 1
          A = RC_ESC
          A = RC_SUSP
          A = RC_TIME

Registers changed after return:
     ......HL/IXIY same
     AFBCDE../.... different

OUT, A(in) = CL_MBC, successful:
     Fc = 0
     DE = character:
          D = 0, E is ISO character
          D = 1, E is special character
OUT, A(in) = CL_MBC, failed:
     Fc = 1
          A = RC_FAIL, not a meaningful character

Registers changed after return:
     ..BC..HL/IXIY same
     AF..DE../.... different

OUT, A(in) = CL_CMB, successful:
     Fc = 0
     DE = meta (D) / base (E)
          D = $01   SHIFT
            = $02   CTRL (DIAMOND)
            = $04   ALT (SQUARE)
            = $08   special
          E = base character

OUT, A(in) = CL_CMB, failed:
     Fc = 1
          A = RC_FAIL, not a meaningful character

Registers changed after return:
     ..BC..HL/IXIY same
     AF..DE../.... different

OUT, A(in) = CL_INC, CL_DEC, CL_RES always:
     Fc = 0

Registers changed after return:
     A.BCDEHL/IXIY same
     .F....../.... different

OUT, A(in) = CL_ACK, always:
     Fc = 0
     Fz = 1, no Escape
     Fz = 0, Escape
     D = resulting mask

Registers changed after return:
     A.BCDEHL/IXIY same
     .F....../.... different

Notes

Internal operating system usage. 

CL_CNT can be used to ask system if there is an active CLI.

Related calls

DC_Icl, Invoke new CLI
DC_In, Read from CLI
DC_Out, Write to CLI
DC_Prt, Print to CLI
DC_Rbd, Rebind streams
DC_Xin, examine CLI input
DC_Gen, screen driver SOH call