Micro Vibe

My Micro Hobby Projects

  • Increase font size
  • Default font size
  • Decrease font size
Home PropTerm Documents Terminal Control

Terminal Control

Print

ANSI Terminal control commands act on a global basis. The “reset terminal” ANSI escape code is an example of a terminal control code. PropTerm supports a small set of terminal control codes and escape sequences. The ENQ control code is currently used by PropTerm in a non standard manner see the description below.

For more information about the general syntax of the PropTerm ANSI control codes and sequences see the ANSI Protocol page.

Terminal Control And Escape Codes:

Reset Terminal:  Esc c

The reset terminal escape code sets the terminal display state to its startup values and clears the display.

Save Terminal State:  Esc 7

The current state of the terminal is saved.  Use the "Restore Terminal State" escape code to restore a previously saved state.  The following terminal settings are saved; cursor position, scroll region, font color, background color, line wrap flag, and text attributes.  There is only one save location.  This means each time the save state command is executed by the terminal the prior save state is overwritten.  The ANSI terminal control sequence to save the current cursor location uses the same save buffer as the save terminal state escape code so the last of the two commands executed will effect what cursor location is saved.

Restore Terminal State:  Esc 8

The current state of the terminal is restored from the save state buffer written by the last "Save Terminal State" command.  The following terminal settings are restored; cursor position, scroll region, font color, background color, line wrap flag, and text attributes.  There is only one save location.  This means that once a save state command is executed you may call restore as many times as required to repeatedly restore the saved terminal state.

Enquire:  code 5 decimal, 05 hex"ENQ"

When the PropTerm terminal receives an enquire control code the terminal responds with an ACK control code (6 decimal).  The ACK response is not the default response for an ANSI terminal. An ANSI terminal will normally respond to an ENQ control code with an ANSWER BACK ID string to allow the host to determine the terminal type. The ENQ response was replaced by an escape control sequence in most ANSI terminals.

PropTerm uses the ENQ for another purpose. Different commands sent to the terminal require different amounts of time to complete. The ENQ control code can be used to determine when the terminal has completed the last command. This feature is intended to be used when the terminal is connected to the host with no serial port hardware flow control. Even at low baud rate the host could overrun the terminal receive buffer (receive buffer is 127 bytes). Commands such as; reset, load font, scroll up/down, and insert line take far longer to complete then writing a single character to the terminal display. By sending an ENQ control character right after a complex command the host will know when the command completed by the reception of an ACK control character from the terminal.