<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 31 Oct 1982 11:37:00-EST
From   : Roger L Long <BYTE@Mit-Mc>
Subject: Re: Fast sequences..

In order to handle fast escape sequences (of the form ESC-key), something
like the following might work:

TERMIN:        LXI     H,BUFCHR
       MOV     A,M
       ORA     A               ; is a character buffered?
       MVI     M,0
       RNZ                     ; yes, return the character
TERMI1:        IN      STAT
       ANI     MASK
       JNZ     TERMI1          ; wait for a character to appear
       IN      KEY             ; read the character
       ANI     7FH
       CPI     1BH             ; is it an ESCape?
       RNZ                     ; nope, return it as-is
       LXI     H,TIMVAL        ; wait for another character
TERMI2:        IN      STAT            ; ...calculate TIMVAL to that
       ANI     MASK            ; ...this loop will time out
       JZ      TERMI3          ; ...if an ESCape is sent alone
       DCX     H
       MOV     A,H
       ORA     L
       JNZ     TERMI2
       JMP     TERMI4          ; if time-out, return only ESCape
TERMI3:        IN      KEY
       ANI     7FH
       STA     BUFCHR          ; save next character in sequence
TERMI4:        MVI     A,1BH
       RET                     ; return ESCape

For the keypad keys, where the H19 returns a three-character sequence,
the time-out read could be placed in a subroutine, to wait for the 
fixed second-character value, and finally for the unique third
character value.  Only the third character need be saved.

       -roger
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>