Pascal III: Typeahead Killer

Pascal III: Typeahead Killer

The following program demonstrates how to control the typeahead feature of the
.CONSOLE driver.  The Standard Drivers Manual and the Pascal Programmer's
Manual explain how it works.
 
        PROGRAM KILL_TYPEAHEAD;
 
        VAR CH:         CHAR;
            COMMAND:    INTEGER;
 
        BEGIN
           WRITE (CHR (28));  GOTOXY (0,12);
           WRITE ('Typeahead: K)ill, R)estore, A)bort: ');
           REPEAT
              READ (KEYBOARD, CH);
           UNTIL CH IN ['K', 'k', 'R', 'r', 'A', 'a'];
           GOTOXY (0,12);
           CASE CH OF
              'K', 'k': BEGIN
                          COMMAND := 0;
                          UNITSTATUS (1, COMMAND, 19);
                          WRITE ('Typeahead is off.', CHR (31));
                        END;
              'R', 'r': BEGIN
                          COMMAND := 128;
                          UNITSTATUS (1, COMMAND, 19);
                          WRITE ('Typeahead is on.', CHR (31));
                        END;
              'A', 'a': WRITE ('Aborted...', CHR (31));
           END;  { CASE }
        END.