Video Systems Reference Manual
Character Cell Display

Document Identifier: A-DS-EL00070-05-0 Rev. AX12, 29-Jun-1990 

Abstract

This section includes the definition of all state information required for the Character Cell Display service class, as well as all interface operations which may be performed to affect this state.

Applicability

Mandatory for Engineers designing hardware for terminal products and Software Engineers designing programs using terminal interfaces. Additional requirements are defined in the section on "Concepts and Conformance Criteria".

Status

FOR REVIEW ONLY

Title
VIDEO SYSTEMS - Character Cell Display
Document Identifier
A-DS-EL00070-05-0 Rev. AX12, 29-Jun-1990
Revision History
Original Draft15-Jul-1982
Revision 0.430-Sep-1982
Revision 0.525-Dec-1982
Revision AX0128-Feb-1983
Revision AX1015-May-1983
Revision AX1118-Mar-1985
Files
User DocumentationEL070S5.mem
Internal DocumentationEL070S5.rno
EL070S5.rnt
EL070S5.rnx
Document Management Group
Terminal Interface Architecture (STI)
Responsible Department
VIPS Terminals Architecture
Responsible Person
Peter Sichel
Approval

This document prepared by the VIPS (Video Image & Printing Systems) Group has been reviewed and recommended for approval by the general review group for its category for use throughout Digital.

*** Status: For Review Only ***
_________________________________________ Peter Sichel,
VIPS Terminals Architecture

*** Status: For Review Only ***
________________________________________ Eric Williams,
Standards Process Manager

Direct requests for further information to Peter Sichel, DSG1-⁠2/⁠C7, DTN 235-8374, HANNAH::TERMARCH

Copies of this document can be ordered from Standards and Methods Control, CTS1-2/D4, DTN 287-3724, JOKUR::SMC

Contents

Chapter 5
Character Cell Display

  1. Introduction5-6
    1. Purpose5-6
    2. Scope5-6
    3. Relationship To TIA5-7
    4. Organization5-9
  2. Terminology5-9
    1. Code Extension Terms5-13
  3. Character Cell Display State Declarations5-15
    1. Notes On Character Cell Display State5-17
  4. Display Coordinate System And Addressing5-19
    1. Logical Display5-19
    2. Active Position And Cursor5-20
    3. Margins And Scrolling5-23
    4. Cursor Movement5-40
    5. Horizontal Tabulation5-65
    6. Page Size And Arrangement5-70
    7. Page Movement5-77
  5. Windowing Extension5-84
  6. Visual Renditions5-93
    1. Line Renditions5-95
    2. Character Renditions5-101
      1. Normal Rendition5-101
      2. Bold Rendition5-101
      3. Blink Rendition5-101
      4. Underscore Rendition5-102
      5. Reverse Rendition5-102
    3. ANSI Color Text Extension5-106
      1. SGR Color Selection5-106
      2. Interaction With Other Visual Renditions5-106
      3. Color Maps5-107
      4. Color Table Report (DECCTR)5-109
      5. Default Color Assignment (Guideline)5-110
      6. Color Interaction Among Modes And Data
        Syntaxes (Guideline)
        5-112
      7. Alternative Text Rendition Mapping
        (Guideline)
        5-112
  7. Audible Indicator5-114
  8. Graphic Character Sets5-115
    1. Character Set Repertoire5-115
    2. Character Set Selection5-116
  9. Summary Of Control Character Processing5-128
    1. C0 Control Characters5-128
    2. C1 Control Characters5-130
  10. Modes States (And Mode Descriptions)5-133
    1. SM/RM - Set Mode, Reset Mode Sequence5-133
      1. ANSI Specified Modes:5-133
      2. DEC Private Modes:5-133
      3. Modes That Cannot Be Changed5-134
    2. Mode Descriptions5-134
  11. Editing Functions5-137
    1. Character Attributes5-165
      1. Normal Character Attribute5-165
      2. Selectively Erasable Character Attribute5-165
  12. OLTP Features5-168
    1. Rectangular Area Operations5-168
    2. Data Integrity5-179
    3. Macros5-182
  13. Saving And Restoring Terminal State5-186
    1. Cursor Save Buffer5-186
    2. Terminal State Interrogation5-191
  14. Internal Functions And Procedures5-209
    1. End Of Line5-209
    2. Scroll Up5-210
    3. Scroll Down5-211
    4. Scroll Left5-212
    5. Scroll Right5-213
  15. Control Function Reference To Other Chapters5-214
  16. Change History5-216
    1. Rev 0.4 To 0.55-216
    2. Revision 0.5 To AX105-218
    3. Rev AX10 To AX115-220
    4. Rev AX11 To AX125-221
  17. Reference Standards5-225

5.1 Introduction

5.1.1 Purpose

This section defines the interface to a Character Cell Display device. A Character Cell Display device is a device capable of character imaging output. In addition to the physical presentation of graphic characters, it must provide certain control functions for defining the format and rendition of the information presented.

The Character Cell service class consists of operations that image or format characters that are addressed on the imaging surface using a character cell addressing capability. All Character Cell operations are either graphic (printing) characters or control functions (control characters, escape sequences, control sequences, or control strings) according to the structure of ANSI X3.41, Code Extension Techniques for use with ASCII, and ANSI X3.64, Additional Control Functions for use with ASCII.

Character Cell Display devices are distinguished from Character Cell Printing devices by their ability to perform certain dynamic operations, such as inserting characters within text, erasing previously displayed characters, and blinking.

The Character Cell Display service class consists of operations that:

  1. image characters on a two-dimensional display surface that represent text or picture drawing symbols,

  2. alter their position after receipt

  3. remove them from the display, and

  4. cause them to be re-transmitted.

The intent of the Character Cell Display service class is to be implementable using a character generator or a minimum of a single plane image memory.

5.1.2 Scope

This section applies to all DEC products which implement these interfaces and are intended to be certified as conforming to the Terminal Interface Architecture. It also applies to software which is intended to use these interfaces in a conforming manner.

5.1.3 Relationship To TIA

The Character Cell interface forms a service class of the Presentation Service Class layer of the Terminal Interface Architecture. It is independent of the other layers of the architecture, and has no explicit relationship to other service classes within the Presentation Service Class layer.

                                 USER

..........  -----------------------------------------------
.        .  |                                             |
.        .  |              Input Processing               |
.        .  |                                             |
.        .  |                                             |
.  T  M  .  -----------------------------------------------
.  e  a  .  -----------------------------------------------
.  r  n  .  | ===============                             |
.  m  a  .  | || Character ||       Presentation          |
.  i  g  .  | ||   Cell    ||       Service Class         |
.  n  e  .  | ||  Display  ||                             |
.  a  m  .  | ===============                             |
.  l  e  .  -----------------------------------------------
.     n  .  -----------------------------------------------
.     t  .  |                                             |
.        .  |                Code Extension               |
.        .  |                    Layer                    |
.        .  |                                             |
..........  -----------------------------------------------


                           APPLICATION PROCESS

Structuring of the Terminal Interface Architecture

The interfaces defined within this specification apply to both internal and external product interfaces. External interfaces are interfaces between a terminal, personal computer or workstation and a remote system. Internal interfaces are interfaces between a terminal sub-system and software processes running within a terminal, personal computer or workstation.

                          *
                          *
      terminal system     *                        host system
--------------------------*                      ---------------
|            |            *                      |             |
|  physical  |  virtual   *..........            | application |
|  terminal  |  terminal  *        ..............|   process   |
|            |            *                      |             |
--------------------------*                      ---------------
  <hardware>   <firmware> * <communications link>   <software>
                          *
                          *
                          * EXTERNAL INTERFACE





                          *
                          *
              terminal system
--------------------------*--------------
|            |            *             |
|  physical  |  virtual   * application |
|  terminal  |  terminal  *   process   |
|            |            *             |
--------------------------*--------------
  <hardware>   <software/ *  <software>
                firmware> *
                          *
                          * INTERNAL INTERFACE



External and Internal Terminal Interfaces

5.1.4 Organization

To simplify understanding the Character Cell Display service class, this section is divided into a number of largely independent subsections which describe functionally related parts of the ANSI host interface. These subsections are:

Other sections of the VSRM also describe parts of the ANSI host interface.

5.2 Terminology

Active Position
(1) The character position in a visual display that is to image the graphic symbol representing the next graphic or control character for which a graphic representation is required (2) The character position in a logical display which contains the character code, graphic rendition, and character set of a graphic or control character for which a graphic representation is required.
Advance
To move the active position in the direction of increasing horizontal character position in a visual or logical display.
Application
A hardware or software implementation of a process or a device.
Application Program
A program that runs under control of an operating system.
Audible Indicator
A warning "bell", or similar indicator suitable to signal the operator's attention, primarily to warn of certain error conditions. There are four functional categories of bells in conforming terminals: Right Margin Bell, Warning Bell, Required Error Bells, and Selectable Error Bells.
Backward
In the direction of decreasing horizontal character position in a visual or logical display.
Blind Interchange
Information interchange in which no prior agreements between sender and recipient are necessary in order to achieve successful interpretation of the information, except agreed-upon standards.
C0 Set
A set of 32 control characters allocated to columns 0 and 1 of a code table.
C1 Set
A set of 32 control characters allocated to columns 8 and 9 of an 8-bit code table, or represented as ESCape Fe sequences in 7-bit environment with identical meaning.
Character Attribute
An attribute value which may be applied to a character position, which affects its subsequent processing, as in editing or retransmission.
Character Imaging Device
A device that gives a visual representation of data in the form of graphic symbols using any technology, such as a on a cathode ray tube. In this specification the term "character imaging device" does not apply to hard copy devices (printers) which are not capable of dynamic editing and reformatting of the displayed information.
Character Position
(1) The portion of a visual display that images or is capable of imaging a graphic symbol. (2) An addressable element in a logical display containing sufficient information to render a graphic symbol, including the character code, visual attributes, logical attributes, and character set designation.
Character Rendition
An attribute value which may be applied to a character position, which affects its visual representation (see Graphic Rendition).
Control
A control character, an escape sequence, or a control sequence that performs a control function.
Control Sequence Introducer (CSI)
The C1 control (represented by a single character in 8-bits, or a two character ESC Fe sequence in 7-bits) which initiates a control sequence. CSI is a prefix affecting the interpretation of a limited number of contiguous bit combinations.
Cursor, Cursor Symbol
A visual (blinking or non-blinking) symbol, usually a rectangle, diamond or underline that indicates the Active Position on the display.
Cursor Control
An editing function that moves the active position.
Default
A function-dependent value that is assumed when no explicit value, or a value of 0, is specified.
Delete
To remove displayed symbols and close up adjacent graphic symbols to fill the gap.
Designate
To identify a set of characters that are to be represented in a prescribed manner, in some cases immediately and in others on the occurrence of a further control function.
Display
The area for visual presentation of data on cathode ray tube and similar character imaging devices. In this specification the word "display" will always be qualified by the terms "physical" (or "visual") and "logical", to differentiate between the actual presentation surface and memory buffers containing information to be presented.
Editor Function
A control that affects the layout or positioning of previously entered or received information in a character imaging device and is intended to be interpreted without remaining in the data stream. See Format Effector.
Empty Character
A character position in the logical display in which no character code appears, and thus no character is rendered in the visual display for this position. In an empty character position the character rendition, character attribute, and character set values should be ignored.
Enter
To input information manually into a character imaging device or to read information from an auxiliary device into a character imaging device.
Erase
To remove displayed graphic symbols without closing up adjacent symbols to fill the gap.
Fixed Space
A character that normally has no graphic representation, occupies a character position in a visual display, and is usually encoded as bit combination 2/0.
Following
Lines or character positions in the visual display with larger numbered lines or larger numbered character positions than that of the active position.
Font
A complete assortment of displayable graphic symbols in one size or style.
Format Effector
A control that effects the layout or positioning of information in a character imaging device and may remain in the data stream subsequent to interpretation and processing. See Editor Function.
Forward
In the direction of increasing horizontal character position in a visual display.
Graphic Character
A character, other than a control character, that has a visual representation normally handwritten, printed, or displayed.
Graphic Rendition
A visual style of displaying a set of graphic symbols.
Graphic Symbol
A visual representation of a graphic character or a control for which a graphic representation is required.
Invoke
To cause a designated set of characters to be represented by the prescribed bit combinations whenever those bit combinations occur until an appropriate code extension function occurs.
Line
A set of adjacent character positions in a visual display that have the same vertical position.
Logical Display
the lines and columns available for storing and presenting graphic characters as seen by the application or host computer. A Logical Display may be organized as a single rectangular array of lines and columns (one page), or divided into a number of identically sized pages, each of which is a rectangular array of lines and columns.
Margin
A line which marks the upper or lower boundary of the scrolling region (vertical scroll margin). A column which marks the left or right boundary of the scrolling region (horizontal scroll margin).
Mode
A state of a device, or other sender or recipient, that affects the interpretation of received information, the operation of the sender or recipient, or the format of the transmitted information.
Next
See Following.
Operating System
Software that controls the execution of computer programs and may provide scheduling, debugging, input/⁠output control, accounting, compilation, storage assignment, data management, and related services.
Page
An addressable area of a Logical Display organized as a rectangular array of lines and columns. The number of lines and columns defines the Page Size.
Preceding
Lines or character positions in a visual display with smaller numbered lines or smaller numbered character positions than that of the active position.
Private Use
A technique of encoding or representing information in a prescribed, but nonstandard, way.
Received Data Stream
The stream of bit combinations received by a character imaging device for purposes of information interchange.
Represent
(1) To use a prescribed bit combination with the meaning of a character in a set of characters that has been designated and invoked. (2) To use an escape sequence with the meaning of an additional control character.
Scroll
An action whereby all of the graphic symbols of a visual display are moved in a specified direction.
String Delimiter
A control that begins or ends a string of characters in a data stream.
Tabulation
A technique of identifying character positions in a visual display for the purpose of arranging information systematically.
Tabulation Stop
An indication that a character position is to be used for tabulation.
Transmit
To send data as a data stream for purposes of information interchange.
Transmitted Data Stream
The stream of bit combinations sent by a character imaging device when it is induced to transmit for purposes of information interchange.

5.2.1 Code Extension Terms

This chapter also uses the following terms which are defined in the "Code Extension Layer" section of the VSRM (DEC STD 70-3):

  • Bit Combination
  • Character
  • Control Character
  • Control Function
  • Control Sequence
  • Control String
  • Escape Character (ESC)
  • Escape Sequence
  • Final Character
  • Intermediate Character
  • Numeric Parameter
  • Parameter
  • Parameter String
  • Selective Parameter

5.3 Character Cell Display State Declarations

/**************  module char_cell_types.h  *************/
/*
 * type declarations for character cell display state
 * PAS 28-Jul-1989
 */

typedef enum { JUMP, SLOW } scrolling_mode_t;
typedef enum { NORMAL_SCREEN, REVERSE_SCREEN } screen_mode_t;
typedef enum { WRAP_OFF, WRAP_ON } auto_wrap_mode_t;
typedef enum { TEXT_CURSOR_OFF, TEXT_CURSOR_ON }
    text_cursor_enable_mode_t;
typedef enum { INSERT, REPLACE } insert_replace_mode_t;
typedef enum { NEW_LINE_OFF, NEW_LINE_ON } new_line_mode_t;
typedef short int line_t;
typedef short int column_t;
typedef short int page_t;
typedef struct
    {         /* character_position_t */
    line_t line;
    column_t column;
    page_t page;
    } character_position_t;
typedef enum { TRUE, FALSE } boolean_t;
typedef struct
    {         /* character_rendition_t */
    boolean_t bold;
    boolean_t blink;
    boolean_t underscore;
    boolean_t reverse;
    } character_rendition_t;
typedef struct
    {        /* character_attribute_t */
    boolean_t selective_erase;
    } character_attribute_t;
typedef enum
    {        /* line_rendition_t */
    DOUBLE_HEIGHT_TOP,
    DOUBLE_HEIGHT_BOTTOM,
    SINGLE_WIDTH,
    DOUBLE_WIDTH
    } line_rendition_t;
typedef struct
    {       /* character_t */
    short int code;
    character_rendition_t rendition;
    character_attribute_t attribute;
    graphic_character_set_t character_set;
    } character_t;
typedef struct
    {       /* char_set_designator_t */
    graphic_character_set_t name;
    short int first_intermediate;    /* 0-47, 0=no intermediate */
    short int second_intermediate;   /* 0-47 */
    short int final;                 /* 0 indicates null entry */
    } char_set_designator_t;
typedef enum { ABSOLUTE, DISPLACED } origin_mode_t;
typedef struct
    {      /* save_buffer_t */
    character_position_t position;
    character_rendition_t rendition;
    origin_mode_t origin_mode;
    graphic_character_set_t left;
    graphic_character_set_t right;
    graphic_character_set_t g0;
    graphic_character_set_t g1;
    graphic_character_set_t g2;
    graphic_character_set_t g3;
    character_attribute_t attribute;
    } save_buffer_t;
typedef enum { EIGHTY, ONE_THIRTY_TWO } column_mode_t;
typedef enum { UNCOUPLED, COUPLED } cursor_coupling_mode_t;
typedef enum { FIXED, SETABLE } left_right_margins_mode_t;
typedef enum { STREAM, RECTANGULAR } area_extent_t;
typedef short int lines_per_page_t;    /* 24, 25, 36, 72, 144 */
typedef short int columns_per_page_t;  /* 80, 132 */
typedef short int number_of_pages_t;   /* 1, 2, 3, 4, 5, 6 */
/************ end of char_cell_types.h  ****************/




/**************  module char_cell_extern.h  *************/
/*
 * external storage declarations for character cell display state
 * PAS 28-Jul-1989
 */

#define MAX_NUM_LINES 73
#define MAX_NUM_COLUMNS 133
#define EMPTY_CHARACTER 0
#define MAX_NUM_CHAR_SETS 8
/* character set table entries */
#define TABLE_ASCII 0
#define TABLE_LINE_DRAWING 1
#define TABLE_DEC_SUPP 2
#define TABLE_NRCS 3
#define TABLE_LATIN1 4
#define TABLE_UPSS 5
#define TABLE_TCS 6
#define TABLE_DRCS 7
/* Note DRCS must be last in search order
   to replace others if identical */

ext character_t
display[MAX_NUM_LINES][MAX_NUM_COLUMNS];
ext line_rendition_t       line_rendition[MAX_NUM_LINES];
ext character_position_t   active_position;
ext line_t                 top_margin;
ext line_t                 bottom_margin;
ext column_t               left_margin;    /* Horiz scroll ext */
ext column_t               right_margin;   /* Horiz scroll ext */
ext boolean_t              last_column_flag;
ext active_display_t       active_display; /* L3 or Status Dsply*/
ext status_display_t       status_display; /* L3 or Status Dsply*/
ext char_set_designator_t  char_set_table[MAX_NUM_CHAR_SETS];
ext save_buffer_t          cursor_save_buffer;
ext character_rendition_t  current_rendition;
ext character_attribute_t  current_attribute; /* Selective Erase*/
ext boolean_t              horizontal_tab_stops[MAX_NUM_COLUMNS];
ext column_mode_t          column_mode;      /* 132 Column Ext */
ext lines_per_page_t       lines_per_page;   /* Windowing */
ext columns_per_page_t     columns_per_page; /* Windowing */
ext number_of_pages_t      number_of_pages;  /* Windowing */
ext scrolling_mode_t       scrolling_mode;
ext screen_mode_t          screen_mode;
ext origin_mode_t          origin_mode;
ext auto_wrap_mode_t       auto_wrap_mode;
ext text_cursor_enable_mode_t  text_cursor_enable_mode;
ext insert_replace_mode_t  insert_replacement_mode;
ext new_line_mode_t        new_line_mode;
ext cursor_coupling_mode_t
        horizontal_cursor_coupling,      /* Windowing */
        vertical_cursor_coupling,        /* Windowing */
        page_cursor_coupling;            /* Windowing */
ext left_right_margins_mode_t
        left_right_margins_mode; /* Horiz Scroll */
ext area_extent_t
        attribute_change_extent; /* L4 or rect editing */
/********** end of char_cell_extern.h  *************/

/* function declarations */ short int end_of_line(); void
scroll_up(); void scroll_down(); void scroll_left(); void
scroll_right(); void insert_or_replace_character(); void
selective_erase_in_line(); void selective_erase_in_display();

5.3.1 Notes On Character Cell Display State

  1. An empty character is a character position in the Logical Display in which no character code appears, and thus no character is rendered in the visual display for this position. In this implementation this is handled by a null entry in the logical display structure, which should be rendered as a space with normal rendition in the visual display. In other implementations this may be handled in a manner appropriate to the display list structure, but the affect on the visual display should be the same.

    In an empty character position the character rendition, character attribute, and character set values should be ignored.

  2. The number of character sets available depends on the conformance level and architecture extensions present. See "Character Set Repertoire" in this chapter (DEC STD 70-5).

See the "Terminal Management" Section (DEC STD 70-4) for a listing of all terminal state, and initialization procedures.

5.4 Display Coordinate System And Addressing

5.4.1 Logical Display

A conforming device shall provide the capability of storing and presenting single-width graphic characters in a rectangular array of lines and columns called a Logical Display Page. The number of lines and columns shall define the size of the Logical Display Page, or Page Size. The entire Logical Display may consist of a single page, or a number of pages of identical size.

All conforming devices shall support a single Logical Display Page of 24 lines by 80 columns, extendable to 24 lines by 132 columns when the "132 Column Mode" extension is present (DECCOLM, see "Page Size and Arrangement").

Level 4 devices, and Level 3 devices with the "Windowing Extension" shall support commands to change the Logical Display Page Size (DECSLPP and DECSCPP, see "Page Size and Arrangement"). The actual Page Sizes supported shall be clearly specified in the product documentation, and means shall be provided for software to interrogate the size of the Logical Display Page. The Page Size and number of pages in the Logical Display may also be configurable by the user under local control.

Each character position in the Logical Display will consist of the following information: a character code, a character rendition, character attributes, and a character set.

The first position in a logical display page shall be at line 1, column 1. Frequently this will correspond to the upper left corner of the physical display with line numbers increasing downward, and column numbers increasing to the right, but this need not be true.

The graphic representation of each character on the physical display surface will occupy a rectangular cell whose lower left hand corner is at the logical screen coordinate corresponding to the position of the character in the the array.

   1              columns                80                   132
  +----------------------------------------+---------------------+
1 |                                        |                     |
  |______________________________________________________________|
  |1        single-width line            80                   132|
  |--------------------------------------------------------------|
  |                                        |                     |
  |______________________________________________________________|
  |1        double-width line            40                    66|
l |--------------------------------------------------------------|
i |                                        |                     |
n |______________________________________________________________|
e |1     double-height line / top        40                    66|
s |1     double-height line / bottom     40                    66|
  |--------------------------------------------------------------|
  |                                        |                     |
  |                                        |                     |
  |                                        |                     |
  |                                        |                     |
  |                                        |                     |
24|                                        |                     |
  +----------------------------------------+---------------------+
Display Structure and Addressing

5.4.2 Active Position And Cursor

A conforming device shall maintain the line and column coordinates of a single character position, known as the "Active Position", which serves as a reference point for character insertion and replacement as well as various control functions. The Active Position indicates the character position at which the next operation is to begin.

The Active Position does not necessarily correspond to the visual indicator in the physical display known as the "Cursor Symbol". However, in this specification the terms "Active Position" and "Cursor" are used interchangeably in order not to conflict with previous usage.

Set/Reset Text Cursor Enable Mode DECTCEM

Levels: 2-4

Purpose: Select whether the text cursor symbol in the display has a visual representation.

Set Format:

CSI ? 25 h

Reset Format:

CSI ? 25 l

Description: A conforming device shall provide a means of enabling or disabling the visible cursor symbol. This mode shall apply only to the text cursor symbol implemented by the Character Cell Display service class. In the set state (Text Cursor On), which is the default, the text cursor symbol will be displayed. In the reset state (Text Cursor Off), the text cursor symbol will not be displayed.

When a request is received to turn off the cursor, it will be done immediately (if not already off). If a request is received to enable the cursor, and the cursor is not already on, the cursor will remain off for a small "initial" cycle, after which it will become visible and begin its normal blinking cycle. This makes the cursor blink with a steady duty cycle regardless of how fast it is turned on and off.

Notes:

  1. There is some concern that a program might inadvertently leave the text cursor turned off. It is suggested that entering SETUP mode will always turn on the text cursor while in SETUP mode, but that normally it be restored to its previous state upon exiting SETUP mode. Also, a means should be provided in SETUP mode to force the text cursor to be re-enabled.

State Affected:

  • text_cursor_enable_mode

Algorithm:

void set_text_cursor_enable_mode()
{
if (conformance_level >= LEVEL_2)
    text_cursor_enable_mode = TEXT_CURSOR_ON;
}


void reset_text_cursor_enable_mode()
{
if (conformance_level >= LEVEL_2)
    text_cursor_enable_mode = TEXT_CURSOR_OFF;
}

Known Deviations: None

5.4.3 Margins And Scrolling

A conforming device shall provide the capability of defining top and bottom margins of a scrolling region. The top and bottom margins are two line numbers in a logical display page. The top margin must always have a lower line number than the bottom margin.

Devices with the Horizontal Scrolling Extension shall provide the ability to define left and right margins of a scrolling region. The left and right margins are two column numbers in a logical display page. The left margin must always have a lower column number than the right margin.

Numerous editing and cursor control functions are defined relative to the scrolling margins.

The default scrolling region at power-up or after reset is equal to the size of the logical display page.

   1              columns                80                   132
  +----------------------------------------+---------------------+
1 |    +                          +        |                     |
  |    +left                      +right   |                     |
  |    +margin                    +margin  |                     |
  |    +                          +        |                     |
  |    +       top margin         +        |                     |
  |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
  |    +           /\             +        |                     |
  |    +           ||             +        |                     |
l |    +           ||             +        |                     |
i |    +                          +        |                     |
n |    +/------ scrolling -------\+        |                     |
e |    +\------  region   -------/+        |                     |
s |    +                          +        |                     |
  |    +           ||             +        |                     |
  |    +           ||             +        |                     |
  |    +           \/             +        |                     |
  |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
  |    +      bottom margin       +        |                     |
24|    +                          +        |                     |
  +----------------------------------------+---------------------+
Margins and Scrolling Region

A scrolling region is defined as the area bounded by the top, bottom, left, and right margins, which are set by DECSTBM and DECSLRM. All scrolling, both vertical and horizontal, is limited to this area.

Several controls are ignored or behave differently if the active position is outside certain boundaries of the scrolling region. The following table lists these controls:

         margins
        T/B   L/R
     +------+------+
 DCH |   O     X   |     X = Is affected.
 ICH |   O     X   |         Does not work outside
     |             |         these margins.
 DL  |   X     X   |
 IL  |   X     X   |     O = Not affected.
     |             |         Continues to work outside
DECDC|   X     X   |         these margins.
DECIC|   X     X   |
     |             |     * = If active position is inside margins,
 IND |   *     O   |           affect is limited by margins.
 RI  |   *     O   |         If active position is outside margins
DECBI|   O     *   |           control still has an affect,
DECFI|   O     *   |           but no scrolling can occur.
     +------+------+

The following functions described in this subsection are used to control scrolling:

Set Top And Bottom Margins DECSTBM

Levels: 1-4

Purpose: Change the top and bottom margin settings for the scrolling region.

Format:

CSI   Pt  ;  Pb  r      default Pt: 1
9/11  Pt  ;  Pb  7/2    default Pb: last line

Description: The DECSTBM control sets the values of the Top and Bottom Margins of the scrolling region. The new settings are determined by the parameter values. The first parameter sets the value of the Top Margin, and the second parameter sets the value of the Bottom Margin. The default settings if either or both parameters are omitted are the boundaries of the Logical Display Page: one (1) for the Top Margin and twenty-four (24) for the Bottom Margin when the Page Size is 24 lines.

Notes:

  1. Execution of this control causes the Active Position to be set to the page origin obeying Origin Mode (DECOM): First column of first line if Origin Mode is in the reset (Absolute) state; Top and Left Margins if Origin Mode is in the set (Displaced) state.

  2. If the value specified for the Top Margin is equal to or greater than the value specified for the Bottom Margin, this control will be ignored (not executed).

  3. If the value specified for the Bottom Margin is greater than the number of lines in the Logical Display Page, this control will be ignored (not executed).

State Affected:

  • active_position
  • top_margin
  • bottom_margin

Algorithm:

void set_top_and_bottom_margins(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
/* use defaults for omitted parameters */
if (parv[0] == 0) parv[0] = 1;
if (parv[1] == 0) parv[1] = lines_per_page;

if ((parv[0] < parv[1]) && (parv[1] <= lines_per_page))
  {
  top_margin = parv[0];
  bottom_margin = parv[1];
  if (origin_mode == ABSOLUTE)
    {
    active_position.line = 1;
    active_position.column = 1;
    }
  else
    {
    active_position.line = top_margin;
    active_position.column = left_margin;
    }
  }
}

Known Deviations: None

Set Left And Right Margins DECSLRM

Levels: 4x (Horizontal Scrolling)

Purpose: Change the left and right margin settings for the scrolling region.

Format:

CSI   Pl  ;  Pr s       default Pl: 1
9/11  Pl  ;  Pr 7/3     default Pr: Last Column

Description: The DECSLRM control sets the values of the Left and Right Margins of the scrolling region. The new settings are determined by the parameter values. The first parameter sets the value of the Left Margin, and the second parameter sets the value of the Right Margin. The default settings if either or both parameters are omitted are the boundaries of the Logical Display Page: one (1) for the Left Margin and eighty (80) for the Right Margin when the Page Size is 80 columns wide.

Notes:

  1. Execution of this control causes the Active Position to be set to the page origin obeying Origin Mode (DECOM): First column of first line if Origin Mode is in the reset (Absolute) state; Top and Left Margins if Origin Mode is in the set (Displaced) state.

  2. If the value specified for the Left Margin is equal to or greater than the value specified for the Right Margin, this control will be ignored (not executed).

  3. If the value specified for the Right Margin is greater than the number of columns in the Logical Display Page, this control will be ignored (not executed).

  4. This control function is only recognized when DECLRMM (Left Right Margin Mode) is set.

  5. Setting the margins to other than their default values (the boundaries of the Logical Display Page) may disable smooth scrolling (DECSCLM).

State Affected:

  • active_position
  • left_margin
  • right_margin

Algorithm:

void set_left_and_right_margins(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
if ( (conformance_level == LEVEL_4) &&
     (level_4_extensions[HORIZONTAL_SCROLL] == TRUE) &&
     (left_right_margins_mode == SETABLE) )
  {
  /* use defaults for omitted parameters */
  if (parv[0] == 0) parv[0] = 1;
  if (parv[1] == 0) parv[1] = columns_per_page;

  if ((parv[0] < parv[1]) && (parv[1] <= columns_per_page))
    {
    left_margin = parv[0];
    right_margin = parv[1];
    if (origin_mode == ABSOLUTE)
      {
      active_position.line = 1;
      active_position.column = 1;
      }
    else
      {
      active_position.line = top_margin;
      active_position.column = left_margin;
      }
    }
  }
}

Known Deviations: None

Set/Reset Left Right Margin Mode DECLRMM

Levels: 4x (Horizontal Scrolling)

Purpose: Change the state of Left Right Margin Mode between Not Available (reset) and Available (set).

To set:

CSI ? 69 h    (Available)

To reset:

CSI ? 69 l    (Not Available - default)

Description: DECLRMM is a parameter to the Set Mode and Reset Mode commands. In the reset state, the left and right scrolling margins in every page may not be moved through the DECSLRM command, they are set to be at the extremes of the page. In the set state, DECSLRM commands are recognized, however, no line attributes other than Single Wide may be used.

When DECLRMM is set, all line attributes currently in Page Memory for the Session will be reset to Single Wide, Single High, and DECDWL and DECDHL escape sequences, to change the line attribute to Double Wide or Double Wide and High, will be ignored.

State Affected:

  • left_right_margins_mode
  • line_rendition[MAX_NUM_LINES]
  • left_margin
  • right_margin

Algorithm:

void set_left_right_margins_mode()
{
int i;
if ( (conformance_level == LEVEL_4) &&
     (level_4_extensions[HORIZONTAL_SCROLL] == TRUE) )
  {
  for (i=0; i<MAX_NUM_LINES; i++)
    {
    line_rendition[i] = SINGLE_WIDTH;
    }
  left_right_margins_mode = SETABLE;
  }
}


void reset_left_right_margins_mode()
{
if ( (conformance_level == LEVEL_4) &&
     (level_4_extensions[HORIZONTAL_SCROLL] == TRUE) )
  {
  left_margin = 1;
  right_margin = columns_per_page;
  left_right_margins_mode = FIXED;
  }
}

Known Deviations: None

Set/Reset Origin Mode DECOM

Levels: 1-4

Purpose: Change the state of Origin Mode between Absolute (reset) and Displaced (set) origin.

To Set:

CSI ? 6 h    (displaced)

To Reset:

CSI ? 6 l    (absolute - default)

Description: A conforming device shall allow addressing of the display area to be performed relative to either the display origin (coordinate 1,1) [reset state = absolute] or the origin of the current scrolling region (Top Margin, Left Margin) [set state = displaced]. When Origin Mode is in the set state (displaced), the Active Position cannot be moved above the Top Margin or left of the Left Margin of the scrolling region.

The DECOM controls are used the change the state of Origin Mode between Absolute and Displaced.

State Affected:

  • origin_mode
  • active_position

Algorithm:

void set_origin_mode()
{
origin_mode = DISPLACED;
active_position.line = top_margin;
active_position.column = left_margin;
}


void reset_origin_mode()
{
origin_mode = ABSOLUTE;
active_position.line = 1;
active_position.column = 1;
}

Known Deviations: None

Set/Reset Scrolling Mode DECSCLM

Levels: 1-4

Purpose: Change the state of Scrolling Mode between Jump (reset) and Slow (set) scrolling.

To Set:

CSI ? 4 h    (smooth - default)

To Reset:

CSI ? 4 l    (jump)

Description: A conforming device shall provide the capability of selecting either jump scrolling [reset state = jump] and slow scrolling [set state = slow]. Jump scrolling is defined as scrolling of the display as fast as the device permits, to a maximum which will be implementation defined. Slow scrolling is defined as scrolling of the display at a rate of approximately 6 text lines per second. The intention of slow scrolling is to move text through the display at a rate which makes it "recognizable", but not necessarily readable. (i.e., it is not guaranteed that it will appear slowly enough for the user to scan read the entire text). The scrolling speed applies to vertical scrolling of the scrolling region of the display, which can be set as any combination of adjacent lines.

The DECSCLM controls are used to change the state of Scrolling Mode between Jump (reset state) and Slow (set scrolling.

Notes:

  1. Some implementations may offer a choice of additional scrolling speeds in Set-Up. The reset state of DECSCLM will select the speed closest to 6 lines per second.

  2. Setting the left or right margins to other than their default values (the boundaries of the Logical Display Page) may temporarily disable smooth scrolling (guideline), but will not affect the state of Scrolling Mode.

State Affected:

  • scrolling_mode

Algorithm:

void set_scrolling_mode()
{
scrolling_mode = SLOW;
}


void reset_scrolling_mode()
{
scrolling_mode = JUMP;
}

Known Deviations: Workstation terminal emulators which do not have scrolling hardware do not implement this control (DECterm, UIS).

Index IND

Levels: 1-4

Purpose: Move the Active Position downward one line, scrolling if necessary.

Format:

IND
8/4     (ESC D)

Description: The IND control moves the Active Position downward in the display by one line. If the Active Position is already at the Bottom Margin the display will scroll upward by one line. If the display scrolls, a blank line with all attributes off will appear at the bottom margin.

Notes:

  1. If the Active Position is above the Bottom Margin when this control is executed, the Active Position will not move beyond the Bottom Margin. If the Active Position is below the Bottom Margin (as the result of absolute cursor positioning) it will still move downward by one line and no scrolling will occur. In this case, the Active Position will not move beyond the bottom line of the display.

  2. This control is identical to the Line Feed (LF) control, except that it is not affected by the setting of New Line Mode.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void index()
{
if (active_position.line == bottom_margin)
  scroll_up(top_margin, 1);
else
  if (active_position.line < lines_per_page)
    active_position.line += 1;

/* new line may have a different length - adjust column */
if (active_position.column > end_of_line(active_position.line))
  active_position.column = end_of_line(active_position.line);
}

Known Deviations:

On the VT100 and VT125, Index is affected by the setting of New Line Mode, in the same manner as Line Feed.

Reverse Index RI

Levels: 1-4

Purpose: Move the Active Position upward one line, scrolling if necessary.

Format:

RI
8/13    (ESC M)

Description: The RI control moves the Active Position upward in the display by one line. If the Active Position is already at the Top Margin the display will scroll downward by one line. If the display scrolls, a blank line with all attributes off will appear at the top margin.

Notes:

  1. If the Active Position is below the Top Margin when this control is executed, the Active Position will not move beyond the Top Margin. If the Active Position is above the Top Margin (as the result of absolute cursor positioning) it will still move upward by one line and no scrolling will occur. In this case, the Active Position will not move beyond the first line of the display.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void reverse_index()
{
if (active_position.line == top_margin)
  scroll_down(top_margin, 1);
else
  if (active_position.line > 1)
    active_position.line -= 1;

/* new line may have a different length - adjust column */
if (active_position.column > end_of_line(active_position.line))
  active_position.column = end_of_line(active_position.line);
}

Known Deviations: None

Forward Index DECFI

Levels: 4x (Horizontal Scrolling)

Purpose: Move the Active Position forward one column, scrolling if necessary.

Format:

ESC   9
1/11  3/9

Description: The DECFI control causes the active position to move forward one column. If the active position was already at the right margin, the contents of the Logical Display Page within the right, left, top and bottom margins shifts left one column. The column shifting beyond the left margin is deleted. A new column is inserted at the right margin with all attributes turned off and the cursor appears in this column.

If the active position is outside the left or right margin when the command is received the active position moves forward one column. If the active position was at the right edge of the page, the command is ignored.

Notes on DECFI:

  1. Lines of text are shifted one column regardless of their line attributes. This means double-wide and double-size lines will appear to shift twice as fast as single-width lines.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void decfi()
{
if ( (conformance_level == LEVEL_4) &&
     (level_4_extensions[HORIZONTAL_SCROLL] == TRUE) )
  {
  if (active_position.column == right_margin)
    scroll_left(left_margin, 1);
  else
    if (active_position.column < columns_per_page)
      active_position.column += 1;

  /* active line may not be columns_per_page long */
  if (active_position.column > end_of_line(active_position.line))
    active_position.column = end_of_line(active_position.line);
  }
}

Known Deviations: None

Back Index DECBI

Levels: 4x (Horizontal Scrolling)

Purpose: Move the Active Position backward one column, scrolling if necessary.

Format:

ESC   6
1/11  3/6

Description: The DECBI control causes the active position to move backward one column. If the active position was already at the left margin, the contents of the Logical Display within the left, right, top and bottom margin shifts right one column. The column shifted beyond the right margin is deleted. A new column is inserted at the left margin with all attributes turned off and the cursor appears in this column.

If the active position is outside the left or right margin when the command is received the active position moves backwards one column. If the active position was at the left edge of the page, the command is ignored.

Notes on DECBI:

  1. Lines of text are shifted one column regardless of their line attributes. This means double-wide and double-size lines will appear to shift twice as fast as single-width lines.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void decbi()
{
if ( (conformance_level == LEVEL_4) &&
     (level_4_extensions[HORIZONTAL_SCROLL] == TRUE) )
  {
  if (active_position.column == left_margin)
    scroll_right(left_margin, 1);
  else
    if (active_position.column > 1)
      active_position.column -= 1;
  }
}

Known Deviations: None

5.4.4 Cursor Movement

This section describes the following functions used to control the cursor position within the Logical Display Page:

Cursor Up CUU

Levels: 1-4

Purpose: Move the Active Position upward by n lines.

Format:

CSI     Pn      A               default Pn: 1
9/11    3/?     4/1

Description: The CUU control moves the Active Position upward in the display. The distance moved is determined by the parameter value. A parameter value of zero or one moves the Active Position upward by one line. A parameter value of n moves the Active Position upward by n lines.

Notes:

  1. If the Active Position is at or below the Top Margin when the CUU control is executed, and an attempt is made to move the Active Position above the Top Margin, the control will be executed until the Active Position reaches the Top Margin. The Active Position will not move beyond the Top Margin.

  2. If the Active Line is above the Top Margin when the CUU control is executed (due to absolute cursor positioning) and an attempt is made to move the Active Position outside of the addressable display, the control will be executed until the Active Position reaches the first line of the Page. The Active Position will not move beyond the first line of the Page.

  3. No scrolling will occur as a result of this control.

  4. If the line to which the Active Position is moved contains fewer columns than the Active Column, the Active Column is set to the end of that line. (This condition will only occur if the Active Line is a single-width line, and the line to which the Active Position is moved is a double-width or double-height line. The Active Column is not affected by the length of lines it moves over by a repeat move caused by a parameter value greater than one.)

State Affected:

  • active_position

Algorithm:

void cursor_up(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  short int n;
if (parv[0] == 0) n = 1;
else n = parv[0];
if (active_position.line >= top_margin)
  {
  if ((active_position.line - n) >= top_margin)
    active_position.line -= n;
  else
    active_position.line = top_margin;
  }
else
  {
  if ((active_position.line - n) >= 1)
    active_position.line -= n;
  else
    active_position.line = 1;
  }

/* new line may have a different length - adjust column */
if (active_position.column > end_of_line(active_position.line))
  active_position.column = end_of_line(active_position.line);
}

Known Deviations: None

Cursor Down CUD

Levels: 1-4

Purpose: Move the Active Position downward by n lines.

Format:

CSI     Pn      B               default Pn: 1
9/11    3/?     4/2

Description: The CUD control moves the Active Position downward in the display. The distance moved is determined by the parameter value. A parameter value of zero or one moves the Active Position downward by one line. A parameter value of n moves the Active Position downward by n lines.

Notes:

  1. If the Active Position is at or above the Bottom Margin when the CUD control is executed, and an attempt is made to move the Active Position below the Bottom Margin, the control will be executed until the Active Position reaches the Bottom Margin. The Active Position will not move beyond the Bottom Margin.

  2. If the Active Position is below the Bottom Margin when the CUD control is executed (due to absolute cursor positioning) and an attempt is made to move the Active Position outside of the addressable display, the control will be executed until the Active Position reaches the bottom line of the Page. The Active Position will not move beyond the bottom line of the Page.

  3. No scrolling will occur as a result of this control.

  4. If the line to which the Active Position is moved contains fewer columns than the Active Column, the Active Column is set to the end of that line. (This condition will only occur if the Active Line is a single-width line, and the line to which the Active Position is moved is a double-width or double-height line. The Active Column is not affected by the length of lines it moves over by a repeat move caused by a parameter value greater than one.)

State Affected:

  • active_position

Algorithm:

void cursor_down(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  short int n;
if (parv[0] == 0) n = 1;
else n = parv[0];
if (active_position.line <= bottom_margin)
  {
  if ((active_position.line + n) <= bottom_margin)
    active_position.line += n;
  else
    active_position.line = bottom_margin;
  }
else
  {
  if ((active_position.line + n) <= lines_per_page)
    active_position.line += n;
  else
    active_position.line = lines_per_page;
  }

/* new line may have a different length - adjust column */
if (active_position.column > end_of_line(active_position.line))
  active_position.column = end_of_line(active_position.line);
}

Known Deviations: None

Cursor Forward CUF

Levels: 1-4

Purpose: Move the Active Position forward by n columns.

Format:

CSI     Pn      C               default Pn: 1
9/11    3/?     4/3

Description: The CUF control moves the Active Position forward in the display. The distance moved is determined by the parameter value. A parameter value of zero or one moves the Active Position forward by one column. A parameter value of n moves the Active Position forward by n columns.

Notes:

  1. If the Active Position is at or inside the Right Margin when the CUF control is executed, and an attempt is made to move the Active Position beyond the Right Margin, the control will be executed until the Active Position reaches the Right Margin. The Active Position will not move beyond the Right Margin.

  2. If the Active Position is beyond the Right Margin when the CUF control is executed (due to absolute cursor positioning) and an attempt is made to move the Active Position outside of the addressable display, the control will be executed until the Active Position reaches the last column of the Active Line. The Active Position will not move beyond the last column of the Active Line.

  3. No scrolling will occur as a result of this control.

State Affected:

  • active_position

Algorithm:

void cursor_forward(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  short int n;
if (parv[0] == 0) n = 1;
else n = parv[0];
if (active_position.column <= right_margin)
  {
  if ((active_position.column + n) <= right_margin)
    active_position.column += n;
  else
    active_position.column = right_margin;
  }
else
  {
  if ( (active_position.column + n) <=
       end_of_line(active_position.line) )
    active_position.column += n;
  else
    active_position.column = end_of_line(active_position.line);
  }
}

Known Deviations: None

Cursor Backward CUB

Levels: 1-4

Purpose: Move the Active Position backward by n columns.

Format:

CSI     Pn      D               default Pn: 1
9/11    3/?     4/4

Description: The CUB control moves the Active Position backward in the display. The distance moved is determined oy the parameter value. A parameter value of zero or one moves the Active Position backward by one one column. A parameter value of n moves the Active Position backward by n columns.

Notes:

  1. If the Active Position is at or inside the Left Margin when the CUB control is executed, and an attempt is made to move the Active Position beyond the Left Margin, the control will be executed until the Active Position reaches the Left Margin. The Active Position will not move beyond the Left Margin.

  2. If the Active Position is beyond the Left Margin when the CUB control is executed (due to absolute cursor positioning) and an attempt is made to move the Active Position outside of the addressable display, the control will be executed until the Active Position reaches the first column of the Active Line. The Active Position will not move beyond the first column of the Active Line.

  3. No scrolling will occur as a result of this control.

State Affected:

  • active_position

Algorithm:

void cursor_backward(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  short int n;
if (parv[0] == 0) n = 1;
else n = parv[0];
if (active_position.column >= left_margin)
  {
  if ((active_position.column - n) >= left_margin)
    active_position.column -= n;
  else
    active_position.column = left_margin;
  }
else
  {
  if ((active_position.column - n) >= 1)
    active_position.column -= n;
  else
    active_position.column = 1;
  }
}

Known Deviations: None

Cursor Position CUP

Levels: 1-4

Purpose: To position the Active Position at an absolute line and column address.

Format:

CSI   Pl  ;  Pc   H     default Pl: 1
9/11  3/? ;  3/?  4/8   default Pc: 1

Description: The CUP control moves the Active Position to an absolute line and column address as specified by the parameter values. The first parameter specifies the new line address, and the second parameter specifies the new column address. If either parameter is omitted, or is explicitly set to zero (0), that parameter value will default to one (1).

Notes:

  1. This control is affected by the setting of Origin Mode. If Origin Mode is reset, addressing is performed relative to the page origin (first column in the first line). If Origin Mode is set, addressing is performed relative to the origin of the current scrolling region (the top and left margin).

  2. If an attempt is made to move the Active Position outside of the addressable display area (the entire screen if Origin Mode is reset, or the scrolling region if Origin Mode is set), the Active Position will be moved in the direction indicated to the boundary of the addressable area, but will not be moved beyond the boundary of the addressable area.

State Affected:

  • active_position

Algorithm:

void cursor_position(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  line_t y;
  column_t x;
y = parv[0];
x = parv[1];
if (y == 0) y = 1;
if (x == 0) x = 1;
if (origin_mode == DISPLACED)
  {
  if ( ((top_margin-1) + y) <= bottom_margin )
    active_position.line = (top_margin-1) + y;
  else
    active_position.line = bottom_margin;

  if ( ((left_margin-1) + x) <= right_margin )
    active_position.column = (left_margin-1) + x;
  else
    active_position.column = right_margin;
  }
else
  {
  if (y <= lines_per_page)
    active_position.line = y;
  else
    active_position.line = lines_per_page;

  if (x <= end_of_line(active_position.line))
    active_position.column = x;
  else
    active_position.column = end_of_line(active_position.line);
  }
}

Known Deviations: None

Horizontal/Vertical Position HVP

Levels: 1-4

Purpose: Move the Active Position to an absolute line and column address. (fallback implementation)

Format:

CSI   Pl  ;  Pc  f      default Pl: 1
9/11  Pl  ;  Pc  6/6    default Pc: 1

Description: The HVP control moves the Active Position to an absolute line and column address as specified by the parameter values. The first parameter specifies the new line address, and the second parameter specifies the new column address. If either parameter is omitted, or is explicitly set to zero (0), that parameter value will default to one (1).

Notes:

  1. The HVP control is provided for interface compatibility with printing terminals. This implementation is not in conformance with existing standards. Conforming software will use the Cursor Position control to affect movement of the cursor, since the operation of Horizontal/Vertical Position may be redefined in future levels of the architecture.

  2. This control is affected by the setting of Origin Mode. If Origin Mode is reset, addressing is performed relative to the page origin (first column in the first line). If Origin Mode is set, addressing is performed relative to the origin of the current scrolling region (the top and left margin).

  3. If an attempt is made to move the Active Position outside of the addressable display area (the entire screen if Origin Mode is reset, or the scrolling region if Origin Mode is set), the Active Position will be moved in the direction indicated to the boundary of the addressable area, but will not be moved beyond the boundary of the addressable area.

State Affected:

  • active_position

Algorithm:

void horizontal_vertical_position(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  /* steal code from CUP */
  cursor_position(parv);
}

Known Deviations: None

Cursor Position Report CPR

Levels: 1-4

Purpose: Report the line and column address of the Active Position.

Request Format:

CSI   6    n
9/11  3/6  6/14

Report Format:

CSI   Pl   ;  Pc   R            default Pl: 1
9/11  3/?  ;  3/?  5/2          default Pc: 1

Description: The CPR control is transmitted by the terminal in response to a specific Device Status Report (DSR) control. The parameter values indicate the Active Line and Active Column values at the time the DSR control is received by the terminal.

Notes:

  1. This control is affected by the setting of Origin Mode. If Origin Mode is reset, addressing is performed relative to the page origin (first column in the first line). If Origin Mode is set, addressing is performed relative to the origin of the current scrolling region (the Top and Left Margin).

State Affected:

  • none

Algorithm:

void cursor_position_report()
{
  line_t y;
  column_t x;
if (origin_mode == DISPLACED)
  {
  y = active_position.line - top_margin + 1;
  x = active_position.column - left_margin + 1;
  }
else
  {
  y = active_position.line;
  x = active_position.column;
  }
send_char(0x9B, host_port);  /* CSI */
send_int(y, host_port);
send_char(';', host_port);
send_int(x, host_port);
send_char('R', host_port);
}

Known Deviations: None

Extended Cursor Position Report DECXCPR

Levels: 3x (Windowing), 4

Purpose: Report the line, column, and page address of the Active Position.

Request Format:

CSI   ?     6    n
9/11  3/15  3/6  6/14

Report Format:

CSI   ?     Pl   ;     Pc   ;     Pp   R
9/11  3/15  3/?  3/11  3/?  3/11  3/?  5/2

default Pl, Pc, Pp: 1

Description: The DECXCPR control is transmitted by the terminal in response to a specific Device Status Report (DSR) control. The parameter values indicate the Active Line, Column, and Page values at the time the DSR control is received by the terminal. The default condition with no parameters present, or parameters of 0, is equivalent to a cursor at the home position on the first Page.

Notes:

  1. This control is affected by the setting of Origin Mode. If Origin Mode is reset, addressing is performed relative to the page origin (first column in the first line). If Origin Mode is set, addressing is performed relative to the origin of the current scrolling region (the Top and Left Margin).

State Affected: None

Algorithm:

void x_cursor_position_report()
{
  line_t y;
  column_t x;
if (origin_mode == DISPLACED)
  {
  y = active_position.line - top_margin + 1;
  x = active_position.column - left_margin + 1;
  }
else
  {
  y = active_position.line;
  x = active_position.column;
  }
send_char(0x9B, host_port);  /* CSI */
send_char('?', host_port);
send_int ( y , host_port);
send_char(';', host_port);
send_int ( x,  host_port);
send_char(';', host_port);
send_char(active_position.page, host_port);
send_char('R', host_port);
}

Known Deviations: None

Set/Reset New Line Mode LNM

Levels: 1-4

Purpose: Change the state of New Line Mode between New Line Off (reset) and New Line On (set).

Set Format:

CSI 20 h

Reset Format:

CSI 20 l

Description: A conforming device shall provide a means of selecting whether a received Line Feed (LF), Vertical Tab (VT), or Form Feed (FF) character shall be treated as a single instance of that character [reset state = no_new_line], or that each of these characters is handled on receipt by additionally returning the Active Position to the first column of the display [set state = new_line]. It should be noted that setting of this mode also affects the processing of the Carriage Return (CR) key, which transmits a two-code sequence (CR LF) when New Line Mode is in the set state.

(Note: This mode should not be used in the set state by conforming software.)

State Affected:

  • new_line_mode

Algorithm:

void set_new_line_mode()
{
new_line_mode = NEW_LINE_ON;
}


void reset_new_line_mode()
{
new_line_mode = NEW_LINE_OFF;
}

Known Deviations: None

Carriage Return CR

Levels: 1-4

Purpose: Move the Active Position to the Left Margin.

Format:

CR
0/13

Description: The CR control moves the Active Position to the Left Margin. If the Active Position is before the left margin, or outside the top and bottom margins, the cursor moves to the first column of the Active Line.

State Affected:

  • active_position

Algorithm:

void_carriage_return()
{
if ((active_position.column >= left_margin) &&
    (active_position.line >= top_margin) &&
    (active_position.line <= bottom_margin))
  active_position.column = left_margin;
else
  active_position.column = 1;
}

Known Deviations: None

Line Feed LF

Levels: 1-4

Purpose: Move the Active Position downward one line, scrolling if necessary.

Format:

LF
0/10

Description: The LF control moves the Active Position downward in the display by one line. If the Active Position is already at the Bottom Margin the display will scroll upward by one line.

Notes:

  1. If the Active Position is above the Bottom Margin when this control is executed, the Active Position will not move beyond the Bottom Margin.

  2. If the Active Position is below the Bottom Margin when this control is executed (as the result of absolute cursor positioning) it will still move downward by one line and no scrolling will occur. In this case, the Active Position will not move beyond the bottom line of the display.

  3. If the line to which the Active Position is moved contains fewer columns than the Active Column, the Active Column is set to the end of that line.

  4. This control is affected by the setting of New Line Mode. If this mode is reset, no change will occur in the Active Column unless the line below the Active Line is shorter than the Active Line (see note 2). If the mode is set, the control causes the Active Column to be set to the first column of the line into which the Active Position is moved. Conforming software is recommended to use the two character sequence (CR LF) rather than New Line mode for widest compatibility.

  5. Note that the fundamental differences between this control and the CUD control are the effect of New Line Mode and the occurrence of scrolling on reaching the Bottom Margin.

  6. The LF control is identical in function to the IND (Index) control when New Line Mode is in the reset (No New Line) state.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void line_feed()
{
if (new_line_mode == NEW_LINE_ON) carriage_return();
if (active_position.line == bottom_margin)
  scroll_up(top_margin, 1);
else
  if (active_position.line < lines_per_page)
    active_position.line += 1;

/* new line may have different length - adjust column */
if (active_position.column > end_of_line(active_position.line))
  active_position.column = end_of_line(active_position.line);
}

Known Deviations: None

Vertical Tab VT

Levels: 1-4

Purpose: Move the Active Position downward one line, scrolling if necessary. (fallback implementation)

Format:

VT
0/11

Description: The VT control moves the Active Position downward in the display by one line. If the Active Position is already at the Bottom Margin the display will scroll upward by one line.

Notes:

  1. The implementation of the VT control is a fallback mechanism for display terminals which is intended to provide compatibility with printers which correctly implement this function.

  2. This control is identical in function to the Line Feed (LF) control. It is provided for software compatibility with printer output. It should be noted, however, that printers will implement this function differently. It is therefore recommended that software use the Line Feed control to perform this function instead of Vertical Tab.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void vertical_tab()
{
line_feed();    /* fallback implementation */
}

Known Deviations: None

Form Feed FF

Levels: 1-4

Purpose: Move the Active Position downward one line, scrolling if necessary. (fallback implementation)

Format:

FF
0/12

Description: The FF control moves the Active Position downward in the display by one line. If the Active Position is already at the Bottom Margin the display will scroll upward by one line.

Notes:

  1. The implementation of the FF control is a fallback mechanism for display terminals which is intended to provide compatibility with printers which correctly implement this function.

  2. This control is identical in function to the Line Feed (LF) control. It is provided for software compatibility with printer output. It should be noted, however, that printers will implement this function differently. It is therefore recommended that software use the Line Feed control to perform this function instead of Form Feed.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void form_feed()
{
line_feed();    /* fallback implementation */
}

Known Deviations: None

Back Space BS

Levels: 1-4

Purpose: Move the Active Position one column to the left.

Format:

BS
0/8

Description: The BS control moves the Active Position backward in the display by one column.

Notes:

  1. If the Active Position is at or inside the Left Margin and within the Scroll Area, it will not move beyond the Left Margin.

  2. If the Active Position is already before the Left Margin, the Active Position will move left one column unless it is at the first column of the Active Line. The Active Position will not move beyond the beginning of the Active Line.

  3. The BS control is not affected in any way by the setting of Auto Wrap Mode. Under no circumstances does the Active Position advance to the previous line on reaching the beginning of the Active Line.

State Affected:

  • active_position

Algorithm:

void back_space()
{
if (active_position.column > left_margin)
  active_position.column -= 1;
else
  {
  if ( ((active_position.column != left_margin) ||
        (active_position.line < top_margin) ||
        (active_position.line > bottom_margin)) &&
       (active_position.column > 1)  )
    active_position.column -= 1;
  }
}

Known Deviations: None

Next Line NEL

Levels: 1-4

Purpose: Move the Active Position to the Left Margin of the next line, scrolling if necessary.

Format:

NEL
8/5     (ESC E)

Description: The NEL control moves the Active Position to the Left Margin of the next line. If the Active Line is equal to the Bottom Margin, the Active Line is not incremented, but instead the display scrolls upward by one line. If the Active Position is before the left margin, or outside the top and bottom margins, it will move to the first column of the next line, but not beyond the last line on the page.

Notes:

  1. This control is identical to sending Line Feed (LF) with Line Feed New Line Mode set. It is also identical to sending Carriage Return (CR) followed by Line Feed (LF). Software is recommended to always use the combination of Carriage Return followed by Line Feed (CR LF) to achieve this effect for widest compatibility.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void next_line()
{
carriage_return();
line_feed();
}

Known Deviations: None

5.4.5 Horizontal Tabulation

A conforming device shall provide the ability to set a horizontal tabulation stop at each display column. These boolean indicators must be capable of being set or reset in any possible combination. It should be noted that only tab stops are stored by the device, not tab characters.

Setting of horizontal tab stops may be performed both as a remote and local function, and therefore the settings at any point in time is indeterminate. However, when no local provision is made for the setting and/or storage of user defined tabulation stops, the following default states shall be used by conforming devices. These settings should also apply to the factory default settings for a conforming device.

tab stops =

columns 9,17,25,33,41,49,57,65,73,81,89,97,105,113,121,129

Tabulation Clear TBC

Levels: 1-4

Purpose: Clear Horizontal Tab Stops.

Format:

CSI     Ps      g               default Ps: 0
9/11    3/?     6/7

Description: The TBC control provides a means of clearing or removing previously set Horizontal Tab Stops. The range of positions affected by this control is determined by the parameter value. An omitted parameter or a parameter value of zero (0) cause the control to clear only a tabulation stop set at the Active Column. A parameter value of three (3) causes the control to clear all Horizontal Tab Stops in the display.

State Affected:

  • horizontal_tab_stops[MAX_NUM_COLUMNS]

Algorithm:

void tabulation_clear(parc, parv)
  short int parc;
  short int parv[MAX_NUM_PARAMETERS];
{
  column_t x;
  short int n;
if (parc == 0) parc = 1;
for (n=0; n<parc; n++)
  {
  if (parv[n] == 0)
    horizontal_tab_stops[active_position.column] = FALSE;
  else if (parv[n] == 3)
    for (x=1; x<= columns_per_page; x++)
      horizontal_tab_stops[x] = FALSE;
  }
}

Known Deviations: None

Horizontal Tab HT

Levels: 1-4

Purpose: Advance the Active Position to the next Horizontal Tab Stop.

Format:

HT
0/9

Description: The HT control moves the Active Position forward in the display to the next Horizontal Tab Stop in the Active Line.

Notes:

  1. If no tabulation stop is reached before the Right Margin of the Active Line (within the Scroll Area), the Active Position will be set to the Right Margin of the Active Line. If the Active Column is beyond the Right Margin or the Active Line is outside the Scroll Area (due to absolute cursor positioning), the Active Position will move to the next tab stop, or last column of the Active Line, whichever comes first.

State Affected:

  • active position

Algorithm:

void horizontal_tab()
{
 boolean_t outside;
if ((active_position.line > top_margin) &&
    (active_position.line < bottom_margin))
  outside = FALSE;
else
  outside = TRUE;
if ( (active_position.column <
      end_of_line(active_position.line)) &&
     ((active_position.column != right_margin) || (outside==TRUE))
)
  active_position.column += 1;

for (; ( (active_position.column <
          end_of_line(active_position.line)) &&
         (horizontal_tab_stops[active_position.column] != TRUE) &&
         ((active_position.column != right_margin) ||
(outside==TRUE)) );
       active_position.column += 1);
}

Known Deviations: None

Horizontal Tabulation Set HTS

Levels: 1-4

Purpose: Set a Horizontal Tab Stop at the Active Column.

Format:

HTS

8/8     (ESC H)

Description: The HTS control causes a Horizontal Tab Stop to be set at the column position indicated by the value of the Active Column at the time this control is received.

Notes:

  1. None of the other Horizontal Tab Stop settings are affected by execution of this control.

State Affected:

  • horizontal_tab_stops[MAX_NUM_COLUMNS]

Algorithm:

void horizontal_tabulation_set()
{
horizontal_tab_stops[active_position.column] = TRUE;
}

Known Deviations: None

5.4.6 Page Size And Arrangement

Level 1 and Level 2 conforming devices support a single Logical Display Page of 24 lines by 80 columns, extendable to 24 lines by 132 columns when the "132 Column Mode" extension is present (DECCOLM).

Level 4 devices, and Level 3 devices with the "Windowing Extension" shall support commands to change the Logical Display Page Size (DECSLPP and DECSCPP). The actual Page Sizes supported shall be clearly specified in the product documentation, and means shall be provided for software to interrogate the size of the Logical Display Page (see "Terminal State Interrogation"). The Page Size and number of pages in the Logical Display may also be configurable by the user under local control.

Set/Reset Column Mode DECCOLM

Levels: 1X, 2X, 3X, 4X

Purpose: Change the state of Column Mode between Eighty (reset) and One Thirty Two (set).

Set Format:

CSI ? 3 h

Reset Format:

CSI ? 3 l

Description: A conforming device may provide as an extension the capability of selecting 80-column [reset state = eighty] or 132-⁠column [set state = one_thirty_two] display format.

Selecting Eighty or One_Thirty_Two Column Mode causes the display data to be cleared, the scrolling region to be eliminated, and the Active Position to be set to the display origin (1,1), even if the terminal was already in the selected state.

Notes:

  1. The font used to display Page Memory may change when the number of columns on the page changes to better match the screen. Control of when the font changes may be provided as a Set-Up option.

  2. If the Host Writable Status Line is enabled, receipt of this sequence will clear both the main display and the Host Writable Status Line.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • line_rendition[MAX_NUM_LINES]
  • active_position
  • top_margin
  • bottom_margin
  • column_mode
  • left_margin
  • right_margin
  • columns_per_page
  • left_right_margins_mode

Algorithm:

void set_column_mode()
{
  line_t y;
  column_t x;
column_mode = ONE_THIRTY_TWO;
columns_per_page = 132;
for (y=1; y<MAX_NUM_LINES; y++)
  {
  for (x=1; x<MAX_NUM_COLUMNS; x++)
    display[y][x].code = EMPTY_CHARACTER;
  line_rendition[y] = SINGLE_WIDTH;
  }
active_position.line = 1;
active_position.column = 1;
top_margin = 1;
bottom_margin = lines_per_page;
left_margin = 1;
right_margin = columns_per_page;
left_right_margins_mode = SETABLE;
}


void reset_column_mode()
{
  line_t y;
  column_t x;
column_mode = EIGHTY;
columns_per_page = 80;
for (y=1; y<MAX_NUM_LINES; y++)
  {
  for (x=1; x<MAX_NUM_COLUMNS; x++)
    display[y][x].code = EMPTY_CHARACTER;
  line_rendition[y] = SINGLE_WIDTH;
  }
active_position.line = 1;
active_position.column = 1;
top_margin = 1;
bottom_margin = lines_per_page;
left_margin = 1;
right_margin = columns_per_page;
left_right_margins_mode = SETABLE;
}

Known Deviations: None

Set Columns Per Page DECSCPP

Levels: 3X (Windowing), 4

Purpose: Set the number of columns per page in the Logical Display.

Format:

CSI     Pn      $       |
9/11    3/?     2/4     7/12

Description: This sequence sets the number of columns in the display page according to the numeric parameter. If the parameter is omitted or zero, the page width is defaulted to 80. If the number of columns specified is not one of the values supported by the implementation, the next higher supported number of columns per page is assumed. If the number of columns specified exceeds the maximum number supported, the maximum number supported will be used.

DECSCPP does not cause the Active Position to move. However if the active position is beyond the width of the new page when the command is executed, the active position will be moved to the right edge of the page. DECSCPP does not cause the Right Margin to move. However if the right margin is beyond the width of the new page when the command is executed, the right margin will be moved to the right edge of the page. When changing from a 132 column to a 80 column page, the information in columns 1-80 is preserved. The information in columns 81-132 is cleared. When changing from an 80 column page to a 132 column page, the information in columns 1-80 is preserved.

Notes on DECSCPP:

  1. The font used to display Page Memory may change when the number of columns on the page changes to better match the screen. Control of when the font changes may be provided as a Set-Up option.

  2. The number of columns per page can also be changed through Column Mode (DECCOLM). The affect of DECSCPP is similar to DECCOLM except that DECSCPP does not clear page memory.

  3. DECSCPP does not change the setting of DECLRMM.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position
  • right_margin
  • columns_per_page

Algorithm:

void set_columns_per_page(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  line_t y;
  column_t x;
if ( (conformance_level == LEVEL_4) ||
     (level_3_extensions[WINDOWING]==TRUE) )
  {
  if (parv[0] <= 80)
    /* set columns per page to 80 */
    {
    for (y=1; y<MAX_NUM_LINES; y++)
      {
      for (x=81; x<MAX_NUM_COLUMNS; x++)
        display[y][x].code = EMPTY_CHARACTER;
      }
    if (active_position.column > 80) active_position.column = 80;
    if (right_margin > 80) right_margin = 80;
      /* optional font change */
      if (columns_per_page > 80) select_normal_font();
    columns_per_page = 80;
    }
  else
    /* set columns per page to 132 */
      /* optional font change */
      if (columns_per_page <= 80) select_condensed_font();
    columns_per_page = 132;
  }
}

Known Deviations: None

Set Lines Per Page DECSLPP

Levels: 3X (Windowing), 4

Purpose: Set the number of lines per page in the Logical Display.

Format:

CSI     Pn      t
9/11    3/?     7/4

Description: This sequence sets the number of display lines per page according to the numeric parameter. If the parameter is omitted or zero, the page length is defaulted to 24. If the number of lines specified is not one of the values supported by the implementation, the next higher supported number of lines per page is assumed. If the number of lines specified exceeds the maximum number supported, the maximum number supported will be used.

DECSLPP does not cause Page Memory to be cleared, however, information contained in a larger page may appear in successive smaller pages, if the new height of the pages selected by the DECSLPP is too small to hold the information.

DECSLPP does not cause the scrolling regions to be reset, or the Active Position to move, except under the following circumstances: The scrolling margins may be reset to the extremes of the new Page Configuration if the current scrolling margin exceeds the physical limits of the new Page height; and, the Active Position will move to the same column in the maximum available line, if the Active Position exceeds the available number of lines in the new page size.

Conformance to Level 4 requires support for 3 pages of 24 lines.

State Affected:

  • lines_per_page
  • number_of_pages
  • active_position
  • top_margin
  • bottom_margin

Algorithm:

void set_lines_per_page(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
if ( (conformance_level == LEVEL_4) ||
     (level_3_extensions[WINDOWING]==TRUE) )
  {
  if (parv[0] <= 24)
    {
    lines_per_page = 24;
    number_of_pages = 3;
    }
  else if (parv[0] == 25)
    {
    lines_per_page = 25;
    number_of_pages = 2;
    }
  else if (parv[0] <= 36)
    {
    lines_per_page = 36;
    number_of_pages = 2;
    }
  else
    {
    lines_per_page = 72;
    number_of_pages = 1;
    }

  if (active_position.line > lines_per_page)
    active_position.line = lines_per_page;
  if (active_position.page > number_of_pages)
    active_position.page  = number_of_pages;
  if (top_margin > lines_per_page)
    top_margin = 1;
  if (bottom_margin > lines_per_page)
    bottom_margin = lines_per_page;
  }
}

Known Deviations: None

5.4.7 Page Movement

Next Page NP

Levels: 3x (Windowing), 4

Purpose: To move the Active Position ahead one or more pages in the Logical Display.

Format:

CSI     Pn      U
9/11    3/?     5/5

Description: This sequence causes the Active Position to move ahead a number of pages, specified by the parameter. If the parameter value is zero (the default) or one, the active position moves ahead 1 page. If the sequence calls for a page beyond the last page of display memory, the highest numbered page is used. NP moves the Active Position to the home position in the new page obeying Origin Mode.

Whether or not the new page is displayed depends upon the setting of DECPCCM.

State Affected:

  • active_position

Algorithm:

void next_page(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
if ( (conformance_level == LEVEL_4) ||
     (level_3_extensions[WINDOWING]==TRUE) )
  {
  if (parv[0] == 0) parv[0] = 1;
  if ((active_position.page + parv[0]) <= number_of_pages)
    active_position.page += parv[0];
  else
    active_position.page = number_of_pages;
  if (origin_mode = DISPLACED)
    {
    active_position.line = top_margin;
    active_position.column = left_margin;
    }
  else
    {
    active_position.line = 1;
    active_position.column = 1;
    }
  }
}

Known Deviations: None

Preceding Page PP

Levels: 3x (Windowing), 4

Purpose: To move the Active Position back one or more pages in the Logical Display.

Format:

CSI     Pn      V
9/11    3/?     5/6

Description: This sequence causes the active position to move back a number of pages, specified by the parameter. If the parameter value is zero (the default) or one, the active position moves back 1 page. If the sequence calls for a page before the first page of display memory, the first page is used. PP moves the active position to the home position in the new page obeying Origin Mode.

Whether or not the new page is displayed depends upon the setting of DECPCCM.

State Affected:

  • active_position

Algorithm:

void preceding_page(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
if ( (conformance_level == LEVEL_4) ||
     (level_3_extensions[WINDOWING]==TRUE) )
  {
  if (parv[0] == 0) parv[0] = 1;
  if (active_position.page > parv[0])
    active_position.page -= parv[0];
  else
    active_position.page = 1;
  if (origin_mode = DISPLACED)
    {
    active_position.line = top_margin;
    active_position.column = left_margin;
    }
  else
    {
    active_position.line = 1;
    active_position.column = 1;
    }
  }
}

Known Deviations: None

Page Position Absolute PPA

Levels: 3x (Windowing), 4

Purpose: To move the Active Position to the specified page in the Logical Display.

Format:

CSI     Pn      SP      P       (default Pn: 1)
9/11    3/?     2/0     5/0

Description: This sequence moves the Active Position to the corresponding line and column on the n-th page. If there are fewer than n pages in display memory, the highest numbered page is used.

Whether or not the new page is displayed depends upon the setting of DECPCCM.

State Affected:

  • active_position

Algorithm:

void page_position_absolute(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
if ( (conformance_level == LEVEL_4) ||
     (level_3_extensions[WINDOWING]==TRUE) )
  {
  if (parv[0] == 0) parv[0] = 1;
  if (parv[0] <= number_of_pages)
    active_position.page = parv[0];
  else
    active_position.page = number_of_pages;
  }
}

Known Deviations: None

Page Position Relative PPR

Levels: 3x (Windowing), 4

Purpose: To move the Active Position forward to the n-th succeding page in the Logical Display.

Format:

CSI     Pn      SP      Q       (default Pn: 1)
9/11    3/?     2/0     5/1

Description: This sequence moves the active position to the corresponding line and column of the n-th succeding page. If the sequence calls for a page beyond the last page of display memory, the highest numbered page is used.

Whether or not the new page is displayed depends upon the setting of DECPCCM.

State Affected:

  • active_position

Algorithm:

void page_position_relative(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
if ( (conformance_level == LEVEL_4) ||
     (level_3_extensions[WINDOWING]==TRUE) )
  {
  if (parv[0] == 0) parv[0] = 1;
  if ((active_position.page + parv[0]) <= number_of_pages)
    active_position.page += parv[0];
  else
    active_position.page = number_of_pages;
  }
}

Known Deviations: None

Page Position Backward PPB

Levels: 3x (Windowing), 4

Purpose: To move the Active Position back to the n-th preceding page in the Logical Display.

Format:

CSI     Pn      SP      R       (default Pn: 1)
9/11    3/?     2/0     5/2

Description: This sequence moves the active position to the corresponding line and column on the n-th preceding page. If the sequence calls for a page before the first page of display memory, the first page is used.

Whether or not the new page is displayed depends upon the setting of DECPCCM.

State Affected:

  • active_position

Algorithm:

void page_position_backward(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
if ( (conformance_level == LEVEL_4) ||
     (level_3_extensions[WINDOWING]==TRUE) )
  {
  if (parv[0] == 0) parv[0] = 1;
  if (active_position.page > parv[0])
    active_position.page -= parv[0];
  else
    active_position.page = 1;
  }
}

Known Deviations: None

5.5 Windowing Extension

The Windowing Extension supports Logical Display Page sizes that are larger or smaller than the physical display. A rectangular area of the screen (physical display) that displays information from a Logical Display Page is called a window.

Conforming devices may provide local window management features for creating and manipulating more than one window on the physical display at a time (guideline).

The following functions described in this subsection are used to control how an area of the Logical Display is mapped to a window on the physical display.

The Windowing Extension also supports two commands for changing the the size of the Logical Display Page (DECSLPP and DECSCPP, see "Page Size and Arrangement"). Finally, if more than one page of display memory is supported, the Windowing Extension includes commands to move the active position among the pages (NP, PP, PPA, PPR, and PPB, see "Page Movement").

The Windowing Extension may be provided at Level 1 or higher of the Character Cell Display service class, and is indicated by the extension parameter 18 in the Device Attributes (DA) response.

Set/Reset Horizontal Cursor Coupling Mode DECHCCM

Levels: 3x, 4x (Windowing)

Purpose: Change the state of Horizontal Cursor Coupling Mode between coupled (set state, page moves horizontally in the window to keep cursor visible), and uncoupled (reset state).

To set:

CSI ? 60 h    (coupled)

To reset:

CSI ? 60 l    (uncoupled - default)

Description: DECHCCM is a parameter to the Set Mode and Reset Mode commands. In the reset (uncoupled) state, when the active position within a page goes left or right of the borders of the displayable area (window), the page does not move with respect to the window to keep the cursor visible. The cursor is not shown in this case. The cursor is said to be "uncoupled" from the display. In the set state, when the active position within a page goes left or right of the borders of the displayable area (window), the page is moved the minimum amount to an 8 column boundary in the horizontal direction to keep the cursor position visible. The cursor is said to be "coupled" to the display.

Notes on DECHCCM:

  1. Horizontal Cursor Coupling does not need to be provided when there is no way for a Logical Display Page to have more columns than can be shown in the narrowest window.

  2. Horizontal Cursor Coupling may be enabled or disabled under local control in Set-Up.

  3. If a Set Mode command setting DECHCCM is received while the Active Column is not visible on the display, the page is moved to include the Active Column.

  4. Whether or not the cursor is actually visible may also depend on the state of Vertical and Page Cursor Coupling (DECVCCM and DECPCCM).

  5. Existing implementations move the page the minimum amount to make the cursor visible. Experience suggests moving the minimum amount to an 8 column boundary would make the display easier to follow for the user (less frequent movement).

Set/Reset Vertical Cursor Coupling Mode DECVCCM

Levels: 3x, 4x (Windowing)

Purpose: Change the state of Vertical Cursor Coupling Mode between coupled (set state, page moves vertically in window to keep cursor visible), and uncoupled (reset state).

To set:

CSI ? 61 h    (coupled - default)

To reset:

CSI ? 61 l    (uncoupled)

Description: DECVCCM is a parameter to the Set Mode and Reset Mode commands. In the reset state, when the active position within a page goes above or below the borders of the displayable area (window), the page does not move with respect to the window to keep the cursor visible. The cursor is not shown in this case. The cursor is said to be "uncoupled" from the display. In the set state, when the active position within a page goes above or below the borders of the displayable area (window), the page is moved the minimum amount in the vertical direction to keep the cursor position visible. The cursor is said to be "coupled" to the display.

Notes on DECVCCM:

  1. Vertical Cursor Coupling may be enabled or disabled under local control in Set-Up.

  2. If a Set Mode command setting DECVCCM is received while the Active Line is not visible on the display, the page is moved to include the Active Line.

  3. Whether or not the cursor is actually visible may also depend on the state of Horizontal and Page Cursor Coupling (DECHCCM and DECPCCM).

Set/Reset Page Cursor Coupling Mode DECPCCM

Levels: 3x, 4x (Windowing)

Purpose: Change the state of Page Cursor Coupling Mode between coupled (set state, switch page in window to keep cursor visible), and uncoupled (reset state).

To set:

CSI ? 64 h    (coupled - default)

To reset:

CSI ? 64 l    (uncoupled)

Description: DECPCCM is a parameter to the Set Mode and Reset Mode commands. In the reset state, when the active position moves to a new page in a multiple page configuration, the display is not refreshed to keep the cursor visible. The cursor is not shown in this case. The cursor is said to be "uncoupled" from the display. In the set state, when the active position moves to a new page, the destination page is refreshed on the Main Display to keep the cursor position visible. The cursor is said to be "coupled" to the display.

Notes on DECPCCM:

  1. Page Cursor Coupling may be enabled or disabled under local control in Set-Up.

  2. If a Set Mode command setting DECPCCM is received when the Active Page containing the cursor is not visible on the display, the Active Page is refreshed on the Main Display.

Request/Report Displayed Extent DECRQDE/DECRPDE

Levels: 3x, 4x (Windowing)

Purpose: To determine the area of page memory currently visible in the display window.

Request form:

CSI   "    v
9/11  2/2  7/6

Report form:

CSI   Ph ; Pw ; Pml ; Pmt ; Pmp  "    w
9/11  Ph ; Pw ; Pml ; Pmt ; Pmp  2/2  7/7

Description: The DECRQDE sequence, which takes no parameters, causes the device to respond with a DECRPDE control function describing the area of Page Memory being displayed on the physical screen.

The DECRPDE parameters provide the following information:

  • PhThe number of lines (height) of Page Memory being displayed in the window. This does not include any status line (see "Status Display"). If no lines from the active session are visible, 0 is returned (see "Session Management").

  • PwThe number of columns (width) of Page Memory being displayed in the window. Pw is not necessarily 0 when Ph is 0. Ph should be used to determine whether any lines are visible.

  • PmlThe column in Page Memory that is displayed in the leftmost column of the window.

  • PmtThe line in Page Memory that is displayed in the topmost line of the window.

  • PmpThe page of Page Memory that is being displayed through the window.

Select Number Of Lines Per Screen DECSNLS

Levels: Documented Exception (Windowing)

Purpose: To select a font size and corresponding maximum number of lines that will fit on the physical display.

Format:

CSI     Pn      *       |
9/11    Pn      2/10    7/12

Description: DECSNLS selects the maximum number of lines which can be displayed on the screen by choosing a corresponding font size.

Pn is a numeric parameter between 1 and 255 which indicates the number of lines which can be displayed on the screen at one time. If a value not directly supported by the terminal is selected, the next larger size supported will be used. If Pn is greater than the largest number of lines available, the largest number supported will be used. The number of lines per screen that can be supported will be clearly specified in the product documentation.

Although DECSNLS selects a font height which determines the maximum number of lines which can be displayed, the actual number of data lines displayed can be limited by other factors including the Page Size, whether there is a Status Display, and local window management functions if any. Applications can determine the actual number of lines displayed using the Request Display Extent (DECRQDE) control sequence.

Notes on DECSNLS:

  1. The terminal will not display more lines than are contained on a single page within a single window.

  2. A Status Display, if enabled, may occupy lines that would otherwise be available for showing data from the Logical Display Page.

  3. Unused lines will be left blank at the bottom of the window, or screen.

  4. DECSNLS is a "User Preference Feature" intended for terminal management use. It should not be modified by application software except in response to a user request. The terminal may provide a means to lock DECSNLS under local control (User Features Lock in Set-⁠Up) to prevent host modification.

  5. It is suggested that software specify Pn to match the Logical Display page sizes supported. This will provide the best compatibility between implementations.

  6. The terminal may provide a local mechanism to change DECSNLS automatically when the Page Size is changed ("auto resize window").

Pan Down (Scroll Up) SU

Levels: 3x, 4x (Windowing)

Purpose: To cause the current page to move up with respect to the window making another line visible at the bottom.

Format:

CSI     Pn      S       (default Pn: 1)
9/11    Pn      5/3

Description: Causes the entire visible contents of the current page to move up one or more lines on the physical display according to the parameter. The line at the top border of the window is no longer seen, and a new line appears at bottom border of the window for each position moved. A numeric parameter of zero or one causes the page to move one line.

The window cannot be moved beyond the boundaries of the page.

This control affects what is visible on the physical display only. No movement of data within the Logical Display occurs. The Active Position does not change.

Pan Up (Scroll Down) SD

Levels: 3x, 4x (Windowing)

Purpose: To cause the current page to move down with respect to the window making another line visible at the top.

Format:

CSI     Pn      T       (default Pn: 1)
9/11    Pn      5/4

Description: Causes the entire visible contents of the current page to move down one or more lines on the physical display according to the parameter. The line at the bottom border of the window is no longer seen, and a new line appears at top border of the window for each position moved. A numeric parameter of zero or one causes the page to move one line.

The window cannot be moved beyond the boundaries of the page.

This control affects what is visible on the physical display only. No movement of data within the Logical Display occurs. The Active Position does not change.

5.6 Visual Renditions

This subsection describes functions used to control the visual appearance of characters on the display. Attributes to be controlled include screen background (light or dark), character size (double wide and double size line attributes), character emphasis (bold, blink, underline, reverse), and character color when the Color Text Extension is implemented.

The following control functions are described herein:

Set/Reset Screen Mode DECSCNM

Levels: 1-4

Purpose: Change the state of Screen Mode between Normal (reset) and Reverse (set) screen.

Set Format:

CSI ? 5 h

Reset Format:

CSI ? 5 l

Description: A conforming device shall provide the capability of operating the physical display in either "normal" [reset state = normal] or "reverse" [set state = reverse] screen. The Screen Mode setting allows the terminal operator to define his screen state with respect to normal character rendition. Changing the mode reverses the definitions of the foreground and background colors. The actual color values are not specified by the architecture, and are implementation defined. All character renditions must be achievable as defined on both normal and reverse screens.

Note: Conforming software should not depend on the speed of execution when changing Screen Mode. It may take as long as the time required to repaint the entire screen, depending on the hardware implementation.

State Affected:

  • screen_mode

Algorithm:

void set_screen_mode()
{
screen_mode = REVERSE_SCREEN;
}


void reset_screen_mode()
{
screen_mode = NORMAL_SCREEN;
}

Known Deviations: None

5.6.1 Line Renditions

A conforming device shall support the following line renditions:

  • single-height, single-width
  • single-height, double-width
  • double-height, double-width top
  • double-height, double-width bottom

Only one rendition may be set per line (they are mutually exclusive). Setting double-width or double-height renditions doubles the character cell width within the line, but does not affect the addressing of characters in the line (within the constraints of the physical display). For example, the character in column 5 of a single-width line will still be addressed as column 5 if the line rendition is changed to double-width, although the character field will now start in column 9 of the physical display. Furthermore, when the line rendition is set to double-width or double-height, character positions cannot be addressed which are more than half the current value of the right edge of the display.

Note: Conforming software will not draw only the top or the bottom of double-height lines. When double-height lines are used, both the top and bottom must be displayed in adjacent line positions. Otherwise, the visual display of the line and the cursor symbol registration is UNDEFINED.

Single-Width Line DECSWL

Levels: 1-4

Purpose: Set the Line Rendition of the Active Line to single-⁠width

Format:

ESC     #       5
1/11    2/3     3/5

Description: Setting this attribute causes all characters indicated by the codes contained in the Active Line to be displayed in single-width rendition.

Notes:

  1. Setting this attribute on a line which was previously double-width will cause the line length to be doubled.

  2. Setting this attribute does not cause data contained in the Active Line to be lost.

State Affected:

  • line_rendition[MAX_NUM_LINES]
  • active_position

Algorithm:

void single_width_line()
{
  short int base;
base = (active_position.page-1) * lines_per_page;
line_rendition[active_position.line + base] = SINGLE_WIDTH;
}

Known Deviations: None

Double-Width Line DECDWL

Levels: 1-4

Purpose: Set the Line Rendition of the Active Line to double-⁠width.

Format:

ESC     #       6
1/11    2/3     3/6

Description: Double-width characters are achieved by displaying the characters indicated by the codes contained in the Active Line in double-width rendition.

Notes:

  1. Setting this attribute causes the length of the Active Line to be reduced by half.

  2. Setting this attribute causes data which is beyond the end of the Active Line after execution of the control to be lost.

  3. This control does not operate when DECLRMM (Left Right Margin Mode) is set.

State Affected:

  • line_rendition[MAX_NUM_LINES]
  • active_position
  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]

Algorithm:

void double_width_line()
{
  column_t x;
  short int base;
base = (active_position.page-1) * lines_per_page;
line_rendition[active_position.line + base] = DOUBLE_WIDTH;
if (active_position.column > end_of_line(active_position.line))
  active_position.column = end_of_line(active_position.line);
for (x=end_of_line(active_position.line)+1;
     x<=columns_per_page;
     x++)
  {
  display[active_position.line + base][x].code = EMPTY_CHARACTER;
  }
}

Known Deviations: None

Double-Height Line DECDHLT,DECDHLB

Levels: 1-4

Purpose: Set the Line Rendition of the Active Line to double-⁠height top or double-height bottom.

Format:

ESC     #       3               top
1/11    2/3     3/3

ESC     #       4               bottom
1/11    2/3     3/4

Description: Double-height characters are achieved by setting the Line Rendition of adjacent lines to double-height top and double-height bottom. Setting double-height top causes the upper half of the characters indicated by the codes contained in the Active Line to be displayed in double-height and double-width rendition. Setting double-height bottom causes the lower half of the characters contained in the Active Line to be displayed in double-height and double-width rendition.

Notes:

  1. Conforming software will not draw only the top or the bottom of double-height lines. When double-height lines are used, both the top and bottom must be displayed in adjacent line positions. Otherwise, the visual display of the line and the cursor symbol registration is UNDEFINED.

  2. Since double-height also implies double-width, setting this attribute causes the length of the Active Line to be reduced by half.

  3. Setting this attribute causes data which is beyond the end of the Active Line after execution of the control to be lost.

  4. This control does not operate when DECLRMM (Left Right Margin Mode) is set.

State Affected:

  • line_rendition[MAX_NUM_LINES]
  • active_position
  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]

Algorithm:

void double_height_line_top()
{
  column_t x;
  short int base;
base = (active_position.page-1) * lines_per_page;
line_rendition[active_position.line + base] = DOUBLE_HEIGHT_TOP;
if (active_position.column > end_of_line(active_position.line))
  active_position.column = end_of_line(active_position.line);
for (x=end_of_line(active_position.line)+1;
     x<=columns_per_page;
     x++)
  {

  display[active_position.line + base][x].code = EMPTY_CHARACTER;
  }
}


void double_height_line_bottom()
{
  column_t x;
  short int base;
base = (active_position.page-1) * lines_per_page;
line_rendition[active_position.line + base] = DOUBLE_HEIGHT_TOP;
if (active_position.column > end_of_line(active_position.line))
  active_position.column = end_of_line(active_position.line);
for (x=end_of_line(active_position.line)+1;
     x<=columns_per_page;
     x++)
  {
  display[active_position.line + base][x].code = EMPTY_CHARACTER;
  }
}

Known Deviations: None

5.6.2 Character Renditions

Each character cell in the display has a set of visual attributes associated with it. These attributes can be defined using the concept of foreground and background values. A character cell consists of a rectangular area filled with a background color, and a character pattern written in a foreground color. Background and foreground values are at least binary in nature (i.e., they must have at least two clearly distinguishable visual states). Characters are rendered in the physical display by some combination of the background and foreground states. The actual values and meanings of the background and foreground colors are not specified by the architecture, and are implementation defined.

A conforming device shall provide normal, bold, underline, blink, and reverse renditions for each character in the display. These renditions can be combined in any manner for each character position independently. The architecture requires that each rendition and every possible rendition combination be individually distinguishable one from the other, without affecting the ability to recognize the character pattern within the cell. Graphic renditions apply to all graphic character codes (2/1 to 7/14 inclusive, and 10/0 to 15/15 inclusive) as well as to the Space character (2/0).

5.6.2.1 Normal Rendition

Normal rendition defines the rendering of characters in the physical display in its "natural" state, that is, where the character is rendered in the display foreground against a field of display background. Normal rendition is the absence of any special rendition of the character cell. (Note: Normal rendition of characters is dependent on the state of the Screen Mode, which is used to define the values of the foreground and background colors.)

5.6.2.2 Bold Rendition

Bold rendition of characters may be achieved either by emphasizing the display foreground without changing the background characteristics of the cell, or by intensifying the background color while holding the foreground value constant.

5.6.2.3 Blink Rendition

Blink rendition is achieved by alternating the stable rendition of a character with a different rendition at a fixed rate, with a duty cycle of approximately one second.

5.6.2.4 Underscore Rendition

Underscore rendition is achieved by the addition of a single horizontal bar extending the full width of the character field and rendered in the display foreground. The bar must be easily distinguishable from the underline character (5/15).

5.6.2.5 Reverse Rendition

Reverse rendition is achieved by using the current value of the foreground color as the cell background, and the current value of the background color as the foreground.

Select Graphic Rendition SGR

Levels: 1-4

Purpose: Designate the graphic rendition to be applied to all subsequent characters entered into the display.

Format:

CSI     Ps ; ... ; Ps   m       default Ps: 0
9/11    Ps ; ... ; Ps   6/13

Description: The SGR control selects the graphic rendition (visual attribute) to be applied to all subsequent characters entered into the display. The parameter values indicate the combination of renditions to be selected as indicated in the following table (for both Level 1 and Level 2):

ParameterRendition
0All renditions off
1Bold
4Underscore
5Blink
7Negative (reverse) image

The following additional values are recognized in Level 2 operation. Although these values may be recognized when the terminal is operating as a Level 1 device, conforming software shall not rely on this feature.

ParameterRendition
22Normal intensity (Bold off)
24Not Underscore
25Steady (not Blink)
27Positive image

Notes:

  1. All other parameter values shall be ignored unless they are part of a well defined extension to the architecture.

  2. Renditions may be selected in any combination, and will be rendered appropriately. Selecting additional renditions does not affect the setting of previously selected renditions (newly selected renditions will be combined with previously selected renditions) unless all renditions are turned off (parameter value zero (0)).

  3. In no way does the selection of current rendition affect the rendition of characters already entered into the display.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]

Algorithm:

void select_graphic_rendition(parc, parv)
  short int parc;
  short int parv[MAX_NUM_PARAMETERS];
{
  short int n;
if (parc == 0) parc = 1;
for (n=0; n<parc; n++)
  {
  switch(parv[n])
    {
    case 0:
      current_rendition.bold = FALSE;
      current_rendition.underscore = FALSE;
      current_rendition.blink = FALSE;
      current_rendition.reverse = FALSE;
      break;
    case 1:
      current_rendition.bold = TRUE;
      break;
    case 4:
      current_rendition.underscore = TRUE;
      break;
    case 5:
      current_rendition.blink = TRUE;
      break;
    case 7:
      current_rendition.reverse = TRUE;
      break;
    default:
      break;
    }
  if (conformance_level == LEVEL_2)
    {
    switch(parv[n])
      {
      case 22:
        current_rendition.bold = FALSE;
        break;
      case 24:
        current_rendition.underscore = FALSE;
        break;
      case 25:
        current_rendition.blink = FALSE;
        break;
      case 27:
        current_rendition.reverse = FALSE;
        break;
      default:
        break;
      }
    }
  }
}

Known Deviations: None

5.6.3 ANSI Color Text Extension

The Color Text Extension provides for the selection of text foreground and background colors on a per character basis using SGR color parameters. The Color Text extension may be provided at Level 2 or higher of the Character Cell Display service class, and is indicated by the extension parameter 22 in the Device Attributes (DA) response.

5.6.3.1 SGR Color Selection

A conforming device shall recognize parameter values 30-37 and 39 to the SELECT GRAPHIC RENDITION (SGR) control sequence to select the foreground color attribute and parameter values 40-47 and 49 to select the background color attribute, as specified in the table. The eight colors listed as factory defaults shall be available at a minimum. These colors are taken from the ANSI X3.64 standard.

SGRmeaningfactory default color
30foreground color 0black
31foreground color 1red
32foreground color 2green
33foreground color 3yellow
34foreground color 4blue
35foreground color 5magenta
36foreground color 6cyan
37foreground color 7white
39default foreground color<device-dependent>
40background color 0black
41background color 1red
42background color 2green
43background color 3yellow
44background color 4blue
45background color 5magenta
46background color 6cyan
47background color 7white
49default background color<device-dependent>

A device may provide means, either under software or local control, to modify these colors and may provide means to save the modified colors in non-volatile memory.

5.6.3.2 Interaction With Other Visual Renditions

The foreground color and background color are maintained as part of the current_rendition. As new characters are written to the display, the current_rendition is used to update the attribute bits associated with each character in display memory.

Selecting the Reverse Rendition (SGR parameter 7) will, if the Reverse Rendition is not already set, be equivalent to invoking the current foreground color as the new background color, and the current background color as the new foreground color. Likewise, selecting the Positive Rendition (SGR parameter 27) will, if the Positive Rendition is not already set, be equivalent to invoking the current foreground color as the new background color, and the current background color as the new foreground color.

SGR parameters 30-37 and 39, the nine foreground color specifiers, will set the foreground color without regard to whether the Reverse Rendition is set. Likewise, SGR parameters 40-47 and 49, the nine background color specifiers, will set the background color without regard to whether the Reverse Rendition is set.

SGR parameter 0 (all renditions off) will reset the foreground and background color attributes to their defaults (equivalent to SGR parameters 39 and 49). SOFT TERMINAL RESET (DECSTR) will similarly cause the foreground and background color attributes to be reset.

When the Color Text Extension is present, the Bold Rendition (SGR parameter 1) should be distinguished by a heavier weight font (Guideline). It is preferable not to use a separate color (increased intensity) for bolding in order to keep it distinct from the other color text attributes.

Changing between normal and reverse screen mode (DECSCNM) will affect which attribute bits from display memory are used to render the text foreground and background color. It does not affect the current_rendition, or how the current_rendition is applied to the character attribute bits associated with each character in display memory.

The architecture does not specify the default text foreground or background colors. It is recommended however that normal screen mode correspond to lighter text on a darker background (not mandatory). The factory default for screen mode is device dependent. A device may provide means to save the screen mode in non-volatile memory so as to override the factory default at power-up.

5.6.3.3 Color Maps

A color map is a table that associates a binary value in display memory with a color that can be produced on the display. During display refresh, the active color map is used to translate color values from display memory to colors that appear on the screen. The size of the active color map cannot exceed 2**N entries where N is the number of bits used to represent a color in display memory (often the number of bit planes).

A device can have many color maps of which only one is active at time, or can assign color map entries from a single color map to different applications, limiting the size of each application's color map. Color maps can be read-only (fixed), or read-write (modifiable under software control).

Applications often model color selection as asking for a particular color (non-indexed, absolute color specification, read-⁠only), or asking for a particular color map entry (indexed color, read-write). When using indexed color, it is normal to allow the application to modify a color map entry causing all objects written with that color index to change color on the display.

Conforming devices may implement the ANSI SGR colors as indexed or non-indexed, and may allow selecting between these two models under local control.

5.6.3.4 Color Table Report (DECCTR)

A conforming device that supports the TSI and Color Text Extensions, and has a color table shall be capable of reporting the color table in the form of a DECCTR sequence as follows.

Color Table Request/Report/Restore DECCTR

Levels: 2x, 3x, 4x (TSI and Color Text)

Purpose: To Request, Report, and Restore the contents of the color table.

Request Format:

CSI  2   ;    Pu  $    u     (DECRQTSR Ps=2)
9/11 3/2 3/11 3/? 2/4  7/5

Report Format:

DCS 2   $    s  D...D ST     (DECTSR Ps=2)
9/0 3/2 2/4 7/3 D...D 9/12

Restore Format:

DCS 2   $   p   D...D ST     (DECRSTS Ps=2)
9/0 3/2 2/4 7/0 D...D ST

Where D...D consists of groups of 5 parameters as follows:

Pc; Pu; Px; Py; Pz / Pc; Pu; Px; Py; Pz / ...

  • Pc is the color number 0-255.
  • Pu is the color coordinate system
    • 0 = illegal
    • 1 = HLS (hue 0-360, lightness 0-100, saturation 0-100)
    • 2 = RGB (red 0-100, green 0-100, blue 0-100)
  • Px, Py, Px are values in the color coordinate system specified by Pu.
  • ; is the semicolon character (3/11)
  • / is the slach character (2/15)

Description: DECRQTSR with parameter 2 is sent from the host to the terminal to request a color table report. The terminal responds with a DECTSR control with parameter 2 and each color table entry given as a group of 5 parameters in the data string. To load or restore a previously reported color map, the host transmits the DECRSTS control with parameter 2 and the desired color map definitions in the data string. When loading the color map, only the index entries specified are changed.

When using DECRQTSR to request a color table report, you can include an additional parameter Pu to select the color coordinate system the terminal uses to report the color map (0=default, 1=HLS, 2=RGB).

5.6.3.5 Default Color Assignment (Guideline)

When indexed color is used, the following color map assignments are recommended to maximize compatibility among implementations when the colors are not specified explicitly (not mandatory). "Normal" text foreground and background refers to when Screen Mode is reset.

Four or more plane (16 or more color) color map:
ColorMonoText Use
0 blackblacknormal background
1 bluegray-2
2 redgray-4
3 greengray-6
4 magentagray-1
5 blackgray-3black text
6 whitegray-5white text
7 gray 50%whitenormal foreground
8 gray 25%black
9 blue*gray-2blue text
10 red*gray-4red text
11 green*gray-6green text
12 magenta*gray-1magenta text
13 cyan*gray-3cyan text
14 yellow*gray-5yellow text
15 gray 75%whitebold text (VT340)
* = may be less saturated

If more than four planes are supported, this series of 16 colors can be repeated as needed.

5.6.3.6 Color Interaction Among Modes And Data Syntaxes (Guideline)

ANSI Color Text, Sixels, and ReGIS can all support indexed color using a similar color model. A conforming device may share a single color map among these protocols so that changing a color definition in one protocol will affect the color map used by the other protocols. Support for the option of sharing the same color map is recommended, but not mandatory. Conforming software should not depend on cross protocol side effects if maximum portability is desired.

5.6.3.7 Alternative Text Rendition Mapping (Guideline)

Some previous terminals which do not support ANSI Color Text allowed other SGR parameters to select text colors.

VT241
Color Entry
0normal text background
1reverse graphic rendition (SGR 7)
2bold graphic rendition (SGR 1)
3normal text foreground

For backward compatibility, the VT340 provides an alternative text rendition mapping mode selectable from Set-Up.

VT340 Alternative Text Rendition Mapping
Color Entry
0normal text background
8reverse graphic rendition (SGR 7)
15bold graphic rendition (SGR 1)
7normal text foreground

When alternative text rendition mapping is not selected, the reverse attribute is rendered by exchanging the text foreground and background colors.

A conforming device may provide an alternative text rendition mapping mode selectable in Set-Up, but this is not part of the Color Text Extension. The factory default behavior should be to treat bold and reverse graphic renditions independently of color selection (not mandatory).

Select Text/Graphics Look-Up Table DECSTGLT

Levels: 3 (Documented Exception)

Purpose: To select color look-up table used and the mapping of text renditions to look-up table entries.

Format:

CSI   Ps   )    {
9/11  3/?  2/9  7/11
PsLook-Up Table
0monochrome look-up table (default)
1color look-up table, standard text rendition mapping
2color look-up table, alternative text rendition mapping

Description: DECSTGLT permits host selection of the video color look-up table used in the device, and the mapping of text renditions to look-up table entries. This control function assumes the existence of two color look-up tables: monochrome and color. When a color look-up table is selected, two text rendition mappings can be defined, called "standard" and "alternative". The "standard" mapping permits the reverse video rendition to use a different color look-up table entry for the background of displayed text. The "alternative" mapping restricts text rendition mapping to a single background entry, and one or two foreground entries (two if the bold graphic rendition is effected through increased intensity). In other words, the alternative mapping supports the use of bold and reverse graphic renditions to select text foreground colors.

This control function is not intended to supplant the Color Text Extension, but instead provide a means of backward compatibility to earlier video devices which provided several different text rendition mappings based on different monitor configurations.

5.7 Audible Indicator

A conforming device shall provide a warning "bell", or some similar audible indicator suitable to signal the operator's attention. It may be possible to change the volume of the bell sound, or disable it entirely, as a local Setup function.

Warning Bell BEL

Levels: 1-4

Purpose: Rings the terminal bell.

Format:

BEL

0/7

Description: The BEL control causes the terminal to emit an audible tone of brief duration.

Notes:

  1. It may be possible to change the volume of the bell sound, or disable it entirely, as a local Setup function.

State Affected: none

5.8 Graphic Character Sets

The terminal shall maintain a repertory of available character sets which may be used to interpret received data characters to be displayed. The character sets must be selectable on a per character basis, and are mutually exclusive (that is, there can be only one character set value for each character position in the Logical Display). Refer to the Code Extension Chapter of this standard (DEC STD 70-3) for more information on designating and invoking character sets, G-sets, and the structure of the in-use table.

5.8.1 Character Set Repertoire

The table below shows the graphic character sets required at each Conformance Level, and those available as Extensions.

Character Set(s)Level at which required, or availabe as Extension
U.S. ASCII1-4
DEC Line Drawingl-4
DEC Supplemental Graphic2-4
ISO Latin-1 Supplemental2x, 3-4
UPSS2x, 3-4
UK set (United Kingdom)1x
NRCS1x, 2x, 3x, 4x
JIS_ROMAN, JIS_KATAKANA2x, 3x, 4x
DRCS2x, 3x, 4x
DEC Technical3x, 4x

Notes:

  1. ISO Latin-1 Supplemental is available at Level 2 as part of the 8-bit Interface Architecture Extension.

  2. UPSS (User Preference Supplemental Set) is not actually a character set in itself, but a pointer to one of the supplemental sets (usually DEC Supplemental or ISO Latin-1 Supplemental). UPSS is available at Level 2 as part of the 8-bit Interface Architecture Extension.

  3. The UK set is an optional extension to Level 1 which if present, may be selected in Set-Up to replace ASCII (ASCII and UK cannot be designated simultaneously). This extension was implemented on the VT100, but has since been replaced by the NRCS Extension.

  4. NRCS (National Replacement Character Set) is an extension which provides twelve 7-bit NRC sets, one of which may be selected under local user control (Set-Up) to replace U.S. ASCII as the default set. See DECNRCM. Depending on the implementation, only one NRC set corresponding to the keyboard dialect may be selectable at a time.

  5. JIS_ROMAN and JIS_KATAKANA are part of the Katakana Extension.

  6. DRCS (Dynamically Redefinable Character Set) is an extension which allows a soft character set to be downloaded from the host and assigned a designating sequence possibly replacing an existing character set. See Chapter 10 of this standard (DEC STD 70-10), DRCS Extension.

The character sets themselves are described in DEC STD 169 Digital Standard Coded graphic Character Sets for Hardware and Software.

5.8.2 Character Set Selection

Character sets are identified to the terminal using designating escape sequences which must be registered in DEC Standard 138. Each sequence consists of zero, one, or two intermediate characters in the range 2/0 through 2/15, followed by a final character in the range 3/0 through 7/15, the combination of which uniquely identifies the character set to be designated. (Note: the designating sequence is preceded by the Escape character (1/11) and a single intermediate value 2/8, 2/9, 2/10, or 2/11 indicating which of the four G-sets the specified character set is to be designated into. For a complete description of the designating and invoking process, see the section "Code Extension Layer", DEC STD 70-3.)

Designate Character Set SCS

Levels: 1-4

Purpose: Designate the graphic character sets.

Format:

ESC  <G-Set designator>  <Character set designator>

The G-Set designators are:

  • 94 character sets
    • G0 (2/8
    • G1 )2/9
    • G2 *2/10
    • G3 +2/11
  • 96 character sets
    • G1 -2/13
    • G2 .2/14
    • G3 /2/15

The Character set designators are:

  • ASCII_G B4/2
  • LINE_DRAWING_G 03/0
  • DEC_SUPPLEMENTAL_G %52/5 3/5
  • ISO_LATIN1_SUPPLEMENTAL_G A4/1
  • UPSS_G <3/12
  • DRCS_G I I F2/? 2/? ?/?
  • TCS_G >
  • JIS Roman J4/10
  • JIS Katakana I4/9
  • NRCS
    • British A
    • Dutch 4(discontinued in L3)
    • Finnish 5 or C
    • French R
    • French Canadian Q
    • German K
    • Italian Y
    • Norwegian/Danish E or 6
    • Portuguese %6
    • Spanish Z
    • Swedish 7 or H
    • Swiss =

For example,

  • ESC ( B designates ASCII_G to G0
  • ESC ) 0 designates Line Drawing to G1
  • ESC * < designates the UPSS to G2

Description: The character set designating escape sequences provide the means of selecting the G0, G1, G2, and G3 character sets, which can be invoked into the left (GL) and right (GR) sides of the In Use Table. (For a complete description of the G-sets and the In Use Table, see the section "Code Extension Layer".)

Notes:

  1. In Level 1 operation character sets can only be designated into G0 and G1, with G2 and G3 containing the ASCII character set by default.

  2. Conforming software will not change the default designations of the G0 and G2 character sets. The G1 and G3 sets will be used when it is desired to designate alternate character sets. Furthermore, conforming software will not designate ASCII_G to either G2 or G3, and will not designate Supplemental_G to either G0 or G1.

  3. Designating a character set which is invoked into the In Use Table at the time the control is executed causes the In Use Table to be changed to reflect the change to the designated set.

  4. As a Level 1 extension, the UK (United Kingdom) Character Set may be provided, and designated with the sequence ESC I A (1/11 I 4/1). If this extension is supported, it may also be possible to locally select the UK set to replace ASCII as the default 7-bit set. In this case, the UK set will be used in all instances in which ASCII is employed throughout the Video Systems Reference Manual when the terminal is in Level 1 operation.

  5. On traditional video terminals with the NRCS extension, it is permissable to only recognize the one NRC set corresponding to the keyboard dialect at a time. Workstation terminal emulators may extend the character set table to recognize all NRC sets regardless of the current keyboard dialect (not mandatory).

State Affected:

  • designated_graphic_sets[4]
  • in_use_table

Algorithm:

/***************
 *
 * Initialize the character set table
 *   This procedure should be called on power-up or
 *   reset to initialize the character set table
 *   with the appropriate designating sequences.
 *
 **************/
void intialize_character_set_table()
{
char_set_table[TABLE_ASCII].name = ASCII_G;
char_set_table[TABLE_ASCII].first_intermediate = 0;
char_set_table[TABLE_ASCII].second_intermediate = 0;
char_set_table[TABLE_ASCII].final = 'B';

char_set_table[TABLE_LINE_DRAWING].name = LINE_DRAWING_G;
char_set_table[TABLE_LINE_DRAWING].first_intermediate = 0;
char_set_table[TABLE_LINE_DRAWING].second_intermediate = 0;
char_set_table[TABLE_LINE_DRAWING].final = '0';

if (conformance_level >= LEVEL_2)
  {
  char_set_table[TABLE_DEC_SUPP].name = DEC_SUPPLEMENTAL_G;
  char_set_table[TABLE_DEC_SUPP].first_intermediate = '%';
  char_set_table[TABLE_DEC_SUPP].second_intermediate = 0;
  char_set_table[TABLE_DEC_SUPP].final = '5';

  if (level_2_extensions[DRCS_EXT]==TRUE)
    {
    char_set_table[TABLE_DRCS].name = DRCS_G;
    char_set_table[TABLE_DRCS].first_intermediate = 0;
    char_set_table[TABLE_DRCS].second_intermediate = 0;
    char_set_table[TABLE_DRCS].final = 0;
    }
  if (level_2_extensions[NRCS_EXT]==TRUE)
    {
    /*
       This entry is initialized to correspond
       with the keyboard dialect whenever it
       is changed in Set-Up.
     */
    char_set_table[TABLE_NRCS].name = NRCS_G;
    char_set_table[TABLE_NRCS].first_intermediate = 0;
    char_set_table[TABLE_NRCS].second_intermediate = 0;
    char_set_table[TABLE_NRCS].final = 0;
    }
  }
if ((conformance_level >= LEVEL_3) ||
    (level_2_extensions[EIGHT_BIT_IA]==TRUE))
  {
  char_set_table[TABLE_LATIN1].name = ISO_LATIN1_SUPPLEMENTAL_G;
  char_set_table[TABLE_LATIN1].first_intermediate = 0;
  char_set_table[TABLE_LATIN1].second_intermediate = 0;
  char_set_table[TABLE_LATIN1].final = 'A';

  char_set_table[TABLE_UPSS].name = UPSS_G;
  char_set_table[TABLE_UPSS].first_intermediate = 0;
  char_set_table[TABLE_UPSS].second_intermediate = 0;
  char_set_table[TABLE_UPSS].final = '<';
  }
if (level_3_extensions[TCS]==TRUE)
  {
  char_set_table[TABLE_TCS].name = TCS_G;
  char_set_table[TABLE_TCS].first_intermediate = 0;
  char_set_table[TABLE_TCS].second_intermediate = 0;
  char_set_table[TABLE_TCS].final = '>';
  }
}





void designate_character_set(parc, parv)
  /* parc and parv contain the count and values
     of the indermediate characters of the
     designating sequence */
  short int parc;
  short int parv[MAX_NUM_INTERMEDIATES];
{
  short int n;
  short int gset_number;
  short int set_size;
  boolean_t compare_designator();  /* function declaration */
/*.....................*/
/* find which set we're designating */
switch (parv[0])
  {
  case ')':  /* 2/8  designate 94 into G0 */
    gset_number = 0;
    set_size = 94;
    break;
  case '(':  /* 2/9  designate 94 into G1 */
    gset_number = 1;
    set_size = 94;
    break;
  case '*':  /* 2/10 designate 94 into G2 */
    gset_number = 2;
    set_size = 94;
    break;
  case '+':  /* 2/11 designate 94 into G3 */
    gset_number = 3;
    set_size = 94;
    break;
  case '-':  /* 2/13 designate 96 into G1 */
    gset_number = 1;
    set_size = 96;
    break;
  case '.':  /* 2/14 designate 96 into G2 */
    gset_number = 2;
    set_size = 96;
    break;
  case '/':  /* 2/15 designate 96 into G3 */
    gset_number = 3;
    set_size = 96;
    break;
  }

/* look for the designator in the table */
/*
   Note that because the DRCS designator is processed last,
   it will replace an installed set if the designator is
   identical.
*/
for (n=0; n<MAX_NUM_CHAR_SETS; n++)
  {
  if ( compare_designator(parc, parv, n) )
    {
    designated_graphic_sets[gset_number] =
      char_set_table[n].name;
    }
  }

/* update the in_use_table with
   the latest designations (if any)
   for the invoked gsets */
in_use_table.gl =
  designated_graphic_sets[in_use_table.invoked_gl];
if (conformance_level >= LEVEL_2)
  {
  in_use_table.gr =
    designated_graphic_sets[in_use_table.invoked_gr];
  }
/* perform hardware specific actions needed
   to update the character set displayed */
}  /* end procedure designate_character_set */


/*
 * compare sequence designator to table entry n
 */
boolean_t compare_designator(parc, parv, n)
  short int parc;  /* number of sequence characters */
  short int parv[MAX_NUM_INTERMEDIATES];
  short int n;     /* char set table entry */
{
  boolean_t status;
status = TRUE;
if (char_set_table[n].final != parv[parc-1])
  status = FALSE;
else
  {
  if (parc > 2)
    {
    if (char_set_table[n].first_intermediate != parv[1])
      status = FALSE;
    else
      {
      if (parc >= 3)
        if (char_set_table[n].second_intermediate != parv[2])
          status = FALSE;
      }
    }
  }
return(status);
}

Known Deviations: None

Assign User-Preference Supplemental Set DECAUPSS

Levels: 2x (8-bit Interface Architecture), 3-4

Purpose: To assign a user preferred supplemental set

Format:

DCS  Ps  !    u    Dscs  ST
9/0      2/1  7/5        9/12

Description: This control string assigns a character set to be the User-Preference Supplemental Set (UPSS). The User-Preference Supplemental Set serves the following functions:

  1. It acts as the default supplemental set for reception. On soft terminal reset, the UPSS is designated as G2.

  2. It acts as the keyboard supplemental set, that is, it determines which supplemental characters can be generated from the keyboard (including valid compose sequences).

  3. It provides a level of indirection for application software. The UPSS can be explicitly designated without needing to know the actual character set assigned.

Currently DEC Supplemental and ISO Latin-1 supplemental may be used as the UPSS. The default User-Preference Supplemental Set is determined through a Set-Up feature. The value of Ps and Dscs denote which set from the terminal's repertory of character sets is to be the User-Preference Supplemental Set.

Ps selects between 94 and 96 character sets (Ps = 0 selets a 94 character set). Dscs is the intermediate and final characters of the SCS escape sequence used to explicitly designated that character set. For example a value of "% 5" for Dscs indicates that the DEC Supplemental character set is the User-Preference Supplemental set. See the SCS command for more information on the designating intermediate and final characters. Attempts to assign an invalid supplemental set will be ignored.

Notes on DECAUPSS:

  1. The DRCS can be used as the UPSS by naming it as DEC Supplemental or ISO Latin-1 supplemental.

  2. Assigning a new UPSS will immediately update the In-Use table if the UPSS is currently designated and invoked.

  3. This sequence is sent from the terminal to the host in response to a DECRQUPSS request.

State Affected:

  • upss /* defined in code extension layer */

Algorithm:

void assign_user_preference_set(parv, string)
  short int parv[MAX_NUM_PARAMETERS];
  char string[];
{
if ((conformance_level >= LEVEL_3) ||
    (level_2_extensions[EIGHT_BIT_IA] == TRUE))
  {
  /* update upss state in Code Extension Layer */
  if ((parv[0] = 0) && (strcmp(string, "%5") == 0))
    {
    /* size is 94 characters */
    upss = DEC_SUPPLEMENTAL_G;
    }
  else if ((parv[0] = 1) && (strcmp(string, "A") == 0))
    {
    /* size is 96 characters */
    upss = ISO_LATIN1_SUPPLEMENTAL_G;
    }

  /* update in use table */
  if (in_use_table.gl == UPSS_G)
    {
    ; /* perform hardware dependent actions as needed */
    }
  if (in_use_table.gr == UPSS_G)
    {
    ; /* perform hardware dependent actions as needed */
    }
  }
}

Known Deviations: None

Request User-Preference Supplemental Set DECRQUPSS

Levels: 2x (8-bit Interface Architecture), 3-4

Purpose: To request the user preferred supplemental set

Format:

CSI   &    u
9/11  2/6  7/5

Description: Upon receipt of this sequence, the terminal will return a DECAUPSS sequence which specifies which coded character set is assigned to be the User-Preference Supplemental Set.

State Affected: none

Algorithm:

void request_user_preference_set()
{
if ((conformance_level >= LEVEL_3) ||
    (level_2_extensions[EIGHT_BIT_IA] == TRUE))
  {
  send_char(0x90, host_port);  /* DCS */
  if (upss = DEC_SUPPLEMENTAL_G)
    {
    send_int(0, host_port);
    send_string("!u%5", host_port);
    }
  else if (upss = ISO_LATIN1_SUPPLEMENTAL_G)
    {
    send_int(1, host_port);
    send_string("!uA", host_port);
    }
  send_char(0x9C, host_port);  /* ST */
  }
}

Known Deviations: None

Set/Reset Character Set Mode DECNRCM

Levels: 1x, 2x, 3x, 4x (NRCS Extension)

Purpose: To select 8-bit Multinational Characters, or 7-bit NRCS Characters for transmission (keyboard) and reception (display).

To set:

CSI ? 42 h   (7-bit NRCS Characters)

To reset:

CSI ? 42 l   (8-bit Multinational Characters)

Description: This parameter is applicaple to the Set Mode and Reset Mode control sequence. When 8-bit Multinational Characters is selected (factory default), the terminal uses ASCII in GL and either DEC Supplemental or ISO Latin-1 Supplemental in GR (depending on the UPSS). When 7-bit NRCS Characters is selected, a 7-bit National Replacement Character set is used for transmission and reception in GL (GR is not used). The NRCS used is determined by the Keyboard Dialect chosen in Set-Up (see "Keyboard Processing", DEC STD 70-6).

Notes on DECNRCM:

  1. Changing this mode has the side effect of re-initializing the designated and invoked character sets to their default state (the state at power-on or reset). If 7-bit NRCS Characters is selected, a 7-bit NRC Set may replace U.S. ASCII in the default designations.

  2. 8-bit Characters are temporarily disabled when in Level 1 (VT100 mode), or a 7-bit host line environment is selected. The DECNRCM sequence will still be recognized, but in the case of the reset sequence, 8-bit characters will remain disabled until the restrictive conditions are removed.

  3. This sequence is ignored when the North American or Dutch Keyboard Dialect is selected. These keyboard dialects use U.S. ASCII as their 7-bit set, so there is no need to disable the multinational set (which includes U.S. ASCII as its left half) to access 7-bit NRC characters. U.S. ASCII may be considered the NRC set for North America.

State Affected:

  • character_set_mode
  • r_character_set_mode /* used to keep track of character set mode when a restrictive condition (7-bit Host Line, or VT100 mode) is in effect */
  • in_use_table
  • designated_graphic_sets[4]

Algorithm:

void set_character_set_mode()
{
if (level_1_extensions[NRCS_EXT]==TRUE)
  {
  character_set_mode = SEVEN_BIT_NATIONAL;
  /* keep track of mode if there are restrictions in effect */
  r_character_set_mode = SEVEN_BIT_NATIONAL;
  if (keyboard_usage_mode == TYPEWRITER)
    {
    in_use_table.gl = nrcs_list[keyboard_dialect];
    in_use_table.gr = nrcs_list[keyboard_dialect];
    in_use_table.invoked_gl = G0;
    in_use_table.invoked_gr = G2;
    designated_graphic_sets[0] = nrcs_list[keyboard_dialect];
    designated_graphic_sets[1] = nrcs_list[keyboard_dialect];
    designated_graphic_sets[2] = nrcs_list[keyboard_dialect];
    designated_graphic_sets[3] = nrcs_list[keyboard_dialect];
    }
  else    /* keyboard usage mode is Data Processing */
    {
    in_use_table.gl = ASCII_G;
    in_use_table.gr = ASCII_G;
    in_use_table.invoked_gl = G0;
    in_use_table.invoked_gr = G2;
    designated_graphic_sets[0] = ASCII_G;
    designated_graphic_sets[1] = ASCII_G;
    designated_graphic_sets[2] = ASCII_G;
    designated_graphic_sets[3] = ASCII_G;
    }
  }
}


void reset_character_set_mode()
{
if (level_1_extensions[NRCS_EXT]==TRUE)
  {
  /* keep track of mode if there are restrictions in effect */
  r_character_set_mode = EIGHT_BIT_MULTINATIONAL;
  /* ignore if 7-bit host line or VT100 mode */
  if ((host_port_environment != SEVEN_BIT) &&
      (conformance_level != LEVEL_1))
    {
    character_set_mode = EIGHT_BIT_MULTINATIONAL;
    in_use_table.gl = ASCII_G;
    in_use_table.gr = UPSS_G;
    in_use_table.invoked_gl = G0;
    in_use_table.invoked_gr = G2;
    designated_graphic_sets[0] = ASCII_G;
    designated_graphic_sets[1] = ASCII_G;
    designated_graphic_sets[2] = UPSS_G;
    designated_graphic_sets[3] = UPSS_G;
    }
  }
}

Known Deviations: None

5.9 Summary Of Control Character Processing

This subsection provides a summary of control character processing as a convenience to the reader, and to include control characters which are not described in detail in their corresponding functional subsection of this chapter (DEC STD 70-5).

5.9.1 C0 Control Characters

C0 control characters are those with values of 0/0 to 1/15, and 7/15 (0 - 31, and 127 decimal). The following is a description of the control characters recognized by conforming devices. All other C0 control characters cause no action to be taken.

ControlCol/⁠RowAction Taken
NUL0/0Ignored on input (not stored in input buffer). May be used as a time fill character. Note: When Control Representation Mode is Set, NUL is not ignored, but displayed, and may not be used as a time fill character.
ENQ0/5Transmit answerback message.
BEL0/7Causes bell tone to sound from keyboard.
BS0/8Causes the cursor to move to the left one character position, unless it is at the left margin. Does not cause wrap.
HT0/9Causes the cursor to move to the next tab stop, or the right margin if no further tab stops. Does not cause wrap.
LF0/10Causes a line feed or a new line operation depending on the setting of Line Feed/New Line Mode (LNM). LF causes a line to be printed if in auto print mode.
VT0/11Interpreted as a LF.
FF0/12Interpreted as a LF.
CR0/13Cursor goes to left margin. If cursor is already left of the left margin, cursor goes to column 1.
SO (LS1)0/14Invoke G1 character set into GL.
SI (LS0)0/15Invoke G0 character set into GL.
XON1/1Causes terminal to resume transmitting, if XOFF handling is enabled.
XOFF1/3Causes terminal to stop transmitting all codes except XOFF and XON, if XOFF handling is enabled.
CAN1/8If received during an escape or control sequence, the sequence is immediately terminated and not executed. No character is displayed.
SUB1/10If received during an escape or control sequence, the sequence is immediately terminated and not executed. The error character (reverse question mark) is displayed.
ESC1/11Introduces an escape sequence. Terminates any escape, control sequence, or control string in progress.
DEL7/15Ignored on input (not stored in input buffer). May not be used as a time fill character.

5.9.2 C1 Control Characters

C1 control characters are those with positions of 8/0 to 9/15. The following is a description of the C1 control characters which are recognized by conforming devices. All other C1 control characters cause no action to be taken.

Note C1 controls can be represented by ESC Fe sequences in 7-bits. See "Code Extension Layer" (DEC STD 70-3).

ControlCol/⁠RowAction Taken
IND8/4INDEX - Causes the active position to move downward one line without changing the horizontal position. If the active position is at the bottom margin, a scroll up is performed.
NEL8/5NEXT LINE - Causes the active position to move to the first position on the next line downward. If the active position is at the bottom margin, a scroll action is performed. (a CR LF is executed).
HTS8/8HORIZONTAL TABULATION SET Sets one horizontal tabulation stop at the column of the active position (See also, TBC).
RI8/13REVERSE INDEX - Moves the active position to the same horizontal position on the preceding line. If the active position is at the top margin, a scroll down is performed.
SS28/14SINGLE SHIFT 2 - Causes the G2 set to be invoked for the next single displayed character.
SS38/15SINGLE SHIFT 3 - Causes the G3 set to be invoked for the next single displayable character.
DCS9/0DEVICE CONTROL STRING - Introduces a Device Control String.
SOS9/8START OF STRING - This control is ignored.
DECID (reserved)9/10DEC PRIVATE IDENTIFICATION - Causes the same response as the ANSI device attributes (see DA). This sequence is not recognized a Level 3 or above. Conforming software shall use DA. Note: If printer controller mode is enabled, the sequence will be sent to the printer.
CSI9/11CONTROL SEQUENCE INTRODUCER - Introduces a control sequence.
ST9/12STRING TERMINATOR - Terminates Control Strings introduced by DCS, APC, OSC, and PM.
OSC9/13Operating System Command - A control string.
PM9/14Privacy Message - A control string.
APC9/15Application Program Command - A control string.

Substitute SUB

Levels: 1-4

Purpose: Place a reversed question mark symbol in the display.

Format:

SUB
1/10

Description: The SUB control is used to indicate the presence of characters in the data stream for which there is no graphic representation. This control is processed by placing a reversed question mark in the display at the Active Position.

Notes:

  1. The character to be displayed in cases where the reversed question mark cannot be used is a "half-tone blotch", which is rendered by filling the entire character cell in the display with a cross-hatched pattern.

  2. Receipt of the Substitute character within an escape or control sequence causes the sequence in progress to be aborted and the Substitute control function to be executed instead (that is, the reversed question mark symbol will be displayed). (See the section "Code Extension Layer" for a complete description of the handling of control characters within escape and control sequences.)

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void substitute()
{
short int sub = 0x1A;
/*..........*/

/* place a reversed question mark in the display */
insert_or_replace_character(&sub);
}

Known Deviations:

Most existing terminals (VT100, VT101, VT102, VT125, VT131, VT132) display the blotch character instead of the reversed question mark.

5.10 Modes States (And Mode Descriptions)

A conforming device shall provide certain programmable state capabilities or modes as described below. It should be noted that some modes are identified as User Preference Features (see the section "Concepts and Conformance Criteria" for a list of the modes which are classified as User Preference Features). The state of these features should not be changed by conforming software, except in response to an explicit user request (for example, a request to change the screen width).

5.10.1 SM/RM - Set Mode, Reset Mode Sequence

The Set Mode/Reset Mode control sequence is used to control the state of various settable modes in the terminal.

Set Format:

CSI   Ps...Ps  l
9/11  Ps...Ps  6/12

Reset Format:

CSI   Ps...Ps  h
9/11  Ps...Ps  6/8

Sets/Resets one or more modes of the terminal as specified by each selective parameter in the parameter string. Each mode to be set/⁠reset is specified by a separate parameter.

Note that ANSI specified mode parameters and DEC private mode parameters may not be mixed within the same SM or RM sequence.

5.10.1.1 ANSI Specified Modes:

Mode ParameterMnemonicMode Function
0Error (ignored)
2KAMKeyboard Action Mode
4IRMInsert Replacement Mode
12SRMSend-Receive Mode
20LNMLine Feed New Line Mode

5.10.1.2 DEC Private Modes:

If the first character in the parameter string is 3/15 (?), the parameters are interpreted as DEC private parameters, according to the following table.

Mode ParameterMnemonicMode Function
0Error (ignored)
1DECCKMCursor Key Mode
3DECCOLMColumn Mode
4DECSCLMScrolling Mode
5DECSCNMScreen Mode
6DECOMOrigin Mode
7DECAWMAutowrap Mode
8DECARMAutorepeating Mode
18DECPFFPrint Form Feed
19DECPEXPrint Extent
25DECCEMCursor Enable Mode
38DECTEKTektronix 4010/4014 Mode
42DECNRCMNational Character set mode
61DECVCCMVertical Coupling
64DECPCCMPage Coupling
68DECKBUMKeyboard Usage Mode
69DECLRMMLeft Right Margin Mode
73DECXRLMTransmit Rate Limiting

Any other parameter values are ignored.

5.10.1.3 Modes That Cannot Be Changed

The following modes which are specified in the ANSI X3.64-1979 standard may be considered to be permanently set, permanently reset, or not applicable, as noted. Refer to that standard for further information concerning these modes.

Mode MnemonicMode FunctionState
EBMEditing Boundary ModeReset
FEAMFormat Effector Action ModeReset
FETMFormat Effector Transfer ModeNA
HEMHorizontal Editing ModeReset
MATMMultiple Area Transfer ModeNA
PUMPositioning Unit ModeReset
SATMSelected Area Transfer ModeNA
SRTMStatus Reporting Transfer ModeReset
TSMTabulation Stop ModeReset
VEMVertical Editing ModeReset

5.10.2 Mode Descriptions

The detailed descriptions for many of the modes that use the SM/RM sequences are included in other parts of this standard (DEC STD 70) to keep related functions together.

Set/Reset Send Receive Mode SRM

Levels: 1-4

Purpose: To turn the local echo feature ON or OFF

Set Format:

CSI 12 h        (local echo off, default)

Reset Format:

CSI 12 l        (local echo on)

Description: SRM is a parameter applicable to the Set Mode and Reset Mode control sequences. The reset state causes local echo to be ON. The set state causes local echo to be OFF.

State Affected:

  • send_receive_mode /* See Keyboard Processing */
  • r_send_receive_mode

Algorithm:

void set_send_receive_mode()
{
send_receive_mode = ECHO_OFF;
/* remember state in case there are restrictions */
r_send_receive_mode = ECHO_OFF;
}


void reset_send_receive_mode()
{
/* remember state in case there are restrictions */
r_send_receive_mode = ECHO_ON;
if ((printer_controller_mode != PRINTER_CONTROLLER_ON) &&
    (line_local_mode != LOCAL))
  send_receive_mode = ECHO_ON;
}

Known Deviations: None

5.11 Editing Functions

This subsection describes the following functions used to edit data, or control editing in the Logical Display.

Set/Reset Insert/Replacement Mode IRM

Levels: 1X, 2-4

Purpose: Change the state of Insert/Replacement Mode between Replace (reset) and Insert (set) graphic characters.

Set Format:

CSI 4 h

Reset Format:

CSI 4 l

Description: A conforming device shall provide the ability to select whether characters entered into character positions which already contain data shall overwrite the character at that position [reset state = replace], or shall be inserted by causing all data on the line starting at the Active Position to be shifted one column to the right to accommodate the new character [set state = insert].

Notes:

  1. The IRM controls are part of the Level 1 Editing Extension. This extension is required in all new Level 1 implementations. They are required functions in Level 2.

State Affected:

  • insert_replacement_mode

Algorithm:

void set_insert_replacement_mode()
{
insert_replacement_mode = INSERT;
}


void reset_insert_replacement_mode()
{
insert_replacement_mode = REPLACE;
}

Known Deviations: None

Insert Or Replace Graphic Character

Levels: 1-4

Purpose: To place a graphic character in the display at the Active Position.

Format:

implied on receipt of graphic character data

Description: This procedure is called on receipt of graphic character data to place the data in the appropriate position in the display structure. The character code, as well as the values of the Current Rendition, Current Attribute, and the character set indicated by the In Use Table (left side if code <= 7/14, otherwise right side) are stored in the display list.

The Active Position is advanced by one column each time this operation is performed until it reaches the Right Margin, or the last column of the Active Line. If the Active Position is within the Scroll Area, it will advance to the Right Margin. If the Active Position is outside the Scroll Area, it will advance to the last column of the Active Line.

If Auto Wrap mode is off, the Active Position will not advance beyond the Right Margin or last column of the Active Line. Additional graphic characters received will overwrite this position.

If Auto Wrap Mode is on and the Active Position is within the Vertical Scroll Margins, the Active Position will advance from the Right Margin or last column of the Active Line, to the Left Margin of the next line (causing the display to scroll if necessary) when a graphic character is received and the Last Column Flag is set (see Auto Wrap Mode, DEC STD 70-D for details).

If Auto Wrap Mode is on and the Active Position is outside the Vertical Scroll Margins, the Active Position will advance from the last column of the Active Line, to the first column of the next line when a graphic character is received and the Last Column Flag is set (see Auto Wrap Mode, DEC STD 70-D for details). No scrolling will occur.

Notes:

  1. This operation is affected by the setting of Insert/⁠Replacement Mode. When this mode is in the reset state (Replace) the new data will overwrite existing data at the Active Position. When this mode is in the set state (Insert) the contents of the active line will be shifted right one column starting at the Active Position to accommodate the new data. Data shifted past the Right Margin within the Scroll Area, or the last column of the Active Line outside the Scroll Area is lost.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • active_position

Algorithm:

void insert_or_replace_character(parv)
  short int parv[];
{
  column_t x;
  short int line;    /* actual line in logical display */
  short int margin;  /* effective right boundary */
line = (active_position.page * lines_per_page) +
        active_position.line;
if (insert_replacement_mode == INSERT)
  {
  /* determine right boundary for shifting characters */
  if ( (active_position.column <= right_margin) &&
       (active_position.line >= bottom_margin) &&
       (active_position.line <= top_margin)    &&
       (right_margin < end_of_line(line))    )
    margin = right_margin;
  else
    margin = end_of_line(line);
  /* make room for character to be inserted */
  for ( x=margin;
        x > active_position.column;
        x-- )
    strncpy( display[line][x], display[line][x-1],
             sizeof(character_t) );
  }
/* put code in the display, strip 8th bit */
display[line][active_position.column].code = parv[0] & 0x7F;

display[line][active_position.column].rendition =
current_rendition;
display[line][active_position.column].attribute =
current_attribute;

/* write the character set */
if (single_shift == NO_SINGLE_SHIFT)
  {
  if (parv[0] <= 126)
    display[line][active_position.column].character_set =
      in_use_table.gl;
  else
    display[line][active_position.column].character_set =
      in_use_table.gr;
  }
else if (single_shift == SS2)
  display[line][active_position.column].character_set =
    designated_graphic_sets[2];
else if (single_shift == SS3)
  display[line][active_position.column].character_set =
    designated_graphic_sets[3];

/* advance the active position after entering character */
if (active_position.column < margin)
  active_position.column += 1;
else  /* active position is at effective margin */
  if (auto_wrap_mode = WRAP_ON)
    {
    if (last_column_flag)
      {
      carriage_return();
      line_feed();
      last_column_flag = FALSE;
      }
    else
      last_column_flag = TRUE;
    }
}   /* end insert_or_replace_character() */

Known Deviations: None

Insert Character ICH

Levels: 2-4

Purpose: Insert empty characters at the Active Position.

Format:

CSI     Pn      @               default Pn: 1
9/11    Pn      4/0

Description: The ICH control causes empty characters to be inserted at the Active Position. A parameter value of zero or one causes a single empty character to be inserted. A parameter value of n causes n empty characters to be inserted. Data on the Active Line from the Active Column to the Right Margin is shifted forward as in character insertion. Characters shifted beyond the Right Margin are lost.

Notes:

  1. The extent of the display affected by execution of this control is limited to the Active Line within the left and right margins. Data which is shifted beyond the Right Margin is lost.

  2. If the active position is outside the left or right margin, this control is ignored.

  3. The Active Position is not affected by execution of this control.

  4. Execution of this control is not affected by the setting of Insert/Replacement Mode.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]

Algorithm:

void insert_character(parv)
  int parv[MAX_NUM_PARAMETERS];
{
  column_t x;
  short int line;    /* actual line in logical display */
  short int margin;  /* effective right boundary */
  short int n;
/*.......................*/

/* ignore if we're outside the scrolling area */
if ( (active_position.line >= bottom_margin) &&
     (active_position.line <= top_margin)    &&
     (active_position.column >= left_margin) &&
     (active_position.column <= right_margin)  )
  {
  line = (active_position.page * lines_per_page) +
          active_position.line;
  /* determine right boundary for shifting characters */
  if (right_margin < end_of_line(line))
    margin = right_margin;
  else
    margin = end_of_line(line);

  if (parv[0] == 0) n = 1;
  else n = parv[0];
  if ((active_position.column + n) > margin)
    n = margin - active_position.column + 1;

  /* make room for characters to be inserted */
  for ( x=margin;
        x > active_position.column + n;
        x-- )
    strncpy( display[line][x], display[line][x-n],
             sizeof(character_t) );
  for (x=1; x<=n; x++)
    {
    display[line][active_position.column+(x-1)].code =
      EMPTY_CHARACTER;
    }
  }
}

Known Deviations: None

Delete Character DCH

Levels: 1X, 2-4

Purpose: Delete characters at the Active Position.

Format:

CSI     Pn      P               default Pn: 1
9/11    Pn      5/0

Description: The DCH control causes characters to be deleted at the Active Position. A parameter value of zero or one causes a single character to be deleted. A parameter value of n causes n characters to be deleted. Data on the Active Line between the Active Column and Right Margin is shifted left to close up the deleted character positions, and empty characters are inserted at the Right Margin to accommodate the shift.

Notes:

  1. The DCH control is part of the Level 1 Editing Extension. This extension is required in all new Level 1 implementations. It is a required function in Level 2.

  2. The extent of the display affected by execution of this control is limited to the Active Line within the left and right margins.

  3. If the Active Position is outside the left or right margins, this control is ignored.

  4. The Active Position is not affected by execution of this control.

  5. Execution of this control is not affected by the setting of Insert/Replacement Mode.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]

Algorithm:

void delete_character(parv)
  int parv[MAX_NUM_PARAMETERS];
{
  column_t x;
  short int line;    /* actual line in logical display */
  short int margin;  /* effective right boundary */
  short int n;
/*.......................*/

/* ignore if we're outside left or right margin */
if ( (active_position.column >= left_margin) &&
     (active_position.column <= right_margin)  )
  {
  line = (active_position.page * lines_per_page) +
          active_position.line;
  /* determine right boundary for shifting characters */
  if (right_margin < end_of_line(line))
    margin = right_margin;
  else
    margin = end_of_line(line);

  if (parv[0] == 0) n = 1;
  else n = parv[0];
  if ((active_position.column + n) > margin)
    n = margin - active_position.column + 1;

  /* make delete characters */
  for ( x=active_position.column;
        x <= margin-n;
        x++ )
    strncpy( display[line][x], display[line][x+n],
             sizeof(character_t) );
  for (x=1; x<=n; x++)
    {
    display[line][margin-(x-1)].code =
      EMPTY_CHARACTER;
    }
  }  /* end active position within the left and right margins */
} /* end delete_character() */

Known Deviations: None

Insert Line IL

Levels: 1x, 2-4

Purpose: Insert lines of empty characters at the Active Position.

Format:

CSI     Pn      L               default Pn: 1
9/11    Pn      4/12

Description: The IL control causes lines of empty characters to be inserted at the Active Position. A parameter value of zero or one causes a single line to be inserted. A parameter value of n causes n lines to be inserted. Data in the display is scrolled downward to the Bottom Margin from the active line to accommodate the insertion. Only that portion of the display between the top, bottom, left, and right margins is affected. IL is ignored if the Active Position is outside the Scroll Area.

Notes:

  1. The IL control is part of the Level l Editing Extension. This extension is required in all new Level 1 implementations. It is a required function in Level 2.

  2. The Active Position is set to the Left Margin in the active line after execution of this control. The active line does not change.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • line_rendition[MAX_NUM_LINES]
  • active_position

Algorithm:

void insert_line(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  short int n;
/*......................*/
/* ignore if we're outside the scrolling area */
if ( (active_position.line >= bottom_margin) &&
     (active_position.line <= top_margin)    &&
     (active_position.column >= left_margin) &&
     (active_position.column <= right_margin)  )
  {
  if (parv[0] == 0) n = 1;
  else n = parv[0];
  if ((active_position.line + n) > bottom_margin)
    n = (bottom_margin - active_position.line) + 1;
  scroll_down(active_position.line, n);
  active_position.column = left_margin;
  }
}

Known Deviations: None

Delete Line DL

Levels: 1x, 2-4

Purpose: Delete lines at the Active Position.

Format:

CSI     Pn      M               default Pn: 1
9/11    Pn      4/13

Description: The DL control causes lines of characters to be deleted at the Active Position. A parameter value of zero or one causes a single line to be deleted. A parameter value of n causes n lines to be deleted. Data in the display is scrolled upward from the Bottom Margin to the active line to accommodate the deletion. Only that portion of the display between the top, bottom, left, and right margins is affected. DL is ignored if the active position is outside the scroll area.

Notes:

  1. The DL control is part of the Level 1 Editing Extension. This extension is required in all new Level 1 implementations. It is a required function in Level 2.

  2. The Active Position is set to the Left Margin in the active line after execution of this control. The active line does not change.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • line_rendition[MAX_NUM_LINES]
  • active_position

Algorithm:

void delete_line(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  short int n;
/*......................*/
/* ignore if we're outside the scrolling area */
if ( (active_position.line >= bottom_margin) &&
     (active_position.line <= top_margin)    &&
     (active_position.column >= left_margin) &&
     (active_position.column <= right_margin)  )
  {
  if (parv[0] == 0) n = 1;
  else n = parv[0];
  if ((active_position.line + n) > bottom_margin)
    n = (bottom_margin - active_position.line) + 1;
  scroll_up(active_position.line, n);
  active_position.column = left_margin;
  }
}

Known Deviations: None

Insert Column DECIC

Level: 4x (Horizontal Scrolling)

Purpose: Insert columns of empty characters at the Active Position.

Format:

CSI    Pn    '    }          default Pn: 1
9/11   Pn    2/7  7/13

Description: The DECIC control causes Pn columns to be inserted at the active column position. The contents of the display are shifted to the right from the active column to the right margin. The inserted columns are set to blank with normal rendition. Only that portion of the display between the top, bottom, left, and right margins is affected. DECIC is ignored if the active position is outside the Scroll Area.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]

Algorithm:

/* routine insert_column(parv) to be supplied */

Known Deviations: None

Delete Column DECDC

Level: 4x (Horizontal Scrolling)

Purpose: Delete columns at the Active Position

Format:

CSI    Pn    '    ~          default Pn: 1
9/11   Pn    2/7  7/14

Description: The DECDC control causes Pn columns to be deleted at the active column position. The contents of the display are shifted to the left from the right margin to the active column. Columns containing blank characters with normal rendition are shifted into the display from the right margin. Only that portion of the display between the top, bottom, left, and right margins is affected. DECDC is ignored if the active position is outside the Scroll Area.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]

Algorithm:

/* routine delete_column(parv) to be supplied */

Known Deviations: None

Erase Character ECH

Levels: 2-4

Purpose: Erase characters at the Active Position.

Format:

CSI     Pn      X               default Pn: 1
9/11    Pn      5/8

Description: The ECH control causes the character at the Active Position and the next n-1 characters to be erased and their attributes set to normal. A parameter value of zero causes a single character to be erased. No reformatting of data on the line occurs, and the Active Position does not move.

Notes:

  1. The extent of the display affected by execution of this control is limited to the Active Line. If a parameter value is given which is greater than the distance from the Active Position to the end of the Active Line, only character positions up to the end of the Active Line will be erased. This control is not affected by the margins.

  2. Execution of this control is not affected by the setting of Insert/Replacement Mode.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]

Algorithm:

void erase_character(parv)
  short int parv[MAX_NUM_PARAMETERS];
{
  column_t x;
  short int line;  /* actual line in logical display */
  short int n;
/*.........*/
line = active_position.page * lines_per_page +
       active_position.line;
if (parv[0] == 0) n = 1;
else n = parv[0];
if ((active_position.line + n) > end_of_line(line))
  n = (end_of_line(line) - active_position.column) + 1;
for (x=active_position.column;
     x <= active_position.column + (n-1);
     x++)
  {
  display[line][x].code = EMPTY_CHARACTER;
  }
}

Known Deviations: None

Erase In Line EL

Levels: 1-4

Purpose: Erase character positions within the Active Line.

Format:

CSI     Ps      K               default Ps: 0
9/11    Ps      4/11

Description: The EL control causes a set of adjacent character positions in the Active Line to be set to the empty state, that is the empty character (imaged as SPACE), the empty rendition, and the empty character attribute. The set of character positions affected by this control is determined by the parameter value. An omitted parameter or a value of zero (0) cause the control to affect character positions from the Active Column to the end of the Active Line (inclusive). A parameter value of one (1) causes the control to affect character positions from the beginning of the Active Line to the Active Column (inclusive). A parameter value of two (2) causes the control to affect all character positions in the Active Line (inclusive).

Notes:

  1. The line renditon is not affected by execution of this control.

  2. The syntax of the EL control is identical to the Selective Erase in Line (DECSEL) control, except that DECSEL includes a private parameter specifier ? (3/15).

  3. This control is not affected by the margins.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • line_rendition[MAX_NUM_LINES]

Algorithm:

/*
 * erase_in_line
 *   both standard and selective_erase
 */
void erase_in_line(parc, parv, private)
  short int parc;
  short int parv[MAX_NUM_PARAMETERS];
  boolean_t private;
{
  column_t x;
  short int line;  /* actual line in logical display */
  short int n;
/*................*/
if (private) selective_erase_in_line(parc, parv);
else
  {
  line = active_position.page * lines_per_page +
         active_position.line;
  if (parc == 0) parc = 1;
  for (n=0; n<parc; n++)
    {
    switch(parv[n])
      {
      case 0:
        for (x=active_position.column;
             x <= end_of_line(line); x++)
          display[line][x].code = EMPTY_CHARACTER;
        break;
      case 1:
        for (x=1; x<=active_position.column; x++)
          display[line][x].code = EMPTY_CHARACTER;
        break;
      case 2:
        for (x=1; x<=end_of_line(line); x++)
          display[line][x].code = EMPTY_CHARACTER;
        break;
      }
    }
  }
}    /* end erase_in_line() */

Known Deviations: None

Erase In Display ED

Levels: 1-4

Purpose: Erase character positions within the display.

Format:

CSI     Ps      J               default Ps: 0
9/11    Ps      4/10

Description: The ED control causes a set of adjacent character positions (extending across line boundaries) in the display to be set to the empty state. That is the empty character (imaged as SPACE), the empty rendition, and the empty character attribute. The set of character positions affected by this control is determined by the parameter value. An omitted parameter or a value of zero (0) cause the control to affect character positions from the Active Position to the end of the bottom line in the display (inclusive). A parameter value of one (1) causes the control to affect character positions from the beginning of the first line of the display to the Active Position (inclusive). A parameter value of two (2) causes the control to affect all character positions in the display (inclusive).

Notes:

  1. The Line Renditions of all lines completely erased (all character positions in the line set to the erased state, that is, empty characters) as a result of execution of this control are set to single-width.

  2. This control affects the entire display and is not affected by the setting of the scrolling region or the setting of Origin Mode.

  3. The syntax of the ED control is identical to the Selective Erase in Display (DECSED) control, except that DECSED includes a private parameter specifier ? (3/15).

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • line_rendition[MAX_NUM_LINES]

Algorithm:

/*
 * erase_in_display
 *   both standard and selective_erase
 */
void erase_in_display(parc, parv, private)
  short int parc;
  short int parv[MAX_NUM_PARAMETERS];
  boolean_t private;
{
  line_t y;
  column_t x;
  short int base;  /* first line(-1) of current page */
  short int line;  /* actual line in logical display */
  short int n;
/*................*/
if (private) selective_erase_in_display(parc, parv);
else
  {
  base = (active_position.page-1) * lines_per_page;
  line = base + active_position.line;
  if (parc == 0) parc = 1;
  for (n=0; n<parc; n++)
    {
    switch(parv[n])
      {
      case 0:  /* erase to end of display */
        for (x=active_position.column;
             x <= end_of_line(line); x++)
          display[line][x].code = EMPTY_CHARACTER;
        if (active_position.column = 1)
          line_rendition[line] = SINGLE_WIDTH;
        for (y=line+1; y<(base+lines_per_page); y++)
          {
          for (x=1; x<=end_of_line(y); x++)
            {
            display[y][x].code = EMPTY_CHARACTER;
            line_rendition[y] = SINGLE_WIDTH;
            }
          }
        break;
      case 1:  /* erase from beginning of display */
        for (y=1; y<(base+line); y++)
          {
          for (x=1; x<=end_of_line(y); x++)
            {
            display[y][x].code = EMPTY_CHARACTER;
            line_rendition[y] = SINGLE_WIDTH;
            }
          }
        for (x=1; x<=active_position.column; x++)
          display[line][x].code = EMPTY_CHARACTER;
        if (active_position.column = end_of_line(line))
          line_rendition[line] = SINGLE_WIDTH;
        break;
      case 2:  /* erase entire display */
        for (y=1; y<(base+lines_per_page); y++)
          {
          for (x=1; x<=end_of_line(y); x++)
            {
            display[y][x].code = EMPTY_CHARACTER;
            line_rendition[y] = SINGLE_WIDTH;
            }
          }
        break;
      }
    }
  }  /* end not private */
}    /* end erase_in_display() */

Known Deviations: None

Selective Erase In Line DECSEL

Levels: 2x, 3x, 4x (Selective Erase)

Purpose: Change character positions within the Active Line which have the Selectively Erasable attribute to the Space character (2/0).

Format:

CSI     ?       Ps      K       default Ps: 0
9/11    3/15    Ps      4/11

Description: The DECSEL control causes a set of adjacent character positions in the Active Line which have the attribute "Selectively Erasable" to be changed to the Space character (2/0). The character rendition and attributes associated with each position do not change. Characters which have been entered into the display with the Selectively Erasable attribute reset (Not Selectively Erasable), as well as empty character positions, are not affected by this control, and no reformatting of the data will occur.

The set of character positions affected by this control is determined by the parameter value. An omitted parameter or a value of zero (0) cause the control to affect character positions from the Active Column to the end of the Active Line (inclusive). A parameter value of one (1) causes the control to affect character positions from the beginning of the Active Line to the Active Column (inclusive). A parameter value of two (2) causes the control to affect all character positions in the Active Line (inclusive).

Notes:

  1. Use of this control permits efficient "clearing" of parts of the screen while leaving other parts alone, such as in form filling applications. (See Select Character Attribute, DECSCA, for a description of how to invoke the selectively erasable character attribute). This capability is an extension to Level 2 and so is not available in all Level 2 terminals.

  2. This control is only executed if the Level 2 extension Selectively Erasable Characters is supported. In Level 1 operation and in other Level 2 devices it will be ignored.

  3. The Line Rendition is not affected by execution of this control.

  4. The syntax of the DECSEL control is identical to the Erase in Line (EL) control, except that DECSEL includes a private parameter specifier ? (3/15).

  5. This control is not affected by the margins.

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • line_rendition[MAX_NUM_LINES]

Algorithm:

void selective_erase_in_line(parc, parv)
  short int parc;
  short int parv[MAX_NUM_PARAMETERS];
{
  column_t x;
  short int line;  /* actual line in logical display */
  short int n;
/*................*/
line = active_position.page * lines_per_page +
       active_position.line;
if (parc == 0) parc = 1;
for (n=0; n<parc; n++)
  {
  switch(parv[n])
    {
    case 0:
      for (x=active_position.column;
           x <= end_of_line(line); x++)
        {
        if (display[line][x].attribute.selective_erase)
          display[line][x].code = 32;  /* Space */
        }
      break;
    case 1:
      for (x=1; x<=active_position.column; x++)
        {
        if (display[line][x].attribute.selective_erase)
          display[line][x].code = 32;  /* Space */
        }
      break;
    case 2:
      for (x=1; x<=end_of_line(line); x++)
        {
        if (display[line][x].attribute.selective_erase)
          display[line][x].code = 32;  /* Space */
        }
      break;
    }
  }
}    /* end selective erase_in_line() */

Known Deviations: None

Selective Erase In Display DECSED

Levels: 2x, 3x, 4x (Selective Erase)

Purpose: Change character positions within the display which have the Selectively Erasable attribute to the Space character (2/0).

Format:

CSI     ?       Ps      J       default Ps: 0
9/11    3/15    Ps      4/10

Description: The DECSED control causes a set of adjacent character positions in the display which have the attribute "Selectively Erasable" to be changed to the Space character (2/0). The character rendition and attributes associated with each position do not change. Characters which have been entered into the display with the Selectively Erasable attribute reset (Not Selectively Erasable), as well as empty character positions, are not affected by this control, and no reformatting of the data will occur.

The set of character positions affected by this control is determined by the parameter value. An omitted parameter or a value of zero (0) cause the control to affect character positions from the Active Position to the end of the bottom line in the display (inclusive). A parameter value of one (1) causes the control to affect character positions from the beginning of the first line of the display to the Active Position (inclusive). A parameter value of two (2) causes the control to affect all character positions in the display (inclusive).

Notes:

  1. Use of this control permits efficient "clearing" of parts of the display while leaving other parts alone, such as in form filling applications. (See Select Character Attribute, DECSCA, for a description of how to invoke the selectively erasable character attribute).

  2. This control is only executed if the Level 2 extension Selectively Erasable Characters is supported. In Level 1 operation and in other Level 2 devices it will be ignored.

  3. The Line Renditions of all lines are not affected by execution of this control.

  4. This control affects the entire display and is not affected by the setting of the scrolling region or the setting of Origin Mode.

  5. The syntax of the DECSED control is identical to the Erase in Display (ED) control, except that DECSED includes a private parameter specifier ? (3/15).

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]
  • line_rendition[MAX_NUM_LINES]

Algorithm:

void selective_erase_in_display(parc, parv)
  short int parc;
  short int parv[MAX_NUM_PARAMETERS];
{
  line_t y;
  column_t x;
  short int base;  /* first line(-1) of current page */
  short int line;  /* actual line in logical display */
  short int n;
/*................*/
base = (active_position.page-1) * lines_per_page;
line = base + active_position.line;
if (parc == 0) parc = 1;
for (n=0; n<parc; n++)
  {
  switch(parv[n])
    {
    case 0:  /* erase to end of display */
      for (x=active_position.column;
           x <= end_of_line(line); x++)
        {
        if (display[line][x].attribute.selective_erase)
          display[line][x].code = 32;  /* Space */
        }
      if (active_position.column = 1)
        line_rendition[line] = SINGLE_WIDTH;
      for (y=line+1; y<(base+lines_per_page); y++)
        {
        for (x=1; x<=end_of_line(y); x++)
          {
          if (display[y][x].attribute.selective_erase)
            display[y][x].code = 32;  /* Space */
          }
        }
      break;
    case 1:  /* erase from beginning of display */
      for (y=1; y<(base+line); y++)
        {
        for (x=1; x<=end_of_line(y); x++)
          {
          if (display[y][x].attribute.selective_erase)
            display[y][x].code = 32;  /* Space */
          }
        }
      for (x=1; x<=active_position.column; x++)
        {
        if (display[line][x].attribute.selective_erase)
          display[line][x].code = 32;  /* Space */
        }
      if (active_position.column = end_of_line(line))
        line_rendition[line] = SINGLE_WIDTH;
      break;
    case 2:  /* erase entire display */
      for (y=1; y<(base+lines_per_page); y++)
        {
        for (x=1; x<=end_of_line(y); x++)
          {
          if (display[y][x].attribute.selective_erase)
            display[y][x].code = 32;  /* Space */
          }
        }
      break;
    }
  }
}    /* end selective_erase_in_display() */

Known Deviations: None

5.11.1 Character Attributes

Each character cell in the display may also have logical (non-⁠visual) attribute associated with it, which affect its characteristics when processed or retransmitted by the terminal. These attributes can be combined in any manner for each character position independently. The architecture requires that each character attribute and every character attribute combination to have effect individually and independently from every other character attribute and character rendition (see previous section). Character attributes apply to all graphic characters codes (2/1 to 7/14 inclusive, and 10/1 to 15/14 inclusive) as well as to the Space character (2/0).

5.11.1.1 Normal Character Attribute

The Normal character attribute defines the non-visible attributes in the physical display in its "natural" state, that is, where the character behaves with no special non-visible attributes.

5.11.1.2 Selectively Erasable Character Attribute

One logical attribute may be applied to characters as a Level 2 or higher extension. This attribute is referred to as "Selectively Erasable Character". When this extension is provided, the terminal will recognize two forms of the commands Erase_In_Line and Erase_In_Display: one in which all characters in the given extent are erased, regardless of their logical attributes, and another in which all character in the given extent which have been assigned the Selectively Erasable Character attribute are turned into Space characters (2/0). (See the Select Character Attribute, Erase In Line, and Erase In Display control functions for a complete description of this feature).

Select Character Attribute DECSCA

Levels: 2x, 3x, 4x (Selective Erase)

Purpose: Designate the character attribute(s) to be applied to all subsequent characters entered into the display.

Format:

CSI     Ps ; ... ; Ps   "   q       default Ps: 0
9/11    Ps ; ... ; Ps   2/2 7/1

Description: The DECSCA control selects the character attribute (logical attribute) to be applied to all subsequent characters entered into the display. The parameter values indicate the combination of attributes to be selected as indicated in the following table:

ParameterRendition
0Attributes off
1Not Selectively Erasable (attribute on)
2Selectively Erasable

Notes:

  1. Character attribute parameter values are assigned in pairs. The lower (odd) value sets the attribute to the on state and the higher (even) value resets the attribute to the off state (same as normal or when all attributes are turned off (value 0).

  2. All other parameter values will be ignored.

  3. Attributes may be selected in any combination, and will be rendered appropriately. Selecting additional attributes does not affect the setting of previously selected attributes (newly selected attributes will be combined with previously selected attributes) unless all attributes are turned off (parameter value zero (0)).

  4. In no way does the selection of attributes affect the rendition (SGR) or attributes (DECSCA) of characters already entered into the display.

  5. This control is ignored unless the Level 2 or higher extension for Selectively Erasable Characters is supported. The Selectively Erasable Character attribute affects the execution of the controls Selective Erase In Line (DECSEL) and Selective Erase In Display (DECSED).

State Affected:

  • display[MAX_NUM_LINES][MAX_NUM_COLUMNS]

Algorithm:

void select_character_attribute(parc, parv)
  short int parc;
  short int parv[MAX_NUM_PARAMETERS];
{
  short int n;
/*................*/
if (conformance_level >= 2)
  {
  if (parc == 0) parc = 1;
  for (n=0; n<parc; n++)
    {
    switch(parv[n])
      {
      case 0:
        current_attribute.selective_erase = TRUE;
        break;
      case 1:
        current_attribute.selective_erase = FALSE;
        break;
      case 2:
        current_attribute.selective_erase = TRUE;
        break;
      }
    }
  }
} /* end select_character_attribute() */

Known Deviations: None

5.12 OLTP Features

This subsection describes features defined at Level 4 to improve performance for On Line Transaction Processing (OLTP). These include Rectangular Area Operations, Data Integrity Checking, and Text Macros.

5.12.1 Rectangular Area Operations

This subsection describes the following functions used to edit data, or control editing of rectangular areas in the Logical Display.

Copy Rectangular Area DECCRA

Level: 4

Purpose: To copy a rectangular array of characters from one part of a logical display page to another.

Format:

CSI   Pts; Pls; Pbs; Prs; Pps; Ptd; Pld; Ppd  $    v
9/11  Pts; Pls; Pbs; Prs; Pps; Ptd; Pld; Ppd  2/4  7/6

Description: When this control is received, the terminal copies the character values and attributes in the specified rectangular area of character positions defined by Pts, Pls, Pbs, and Prs on the specified page Pps, to the area specified by the coordinate Ptd, Pld on the specified page Ppd. Pts, Pbs, and Ptd are line numbers. Pls, Prs, and Pld are column numbers. Pps and Ppd are page numbers. The character positions (Pts, Pls) and (Pbs, Prs) define the rectangular area that is to be copied from page Pps.

The coordinates of the rectangular area are affected by the setting of Origin Mode. This control is not otherwise affected by the margins.

If the rectangular area contains both single and double width lines, the area copied FROM may not appear rectangular on the display. For example if Pl=5 and Pr=10, then characters 5 through 10 from all lines within the rectangular area will be copied whether they are single width or double width characters. Text copied to the destination area take on the line attributes of that area.

Pts must be less or equal to Pbs, and Pls must be less than or equal to Prs, otherwise the entire control function is ignored. Default values are Pts = 1, Pls = 1, Pbs = last-line-of-page, Prs = last-column-of-page, Pps = 1, Ptd = 1, Pld = 1, and Ppd = 1. If a value exceeds the width or height of the active page, it is treated as the width or height of the active page. If a page value exceeds the number of pages available in the current Page Configuration, it is treated as the last page in the current configuration.

If the destination rectangle specified is partially off of the Page, clipping of information will occur; only information which will appear in valid character positions in the page will be copied.

The Active Position does not change.

Fill Rectangular Area DECFRA

Level: 4

Purpose: To fill a group of adjacent character positions defined by a rectangular area.

Format:

CSI   Pch ; Pt ; Pl ; Pb ; Pr  $    x
9/11  Pch ; Pt ; Pl ; Pb ; Pr  2/4  7/8

Description: When this control is received, the terminal fills the rectangular area of character positions defined by Pt, Pl, Pb, and Pr, replacing both the character and the rendition present in those character positions with the character defined by the decimal value of Pch and the current renditions set through the SGR command.

The Pch parameter may be a decimal value from 32 to 126, or from 160 to 255. The decimal value refers to the character in the current GL and GR "in-use" character table, which is used to fill the specified rectangular area. If the value of Pch is not in the above range, the command is ignored.

Pt and Pb are line numbers, and Pl and Pr are column numbers. The character positions (Pt, Pl) and (Pb, Pr) define the rectangular area.

The coordinates of the rectangular area are affected by the setting of Origin Mode. This control is not otherwise affected by the margins.

Pt must be less or equal to Pb, and Pl must be less than or equal to Pr, otherwise the entire control function is ignored. Default values are Pch = 32, Pt = 1, Pb = last-line-of-page, Pl = 1, and Pr = last-column-of-page. If a value exceeds the width or height of the active page, it is treated as the width or height of the active page.

Notes on DECFRA:

  1. If the rectangular area contains both single and double width lines, the area affected may not appear rectangular on the display. For example if Pl=5 and Pr=10, then all lines within the rectangular area, whether single or double width, will have character positions 5 through 10 affected.

  2. DECFRA does not change any line attributes. Double height or double width characters will be filled into positions on lines containing those attributes. The Active Position does not move.

Erase Rectangular Area DECERA

Level: 4

Purpose: To erase a group of adjacent characters defined by a rectangular area.

Format:

CSI   Pt ; Pl ; Pb ; Pr  $    z
9/11  Pt ; Pl ; Pb ; Pr  2/4  7/10

Description: When this control is received, the terminal erases the rectangular area of character positions defined by Pt, Pl, Pb, and Pr, clearing all character attributes. Line attributes are not changed. When an area is erased, all characters are replaced with the Space character (2/0). Any unoccupied character positions remain unoccupied. The Active Position does not move.

Pt and Pb are line numbers, and Pl and Pr are column numbers. The character positions (Pt, Pl) and (Pb, Pr) define the rectangular area.

The coordinates of the rectangular area are affected by the setting of Origin Mode. This control is not otherwise affected by the margins.

Pt must be less or equal to Pb, and Pl must be less than or equal to Pr, otherwise the entire control function is ignored. Default values are Pt = 1, Pb = last-line-of-page, Pl = 1, and Pr = last-⁠column-of-page. If a value exceeds the width or height of the active page, it is treated as the width or height of the active page.

Notes on DECERA:

  1. If the rectangular area contains both single and double width lines, the area affected may not appear rectangular on the display. For example if Pl=5 and Pr=10, then all lines within the rectangular area, whether single or double width, will have character positions 5 through 10 affected.

Selective Erase Rectangular Area DECSERA

Level: 4

Purpose: To erase a group of unprotected characters defined by a rectangular area.

Format:

CSI   Pt ; Pl ; Pb ; Pr  $    {
9/11  Pt ; Pl ; Pb ; Pr  2/4  7/11

Description: This control function erases unprotected characters within the rectangular area of character positions defined by Pt, Pl, Pb, and Pr. Unprotected characters are those with the "Selective Erase" character attribute (see DECSCA). When a character is erased, it is replaced with the Space character (2/0). Unoccupied character positions are not affected. This sequence does not change or clear any video character attributes (SGR or DECSCA), video line attributes, or the selection attribute. The active position does not move.

Pt and Pb are line numbers, and Pl and Pr are column numbers. The character positions (Pt, Pl) and (Pb, Pr) define the rectangular area.

The coordinates of the rectangular area are affected by the setting of Origin Mode. This control is not otherwise affected by the margins.

Pt must be less or equal to Pb, and Pl must be less than or equal to Pr, otherwise the entire control function is ignored. Default values are Pt = 1, Pb = last-line-of-page, Pl = 1, and Pr = last-⁠column-of-page. If a value exceeds the width or height of the active page, it is treated as the width or height of the active page.

Notes on DECSERA:

  1. If the rectangular area contains both single and double width lines, the area affected may not appear rectangular on the display. For example if Pl=5 and Pr=10, then all lines within the rectangular area, whether single or double width, will have character positions 5 through 10 affected.

Change Attributes Rectangular Area DECCARA

Level: 4

Purpose: To change the character rendition of a group of adjacent characters without having to re-write them.

Format:

CSI   Pt ; Pl ; Pb ; Pr ; Ps1 ; Ps2...Psn  $    r
9/11  Pt ; Pl ; Pb ; Pr ; Ps1 ; Ps2...Psn  2/4  7/2

Description: This sequence changes the video attributes (bold, blink, underline, and reverse) for all of the character positions in a rectangular area without altering any characters in those positions. The active position does not move.

The area of the page which is affected is indicated by the first 4 parameters. Pt and Pb are line numbers; Pl and Pr are column numbers. The character positions (Pt, Pl) and (Pb, Pr) define the top-left and bottom-right corners of the rectangular area. Pt must be less than or equal to Pb, and Pl must be less than or equal to Pr. Default values are Pt = 1, Pb = last-line-of-page, Pl = 1, and Pr = last-column-of-page. If a value exceeds the width or height of the active page, it is treated as the width or height of the active page.

The coordinates of the rectangular area are affected by the current setting of Origin Mode. This control is not otherwise affected by the margins.

The character positions affected depend on the current setting of DECSACE (STREAM or RECTANGLE). See DECSACE for details.

The video attribute(s) that the character positions are set to is indicated by one or more subsequent selective parameters. These parameters correspond to the parameters of the Set Graphic Rendition control function (SGR):

ParameterParameter Meaning
0Attributes off (normal intensity, positive image, not underlined, not blinking)
1Bold or increase intensity
4Underscore
5Blink
7Negative (reverse) image
22Normal intensity
24Not underlined
25Not blinking
27Positive image

All other parameter values shall be ignored unless they are part of a well defined extension to the architecture (such as Color Text). When multiple parameters are used, they are cumulative, as if several DECCARA control functions were received and executed in sequence.

The default for the video attribute parameters, if no valid subsequent parameter is received, is 0, which will clear all video attributes in the specified area. This command does not change the current graphic rendition.

Notes on DECCARA:

  1. If the rectangular area contains both single and double width lines, the area affected may not appear rectangular on the display. For example if Pl=5 and Pr=10, then all lines within the rectangular area, whether single or double width, will have character positions 5 through 10 affected.

Reverse Attributes Rectangular Area DECRARA

Level: 4

Purpose: To reverse character attributes of a group of adjacent characters without having to re-write them.

Format:

CSI   Pt ; Pl ; Pb ; Pr ; Ps1 ; Ps2...Psn  $    t
9/11  Pt ; Pl ; Pb ; Pr ; Ps1 ; Ps2...Psn  2/4  7/4

Description: This sequence reverses one or more video attributes (bold, blink, underline, reverse) for all of the character positions in a rectangular area without altering any characters in those positions. The active position does not move. To reverse the attribute bit within the specified range means to set the specified attribute bits if it was not previously set, and reset the bit(s) if it was already set.

The area of the page which is affected is indicated by the first 4 parameters. Pt and Pb are line numbers; Pl and Pr are column numbers. The character positions (Pt, Pl) and (Pb, Pr) define the top-left and bottom-right corners of the rectangular area.

The coordinates of the rectangular area are affected by the setting of Origin Mode. This control is not otherwise affected by the margins.

The character positions affected depend on the current setting of DECSACE (STREAM or RECTANGLE). See DECSACE for more details.

Pt must be less or equal to Pb, and Pl must be less than or equal to Pr, otherwise the entire control function is ignored. Default values are Pt = 1, Pb = last-line-of-page, Pl = 1, and Pr = last-⁠column-of-page. If a value exceeds the width or height of the active page, it is treated as the width or height of the active page.

The video attribute(s) to be reversed are in the affected area are indicated by one or more subsequent parameters. These parameters are similar to the parameters of the Set Graphic Rendition control function (SGR):

ParameterParameter Meaning
0Reverse all attributes
1Reverse bold attribute
4Reverse underscore attribute
5Reverse blinking attribute
7Reverse negative (reverse) image attribute

All other parameter values shall be ignored unless they are part of a well defined extension to the architecture. Note if the Color Text Extension is present, the color text SGR values are ignored since the "reverse" of a color is not defined by the extension.

When multiple parameters are used, they are cumulative, as if several DECRARA control functions were received and executed in sequence.

There is no default for the video attribute parameters, if no valid subsequent parameter is received, the command is ignored.

This sequence does not change the current graphic rendition (see SGR).

Notes on DECRARA:

  1. If the rectangular area contains both single and double width lines, the area affected may not appear rectangular on the display. For example if Pl=5 and Pr=10, then all lines within the rectangular area, whether single or double width, will have character positions 5 through 10 affected.

Select Attribute Change Extent DECSACE

Level: 4

Purpose: To specify what character positions are affected by DECCARA and DECRARA control functions (STREAM or RECTANGLE)

Format:

CSI   Ps  *     x
9/11  Ps  2/10  7/8
  • Ps = 0 stream of character positions are affected (default)
  • Ps = 1 stream of character positions are affected
  • Ps = 2 rectangular area of character positions are affected

Description: This control function is used to specify what character positions are affected by the DECCARA and DECRARA control functions.

When Ps = 0 or 1, DECCARA and DECRARA affects the stream of character positions beginning with the first character position specified in the command, and ending with the second character position specified. The following diagram shows an example of these character positions. The two asterisks represent the character positions specified in the DECCARA or DECRARA control function. The "U"'s represent unoccupied character positions. These unoccupied positions are not affected by DECCARA or DECRARA when in this mode.

+-----------------+
|                 |
|  *##############|
|########UUUUUUUUU|      Ps = 0
|#################|
|###########*     |
|                 |
+-----------------+

When Ps = 2 DECCARA and DECRARA affects all character positions within a rectangular area, the top-left and bottom right corners of which are specified in the control function. The following diagram shows an example of these character positions. The two asterisks represent the character positions specified in the DECCARA or DECRARA control function. The "U"'s represent unoccupied character positions. When DECCARA or DECRARA is executed, these character positions are changed to blanks and are affected.

+-----------------+
|                 |
|  *#########     |
|  ##########UUUUU|      Ps = 2
|  ##########     |
|  #########*     |
|                 |
+-----------------+

In both cases the specified character positions (marked by asterisks) are also affected.

5.12.2 Data Integrity

The data integrity features described here are application functions intended to improve the reliability of OLTP applications. They are not a substitute for error free communications as might be provided by an error correcting protocol.

Request Checksum Of Rectangular Area DECRQCRA

Level: 4

Purpose: To cause the terminal to compute and report the checksum of a rectangular area, allowing applications to insure it has not been changed.

Format:

CSI   Pid ; Pp ; Pt ; Pl ; Pb ; Pr  *     y
9/11  Pid ; Pp ; Pt ; Pl ; Pb ; Pr  2/10  7/9

Description: Upon receipt of a DECRQCRA by the device, a checksum of the indicated rectangular area of the indicated page will be generated and reported to the host in a Checksum Report (DECCKSR).

Pid is an arbitrary numeric label provided by the application to identify the checksum request. It will be provided in the DECCKSR response from the device. This label serves to differentiate between multiple checksum reports if necessary.

Pp is the page number where the rectangular area of interest is located. If Pp is 0 or omitted, subsequent parameters are ignored and a checksum for all page memory will be reported. If Pp is higher than the total number of pages available in the device, the highest numbered page is used.

The final four parameters indicate the top, left (Pt, Pl) and bottom, right (Pb, Pr) coordintate of the rectangular area on page Pp of which the checksum is to be calculated. The coordinates of the rectangular area are affected by the setting of Origin Mode (DECOM). Pt must be less than or equal to Pb, and Pl must be less than or equal to Pr or the sequence is ignored.

Default values are: Pt = 1; Pb = last-line-of-page; Pl = 1; and Pr = last-column-of-page. If the final four parameters are unspecified, a checksum of page Pp is generated.

Memory Checksum Device Status Report DSR

Level: 4

Purpose: To request a checksum of the current text macro definitions, allowing the host to insure they have not been changed.

Format:

CSI   ?     6    3   ; Pid  n
9/11  3/15  3/6  3/3 ; Pid  6/14

Description: This request causes a Checksum Report (DECCKSR) to be issued reporting the checksum of current text macro definitions.

Pid is an optional numeric parameter which provides a label to identify the checksum request. It will be provided in the DECCKSR response from the terminal. This label serves to differentiate between multiple checksum reports if necessary.

Checksum Report DECCKSR

Level: 4

Purpose: To report a requested checksum.

Format:

DCS  Pn  !    ~     D...D  ST
9/0  Pn  3/2  7/14  D...D  9/12

Description: DECCKSR is issued in response to a Request Checksum of Rectangular Area (DECRQCRA) or a Device Status Report (DSR) with a parameter value of ?63 indicating a request for a checksum of the macro definitions.

The numeric parameter of the DECCKSR control string is a numeric label for the checksum report specified in the DECRQCRA or DSR control function. This label serves to differentiate between multiple checksum reports if necessary.

The data of the control string consists of four hexadecimal digits (3/0 through 3/9 and 4/1 through 4/6) indicating the checksum.

5.12.3 Macros

Define Macro DECDMAC

Level: 4

Purpose: To define a string of characters as a text macro, allowing the host to shorten subsequent transmissions.

Format:

DCS  Pid ; Pdt ; Pen  !    z     D...D  ST
9/0  Pid ; Pdt ; Pen  2/1  7/10  D...D  9/12

Where

  • Pid is the macro ID number: 0-63.
  • Pdt is the delete control:
    • 0 delete only a macro with the same ID number (if one exists) before defining this macro.
    • 1 delete all macro definitions before defining this macro.
  • Pen is the macro encoding:
    • 0 text (ASCII) encoding.
    • 1 hex pair encoding.

Description: This control string defines a macro consisting of ANSI commands. Once defined, a macro can be invoked using DECINVM to cause the macro's definition to be processed by the terminal as if received from the host.

Omitted parameters are defaulted to zero. Pid must be a number between 0 and 63; Pdt 0 or 1; and Pen 0 or 1; otherwise the control will be ignored.

The data of the control string is the series of text and ANSI commands which are performed when the macro is invoked.

Macros can invoke other macros with up to 16 levels of nesting, but cannot invoke themselves recursively. Macro definitions cannot be nested. That is, a DECDMAC cannot be included as part of a macro definition.

When text encoding is used (Pen = 0), the macro consists of the graphic characters appearing in the control string. Only characters from 2/0 through 7/14 and 10/00 through 15/15 may be included in a macro using this encoding method.

When hex pair encoding is used (Pen = 1), each pair of characters in the definition represents the hex value of a single ASCII character which will be stored in the definition of the macro. If a non-hex pair is encountered that is not a valid repeat sequence, the entire macro definition is ignored.

A Repeat Introducer (!) is defined to allow a string of hex pairs to be repeated in the definition any number of times. Repeat sequences are imbedded within the text of the macro definition. If a non-hex character is encountered in the repeat string, the entire macro definition is ignored.

The format is:

! Pn ; D...D ;

Where

  • ! is the repeat introducer
  • Pn is a numeric parameter which specifies the number of times to repeat the sequence. If Pn is not specified, the sequence is inserted into the definition once.
  • D...D is the sequence to repeat within the definition, Pn times.
  • ; A semicolon separates the repeat count from the sequence of hex pairs. Another semicolon terminates the sequence.

If any non parameter characters are encountered before the first semicolon, the entire macro definition is ignored. If a string terminator is encountered before the final semicolon, the repeat string is terminated normally.

6k bytes of RAM is available for storage of macro definitions. Any macro definitions which cannot fit in the remaining macro storage space are ignored.

All macro definitions are cleared on receipt of a Reset to Initial State (RIS) or Secure Reset (DECSR). Soft Terminal Reset (DECSTR) has no effect on stored macro definitions.

Note that characters from 0/8 through 0/13 can be included to format the device control string, but are not part of the macro definition.

Invoke Macro DECINVM

Level: 4

Purpose: To invoke a previously defined macro definition.

Format:

CSI   Pid  *     z
9/11  Pid  2/10  7/10

Description: Causes the specified macro to be invoked. The macro must have been previously defined using DECDMAC. The terminal substitutes the DECINVM sequence with the contents of the macro definition, and executes the substituted text.

Pid is the macro id number. If a macro is not found with the specified id, the command is ignored.

The current state of the machine is not saved or restored when macros are invoked. Any functions executed by a macro invocation are still in effect when the macro invocation finishes.

If the terminal is in Printer Controller mode, the macro is not expanded by the terminal. The command to invoke the macro is passed on to the printer, to be expanded by the printer's text macro facility.

Macro Space Report DECMSR

Level: 4

Purpose: To report the space remaining for macro definitions in response to DSR request.

Format:

CSI   Pn  *     {
9/11  Pn  2/10  7/11

Description: DECMSR is reported in response to a Device Status Report (DSR) with a private selectable parameter ?62, specifying a request to report the available space for macro definitions.

The numeric parameter specifies the number of bytes available for macro definitions divided by 16 (rounded down).

5.13 Saving And Restoring Terminal State

5.13.1 Cursor Save Buffer

A conforming device shall provide a means of saving and restoring on command the value of the Active Position, as well as certain of the terminal states. The state which must be saved in Level 1 operation includes the Current Rendition value (determined by the most recent occurrence of Select_Graphic_Rendition), the current value of Origin Mode, the character sets designated to G0, G1, G2, and G3, and the character set most recently invoked into the left hand side (GL) of the In Use Table.

In Level 2 operation, all of this state must also be saved, as well as the character set most recently invoked into the right hand side (GR) of the In Use Table. If the Level 2 extension Selectively Erasable Characters is supported, the Current Attribute value (determined by the most recent occurrence of Select_Character_Attribute) must be saved. If the ANSI Color Text Extension is supported, the current foreground and background text writing colors are saved as part of the Current Rendition.

Level 3 and 4 require the same information as Level 2.

Save Cursor DECSC

Levels: 1-4

Purpose: Saves the Active Position and other selective state information.

Format:

ESC     7
1/11    3/7

Description: In Level 1 operation, the DECSC control provides a means of storing the values of the Active Position, the Current Rendition, Origin Mode, the currently designated G0, G1, G2, and G3 sets, and the currently invoked GL set.

In Level 2 or higher it also stores the currently invoked GR set. The Current Attribute value is also saved if the Level 2 extension for Selectively Erasable Characters is supported. These values can later be restored using the DECRC control.

Notes:

  1. Only one level of storage is provided by this control. Each additional execution of this control will cause previously stored values to be lost.

  2. The values of the specified state information (see above) are not affected by the execution of this control.

  3. On initialization or reset the values of the save buffer are cleared to the following state:

    position.line = 1;
    position.column = 1;
    position.page = 1;
    rendition.bold = FALSE;
    rendition.underscore = FALSE;
    rendition.blink = FALSE;
    rendition.reverse = FALSE;
    attribute.selective_erase = FALSE;
    origin_mode = ABSOLUTE;
    left = in_use_table.gl;
    right = in_use_table.gr
    g0 = designated_graphic_sets[0];
    g1 = designated_graphic_sets[1];
    g2 = designated_graphic_sets[2];
    g3 = designated_graphic_sets[3];
  4. Execution of Soft Terminal Reset (DECSTR) also causes the Save Buffer to be set to the default values as given above.

State Affected:

  • save_buffer_t cursor_save_buffer;

Algorithm:

void save_cursor()
{
cursor_save_buffer.position.line =
            active_position.line;
cursor_save_buffer.position.column =
            active_position.column;
cursor_save_buffer.position.page =
            active_position.page;
cursor_save_buffer.rendition.bold =
           current_rendition.bold;
cursor_save_buffer.rendition.underscore =
           current_rendition.underscore;
cursor_save_buffer.rendition.blink =
           current_rendition.blink;
cursor_save_buffer.rendition.reverse =
           current_rendition.reverse;
cursor_save_buffer.origin_mode = origin_mode;
cursor_save_buffer.left = in_use_table.gl;
cursor_save_buffer.g0 = designated_graphic_sets[0];
cursor_save_buffer.g1 = designated_graphic_sets[1];
cursor_save_buffer.g2 = designated_graphic_sets[2];
cursor_save_buffer.g3 = designated_graphic_sets[3];
if (conformance_level >= LEVEL_2)
  {
  cursor_save_buffer.right = in_use_table.gr;
  cursor_save_buffer.attribute.selective_erase =
                     current_attribute.selective_erase;
  }
} /* end save_cursor */

Known Deviations: None

Restore Cursor DECRC

Levels: 1-4

Purpose: Restores the previously saved values of the Active Position and other selective state information.

Format:

ESC     8
1/11    3/8

Description: In Level 1 operation, the DECRC control provides a means of restoring the values of the Active Position, the Current Rendition, Origin Mode, the currently designated G0, G1, G2, and G3 sets, and the currently invoked GL set.

In Level 2 or higher it also restores the currently invoked GR set. The Current Attribute value is also saved if the Level 2 extension for Selectively Erasable Characters is supported. These values are the ones which were previously stored using the Save Cursor (DECSC) control function.

Notes:

  1. The values of the specified state information (see above) at the time this control is received by the terminal are lost.

  2. The values stored in the Cursor Save Buffer are not affected by execution of this control.

  3. If the restored cursor position lies outside of the scrolling region, and the restored value of Origin Mode is set, the Active Position will be moved to the closest position within the scrolling region. That is, if the restored cursor position is above the Top Margin, the Active Position will be set to the Top Margin, and if the restored position is below the Bottom Margin, the Active Position will be set to the Bottom Margin. In either case, the Active Column will not change, but will remain as the stored column value. For example: the Active Position is at line 5, column 5 when the cursor is saved, and Origin Mode is set; the scrolling region is subsequently changed to 10,15; when the cursor is restored, the Active Position will be moved to line 10, column 5, to insure that it will lie inside the scrolling region. This reason for this recovery is to guarantee that the Active Position will always be within the bounds of the scrolling region, and will never have a negative value.

State Affected:

  • active_position
  • current_rendition
  • origin_mode
  • in_use_table
  • designated_graphic_sets[4]
  • current_attribute

Algorithm:

void restore_cursor()
{
  short int base;  /* first line(-1) of page */
if (cursor_save_buffer.position.page > number_of_pages)
  active_position.page = number_of_pages;
else active_position.page = cursor_save_buffer.position.page;
base = (active_position.page-1) * lines_per_page;
if (cursor_save_buffer.position.column >
    end_of_line(active_position.line + base))
  active_position.column = end_of_line(active_position.line +
base);
else
  active_position.column = cursor_save_buffer.position.column;
active_position.line = cursor_save_buffer.position.line;

current_rendition.bold =
  cursor_save_buffer.rendition.bold;
current_rendition.underscore =
  cursor_save_buffer.rendition.underscore;
current_rendition.blink =
  cursor_save_buffer.rendition.blink;
current_rendition.reverse =
  cursor_save_buffer.rendition.reverse;

origin_mode = cursor_save_buffer.origin_mode;
if (origin_mode == DISPLACED)
  {
  if (active_position.line < top_margin)
    active_position.line = top_margin;
  if (active_position.line > bottom_margin)
    active_position.line = bottom_margin;
  if (active_position.column < left_margin)
    active_position.column = left_margin;
  if (active_position.column > right_margin)
    active_position.column = right_margin;
  }

in_use_table.gl = cursor_save_buffer.left;
designated_graphic_sets[0] = cursor_save_buffer.g0;
designated_graphic_sets[1] = cursor_save_buffer.g1;
designated_graphic_sets[2] = cursor_save_buffer.g2;
designated_graphic_sets[3] = cursor_save_buffer.g3;

if (conformance_level >= LEVEL_2)
  {
  in_use_table.gr = cursor_save_buffer.right;
  if (level_2_extensions[SELECTIVE_ERASE]==TRUE)
    current_attribute.selective_erase =
      cursor_save_buffer.attribute.selective_erase;
  }
}

Known Deviations:

In the VT100, VT101, VT102, VT125, VT131, and VT132, if the restored cursor position lies outside of the scrolling region, and the restored value of Origin Mode is set, the Active Position will not be moved into the scrolling region, and an illegal (e.g., negative) cursor position value may result.

5.13.2 Terminal State Interrogation

Terminal State Interrogation (TSI) allows a host computer to query most of the settable state in the terminal. Terminal state is divided into three general catagories based on the ANSI syntax used to control it: (1) modes controlled by set__mode/⁠reset__mode; (2) selections and settings such as current graphic rendition, and scroll margins. (3) presentation state such as tab stops and character sets. The terminal provides control functions to query state in each of these catagories, as well as a compact report that allows most settable state to be saved and later restored in one operation.

All TSI controls operate at Levels 2, 3 and 4. Level 3 defines TSI as an implicit extension at Level 2. The following control functions are provided to support Terminal State Interrogation.

Request Mode DECRQM

Levels: 2x (TSI), 3-4

Purpose: To request the state of modes controlled by Set Mode/⁠Reset Mode sequences.

Format:

CSI         Ps  $    p      (ANSI modes)
CSI   ?     Ps  $    p      (DEC private modes)
9/11  3/15  Ps  2/4  7/0

Description: This sequence takes one selective parameter specifying a single selectable mode controllable using the Set Mode and Reset Mode sequences. The terminal responds with a Report Mode control sequence (DECRPM) which specifies the state of the mode as follows: (0) Unknown (mode is not recognized by terminal); (1) Set; (2) Reset; (3) Set and cannot be changed; or (4) Reset and cannot be changed.

All ANSI standard modes defined in X3.64-1979 are reported as either Set or Reset. DEC Private modes that cannot be set or reset from the host will report as unknown [Reason: the list is long and changes frequently. Since DEC defines these modes, applications can infer how to handle unknown modes as needed].

Report Mode DECRPM

Levels: 2x (TSI), 3-4

Purpose: To report the state of modes controlled by Set Mode/⁠Reset Mode sequences (terminal to host).

Format:

CSI         Ps1 ; Ps2  $    y      (ANSI modes)
CSI   ?     Ps1 ; Ps2  $    y      (DEC private modes)
9/11  3/15  Ps1 ; Ps2  2/4  7/9

Description: This sequence is returned to the host upon receipt of a valid DECRQM control sequence. This sequence reports the state of a particular selectable mode to the host. The first selective parameter (Ps1) is the selectable mode number (the question mark ("?") must be added for DEC private selectable modes), that was requested from the DECRQM sequence. The second selective parameter (Ps2) indicates the state of that mode:

Ps2State of mode
0UNKNOWN (mode not recognized by terminal).
1Mode is in SET state
2Mode is in RESET state
3Mode is in SET state, and cannot change
4Mode is in RESET state, and cannot change

Request Selection Or Setting DECRQSS

Levels: 2x (TSI), 3-4

Purpose: To request the state of a selection or setting which is not encoded as a Set Mode/Reset Mode sequence.

Format:

DCS  $    q    D...D  ST
9/0  2/4  7/1  D...D  9/12

Description: Request Selection or Setting is sent to the terminal to determine the selection or setting of a single device feature, such as the current Graphic Rendition (SGR). The data of the device control string for DECRQSS contains the identifying intermediate and final characters of the control sequence used to make the selection. For example, if the command is to request the state of SGR, the data would consist of a single character 'm', which is the final character (no intermediates) in the control sequence for SGR. The terminal responds with a Report Selection or Setting (DECRPSS) sequence.

Only one setting or selection may be queried per request.

Report Selection Or Setting DECRPSS

Levels: 2x (TSI), 3-4

Purpose: To report the state of a selection or setting which is not encoded as a Set Mode/Reset Mode sequence (terminal to host).

Format:

DCS  Ps  $    r    D...D  ST
9/0  Ps  2/4  7/2  D...D  9/12

Description: The Report Selection or Setting device control string is issued from the terminal in response to a Request Selection or Setting command. The value of Ps indicates whether the Request was successful:

Psmeaning
0UNKNOWN selection or setting, request unsuccessful
1request successful, data contains selection information

The data returned by the DECRPSS control string is the entire control function that the host would send to the terminal to select or set the parameter being inquired, based on the current setting or selection of that parameter, with the single exception of the leading Control Sequence Introducer character (9/11, or 1/11 5/11 in 7 bits).

The returned control function will contain no omitted parameters, even if the inquired value is the default value. In the case where there is no default value for the inquired parameter, the returned control function will be constructed so as to overwrite the existing setting or selection, if and when that information is returned to the device.

For example, if the current Graphic Rendition is blinking, and reversed, the data would consist of the characters '0;5;7m', which is the parameter string and final character necessary to change the graphic rendition to that state.

Note that the coding of the DECRPSS control string which indicates UNKNOWN, is always coded as follows:

DCS 0 $ r ST

Request Presentation State Report DECRQPSR

Levels: 2x (TSI), 3-4

Purpose: To request presentation state (cursor information and tab stops).

Format:

CSI  Ps   $    w
9/11  Ps  2/4  7/7

Description: DECRQPSR causes the terminal to respond with a Presentation State Report (DECPSR). The control sequence takes one selective parameter which specifies the type of Presentation State Report to be returned.

PsType of DECPSR
0ignored, no report sent
1Cursor Information Report (DECCIR)
2Tabulation Stop Report (DECTABSR)

Presentation State Report DECPSR

Levels: 2x (TSI), 3-4

Purpose: To report the presentation state (cursor information and tab stops, terminal to host).

Format:

DCS  Ps  $    u    D...D  ST
9/0  Ps  2/4  7/5  D...D  9/12

Description: The Presentation State Report is a device control string containing data which represents the settings of presentation attributes in the terminal. A Presentation State Report is sent in response to a Request Presentation State Report control sequence (DECRQPSR).

The type of Presenation State Report is specified by the value of Ps:

PsType of DECPSR
0illegal
1Cursor Information Report (DECCIR)
2Tabulation Stop Report (DECTABSR)

Cursor Information Report DECCIR

Levels: 2x (TSI), 3-4

Purpose: To report the presentation state cursor information

Format:

DCS  1    $    u    D...D  ST
9/0  3/1  2/4  7/5  D...D  9/12

Description: The data of a device control string for a Cursor Information Report consists of a string of parameters containing the information saved through a Save Cursor (DECSC) command, according to the following format:

Pr ; Pc ; Pp ; Srend ; Satt ; Sflag ; Pgl ; Pgr ; Scss ; Sdesig

where:

  • Pr, PcThe cursor position (example: 24;132)

  • PpThe current page (example: 3)
    Note that in a single page configuration, the Pp parameter would be 1.

  • SrendOne or more bytes containing the encoded Graphic Renditions that must be saved, according to the following bit-encoded format:

    bit 8:always reset (0)
    bit 7:always set (1)
    bit 6:extension indicator: if this bit is set (1), another byte of rendition information follows (always reset on VT420).
    bit 5:always reset (0)
    bit 4:reverse video rendition
    bit 3:blink rendition
    bit 2:underline rendition
    bit 1:bold rendition

    For the actual rendition bits (1 through 5, above) if the bit is set (1), it indicates that the rendition has been selected. Example: if bold and underline are set the terminal would report a single byte, coded in binary as 01000011, or a hex 43, ASCII "C".

  • SattOne or more bytes containing the encoded Character Attributes that must be saved, according to the following bit-encoded format:

    bit 8:always reset (0)
    bit 7:always set (1)
    bit 6:extension indicator: if this bit is set (1), another byte of character attribute information follows (always reset on VT420).
    bit 5:reserved for future use
    bit 4:reserved for future use
    bit 3:reserved for future use
    bit 2:reserved for future use
    bit 1:selectively erasable attribute

    For the actual character attribute bits (1 through 5, above) if the bit is set (1), it indicates that the character attribute has been selected. Example: if the selective erase attribute is set, the terminal would report a single byte, coded in binary as 01000001, or a hex 41, ASCII "A".

  • SflagOne or more bytes containing several flags and modes that must be saved, according to the following bit-encoded format:

    bit 8:always reset (0)
    bit 7:always set (1)
    bit 6:extension indicator: if this bit is set (1), another byte of flags follows (always reset on VT420).
    bit 5:reserved for future use
    bit 4:auto-wrap pending (1 if pending)
    bit 3:SS3 pending (1 if SS3 received)
    bit 2:SS2 pending (1 if SS2 received)
    bit 1:origin mode (1 = set 0 = reset)

    For the flags above, if the bit is set (1) it indicates that the mode or state is set (as indicated). Example: if origin mode DECOM is set, auto-wrap is pending, and an SS3 has been received, the terminal would report a single byte, coded in binary as 01001101, or a hex 4D, ASCII "M".

  • Pgl, PgrCharacter G-sets which are currently invoked into GL and GR. These parameters are characters from 0 through 3, depending on which of G0, G1, G2, or G3 are invoked into GL and GR, respectively.

  • ScssOne byte containing the encoded information regarding the size of the character sets designated into G0 through G3 according to the following bit-encoded format:

    bit 8:always reset (0)
    bit 7:always set (1)
    bit 6:extension indicator: if this bit is set (1), another byte of character size information follows (always reset on VT420).
    bit 5:reserved for future use
    bit 4:size of G3 set
    bit 3:size of G2 set
    bit 2:size of G1 set
    bit 1:size of G0 set

    For the character set size bits (1 through 4, above) if the bit is set (1), it indicates that the graphic set contains a 96-character character set. If the bit is reset, the graphic set contains a 94-character character set. Example: if ISO Latin Alphabet Nr 1 Supplemental, a 96-character character set is designated into G2 and G3, and ASCII, a 94-⁠character character set is designated into G0 and G1, the terminal would report a single byte, coded in binary as 01001100 = hex 4C = ASCII "L".

  • SdesigA string of bytes which consist of the strings of designating tails of the character sets designated into G0, G1, G2, and G3, in that order. The designating tail consists of the intermediate and final characters of the Select Character Set (SCS) designating escape sequence for the character set.

    (Example: If ASCII were designated into G0, the Line Drawing (DEC Special Graphics) set into G1, and the DEC Supplemental Set into G2 and G3, the value of Sdesig would be: 'B0%5%5')

    Note: this string is deliberately placed at the end of the data of the DECCIR control string, because the semicolon (;) separator character used between the previous parameters is a valid character in a SCS escape sequence.

    Note: This string will report the User Preference Supplemental Set (UPSS) designator if that is how a character set was designated. DECRQUPSS can be used to determine the actual UPSS if needed.

Tabulation Stop Report DECTABSR

Levels: 2x (TSI), 3-4

Purpose: To report the presentation state tab stops

Format:

DCS  2    $    u    D...D  ST
9/0  3/2  2/4  7/5  D...D  9/12

Description: The data of a device control string for a Tabulation Stop Report consists of a string of numeric parameters specifying where tabulation stops are currently set in the terminal, separated by slash ("/") characters. An example of a DECTABSR when the terminal has 8 column tabs set would be as follows:

DCS 2 $ u 9 / 17 / 25 / 33 / 41 / 49 / 57 / 65 / 73 ST

Restore Presentation State DECRSPS

Levels: 2x (TSI), 3-4

Purpose: To report previously reported presentation state (cursor information or tab stops).

Format:

DCS  Ps   $    t    D...D  ST
9/0  Ps   2/4  7/4  D...D  9/12

Description: This device control string is sent to reset the terminal to the presentation state described in the data of the control string. This DCS takes one selective parameter, which indicates the format of the data of the DCS. The data of the DCS must be in the format of one of the Presentation State Reports (DECPSR). The type of DECPSR format that the data consists of is specified by the selective parameter:

PsType of DECPSR
0error, restore ignored
1Cursor Information Report (DECCIR)
2Tabulation Stop Report (DECTABSR)

When this sequence is received by the terminal, the terminal will begin to change the terminal state according to the state encoded in the data of the control string.

If an invalid value is detected, the terminal will ignore the error, if possible, and if not will ignore the remainder of the data, parsing until a ST control is encountered. This may leave the terminal state partially unrestored. No error indication is returned to the host.

Request Terminal State Report DECRQTSR

Levels: 2x (TSI), 3-4

Purpose: To request a compact report of most settable state.

Format:

CSI   Ps  $    u
9/11  Ps  2/4  7/5

Description: DECRQTSR causes the terminal to issue a Terminal State Report (DECTSR). Terminal State Reports transmit information on global state within the terminal. The type of DECTSR returned depends on the value of the selective parameter.

PsType of DECTSR
0ignored, no report sent
1Terminal State Report (DECTSR)

If the terminal does not recognize the type of DECTSR requested, the entire command is ignored.

Terminal State Report (1) DECTSR

Levels: 2x (TSI), 3-4

Purpose: To report most settable terminal state in one compact sequence.

Format:

DCS  1    $    s    D...D  ST
9/11 3/1  2/4  7/3  D...D  9/12

Description: The Terminal State Report is a device control string containing a collection of terminal device attributes. A Terminal State Report is sent in response to a Request Terminal State Report control sequence (DECRQTSR) with Selective Parameter "1".

The data of the device control string for a Terminal State Report consists of a Sixel encoded, string of 8-bit bytes which contains the the state information for the device. This string is guaranteed not to be longer than 256 characters, including the DCS control character, introducer sequence, and ST control character.

The state information reported is the same as the state information available through the other discrete TSI controls. This generally represents all settable state in the terminal with the exception of large data items that are not practical to report (the contents of the logical display, DRCS, UDK definitions, and Macros).

The format of the data is firmware revision dependent. Software should not expect the format to remain the same across firmware revisions or different members of a terminal family.

The format of DECTSR is: DCS 1 $ s D1...Dn <checksum1> <checksum2> ST

Where

  • D1...Dn are data reported
  • <checksum1> <checksum2> is a two bytes check sum of D1...Dn

(checksum = 2's complement of D1 + D2 + ... + Dn; 8-bit addition with no Carry)

Restore Terminal State DECRSTS

Levels: 2x (TSI), 3-4

Purpose: To restore previously reported terminal state (DECTSR).

Format:

DCS  Ps  $    p    D...D  ST
9/0  Ps  2/4  7/0  D...D  9/12

Description: This device control string is sent to reset the terminal to the state described in the data of the control string. This DCS takes one selective parameter, which indicates the format of the data of the DCS. The data of the DCS must be in the format of one of the Terminal State Reports (DECTSR). The type of DECTSR format that the data consists of is specified by the selective parameter:

PsType of DECTSR
0illegal, restore ignored
1Terminal State Report (DECTSR)

When this sequence is received, buffered, and checksummed by the terminal, the terminal will begin to change the terminal state according to the state encoded in the data of the control string. If the checksum fails, the entire sequence is ignored. If an invalid value is detected, the terminal will ignore the error if possible, and if not, ignore the remainder of the data, parsing until a ST control is encountered. This may leave the terminal in a partially unrestored state. No error indication is returned to the host.

5.14 Internal Functions And Procedures

5.14.1 End Of Line

/*************
*
* end_of_line
* This function returns the last position of the line
* based on its line attributes and column mode.
*
* assumes line is on the current page
*************/
short int end_of_line (line)
  line_t line;
{
  line_t base;  /* first line(-1) of page */
  column_t end_line;
/*...........*/
if (column_mode = ONE_THIRTY_TWO) end_line = 132;
else end_line = 80;

base = (active_position.page-1) * lines_per_page;
if (line_rendition[line + base] != SINGLE_WIDTH)
  end_line /= 2;
return(end_line);
}

5.14.2 Scroll Up

/****************
*
* scroll_up
*
* This procedure causes the scroll area between the line
* designated and the Bottom Margin (inclusive) on the
* active page to scroll upward by the number of lines
* designated in the count.  Line and Character Renditions
* are scrolled with the data.  A new single-width line with
* all character positions empty is inserted at the Bottom Margin.
* Lines scrolled off the top of the scrolling region are lost.
*
******************/
void scroll_up(top_line, count)
  line_t top_line;
  line_t count;
{
  line_t y;
  column_t x;
  line_t base;     /* first line(-1) of page */
/*...............*/
base = (active_position.page-1) * lines_per_page;
while (count > 0)
  {
  for (y=top_line+base; y<bottom_margin+base; y++)
    {
    line_rendition[y] = line_rendition[y+1];
    for (x=left_margin; x<=right_margin; x++)
      strncpy( display[y][x], display[y-1][x],
               sizeof(character_t) );
    }
  line_rendition[bottom_margin+base] = SINGLE_WIDTH;
  for (x=left_margin; x<=right_margin; x++)
    display[bottom_margin][x].code = EMPTY_CHARACTER;
  count -= 1;
  }
} /* end scroll_up */

5.14.3 Scroll Down

/****************
*
* scroll_down
*
* This procedure causes the scroll area between the line
* designated and the Bottom Margin (inclusive) on the
* active page to scroll downward by the number of lines
* designated in the count.  Line and Character Renditions
* are scrolled with the data.  A new single-width line with
* all character positions empty is inserted at the Top Margin.
* Lines scrolled off the bottom of the scrolling region are lost.
*
******************/
void scroll_down(top_line, count)
  line_t top_line;
  line_t count;
{
  line_t y;
  column_t x;
  line_t base;     /* first line(-1) of page */
/*...............*/
base = (active_position.page-1) * lines_per_page;
while (count > 0)
  {
  for (y=bottom_margin+base; y>top_line+base; y--)
    {
    line_rendition[y] = line_rendition[y-1];
    for (x=left_margin; x<=right_margin; x++)
      strncpy( display[y][x], display[y-1][x],
               sizeof(character_t));
    }
  line_rendition[top_line+base] = SINGLE_WIDTH;
  for (x=left_margin; x<=right_margin; x++)
    display[top_line][x].code = EMPTY_CHARACTER;
  count -= 1;
  }
} /* end scroll_down */

5.14.4 Scroll Left

/****************
*
* scroll_left
*
* This procedure causes the scroll area between the column
* designated and the Right Margin (inclusive) on the
* active page to scroll leftward by the number of columns
* designated in the count.  A new column with all character
* positions empty is inserted at the Right Margin.
* Characters scrolled past the scrolling region are lost.
*
******************/
void scroll_left(left_column, count)
  column_t left_column;
  column_t count;
{
  line_t y;
  column_t x;
  line_t base;     /* first line(-1) of page */
/*...............*/
base = (active_position.page-1) * lines_per_page;
while (count > 0)
  {
  for (y=top_margin+base; y<=bottom_margin+base; y++)
    {
    for (x=left_column; x<right_margin; x++)
      strncpy( display[y][x], display[y][x+1],
               sizeof(character_t));
    display[y][right_margin].code = EMPTY_CHARACTER;
    }
  count -= 1;
  }
} /* end scroll_left */

5.14.5 Scroll Right

/****************
*
* scroll_right
*
* This procedure causes the scroll area between the column
* designated and the Right Margin (inclusive) on the
* active page to scroll right by the number of columns
* designated in the count.  A new column with all character
* positions empty is inserted at the designated column.
* Characters scrolled past the scrolling region are lost.
*
******************/
void scroll_right(left_column, count)
  column_t left_column;
  column_t count;
{
  line_t y;
  column_t x;
  line_t base;     /* first line(-1) of page */
/*...............*/
base = (active_position.page-1) * lines_per_page;
while (count > 0)
  {
  for (y=top_margin+base; y<=bottom_margin+base; y++)
    {
    for (x=right_margin; x>left_column; x--)
      strncpy( display[y][x], display[y][x-1],
               sizeof(character_t));
    display[y][left_column].code = EMPTY_CHARACTER;
    }
  count -= 1;
  }
} /* end scroll_right */

5.15 Control Function Reference To Other Chapters

This subsection lists ANSI control functions that are not described in this chapter (DEC STD 70-5, Character Cell Display) and indicates where in the VSRM they are described as a reference to the rest of ANSI host interface.

Control Function Reference

5.16 Change History

5.16.1 Rev 0.4 To 0.5

The following changes were made at this revision to properly integrate this section with the rest of the Video Systems Reference Manual:

  1. The name was changed from "Character Cell Display Level 1" to "Character Cell Display". All references to Level 1 operation only were removed, and explicit reference to both Level 1 and Level 2 operation was added for all functions.

  2. The Reference Standards section was updated.

  3. The Conformance section, the list of conforming products, and the tables of required functions were removed and made a separate chapter in the Video SRM ("Conformance Requirements").

  4. The program flow diagrams and the executive routines were moved to the chapter "Specification Program Structure".

  5. The Reset to Initial State control was moved to the chapter "Terminal Management".

  6. Some variable names were changed to be consistent with their use throughout the rest of the Video SRM.

  7. The algorithm for Insert or Replace Character was corrected to include the processing of Single Shift control functions.

  8. The Set Mode and Reset Mode control functions were moved to the chapter "Specification Program Structure", and their detailed implementation was broken out into a separate section for each mode related to Character Cell Display operation.

  9. The description of Blink rendition was changed.

  10. A note was added concerning software dependence on the speed of implementing changes of state in Screen Mode.

  11. The purpose section for Line Feed, Vertical Tab, Form Feed, Index, Reverse Index, and Next Line was reworded to indicate scrolling if necessary, and to indicate (where appropriate) the use of fallback implementation in video terminals.

  12. The section on Substitute was reworded to remove the reference to "fallback" character.

  13. The note on software use of Horizontal and Vertical Position was changed to remove the reference to retransmission.

  14. A definition was added for the term "Margin".

  15. Beginning of line and end of line conditions were added to the Erase In Display algorithm.

  16. Clearing of the Last Column Flag was added to the algorithms for Delete Character and Reset Auto Wrap Mode.

  17. A note was added to the section on slow scrolling to indicate that it must render text "recognizable", but not necessarily "readable".

  18. A note was added on conforming software use of Double Height lines.

  19. A section was added for Character Set Selection, which was previously a part of the chapter "Code Extension Layer".

  20. A section was added for the Warning Bell, which was previously a part of the "Terminal Management" chapter.

  21. A section was added for Text Cursor Enable Mode, which was previously a part of the "Terminal Management" chapter.

  22. A section was added for Control Representation Mode, which is currently planned for Level 2 terminals (subject to review).

5.16.2 Revision 0.5 To AX10

  1. Added the Selectively Erasable Characters extension, which required the following:

    1. A state description for Character Attributes.

    2. New entries in the state tables.

    3. Addition of the Select Character Attribute (DECSCA) control function.

    4. Modification of the Erase In Line (EL) and Erase In Display (ED) control functions.

    5. Addition of the Selective Erase In Line (DECSEL) and Selective Erase In Display (DECSED) control functions.

    It also required changes to the following routines:

    • Insert or Replace Graphic Character
    • Save Cursor
    • Restore Cursor
  2. Removed Control Representation Mode (CRM) to an appendix to the SRM. It will not be invokable from the host.

  3. Added the Erase Character (ECH) and Insert Character (ICH) control functions.

  4. Added a note to the description of Auto Wrap Mode to indicate that Space characters also affect the wrap condition.

  5. Added the following control functions to the list of functions which clear the Auto Wrap state (Last Column Flag):

    • Erase Character
    • Insert Character
    • Erase In Line
    • Selective Erase In Line
    • Erase In Display
    • Selective Erase In Display
  6. Added a note that the Current Attribute is saved in the Cursor Save Buffer if the Selectively Erasable Characters extension is supported.

  7. Added values to the Select Graphic Rendition (SGR) control function for Level 2 to turn off Bold, Blink, Underscore, and Reverse renditions.

  8. Made minor corrections to the algorithms for Double Width and Double Height lines.

  9. Added a note to the Substitute control function referring to the section "Code Extension Layer" for the handling of Substitute within escape and control sequences.

  10. Added a deviation note to the Index control function for the VT100 and VT125 to indicate that in these terminals the control is affected by the setting of New Line Mode.

  11. Changed the algorithm for Tabulation Clear (TBC) to process multiple selective parameters.

  12. Made extensive changes to the algorithms for Erase In Line (EL) and Erase In Display (ED) to provide the following:

    • processing of multiple selective parameters.
    • setting of line rendition to single width when all characters are erased.
    • processing of private parameter for selective erase function.
  13. Corrected the coding of Delete Character (DCH), which is CSI Pn P.

  14. Added a note on the use of User Preference Features (modes) which are not to be used by software except in response to an explicit user request.

  15. Made notes that setting and resetting Column Mode (DECCOLM) will clear the screen, etc., even if the terminal was already in the selected state.

  16. Noted that the Warning Bell may be disabled in Setup.

  17. Modified the descriptions of Vertical Tab (VT) and Form Feed (FF) to point to the Line Feed algorithm.

  18. Made Insert Replacement Mode (IRM), Delete Character (DCH), Delete Line (DL), and Insert Line (IL) a Level 1 Editing Extension, which is required in all future Level 1 implementations, and in Level 2. Removed all VT100 family deviation notes on these functions.

  19. Made Auto Wrap Mode an exception to Level 1, and removed all references to this and the Last Column Flag. Also removed all VT100 family deviation notes on this function.

  20. Modified the Save Cursor (DECSC) and Restore Cursor (DECRC) descriptions to differentiate between Level 1 and Level 2 functionality.

  21. Added a character set table to the state descriptions and modified the algorithms for Designate Character Set to accommodate redefinition of the designator sequences using DRCS.

  22. Corrected dual coding in the algorithm for Insert or Replace Graphic Characters.

  23. Added a note to the Restore Cursor control indicating the handling of the condition in which the cursor is restored outside of the scrolling region with Origin Mode set.

  24. Made corrections in the algorithms for Erase Character, Delete Character, Insert Character, Delete Line, and Insert Line.

  25. Added a note on the use of the UK character set in Level 1 operation to the section on character set designation.

5.16.3 Rev AX10 To AX11

  1. Removed Rev AX10 change bars. Added change bars to any change that could affect conformance or interpretation of the document or should be brought to the attention of terminal implementors or software engineers.

  2. Added note that level 2 SGR parameters may be recognized when device is operating in level 1 mode, but that conforming software shall not rely on this feature.

  3. Corrected sense of Selectively Erasable Attribute (set using DECSCA). The default or attribute off condition is that characters are selectively erasable.

5.16.4 Rev AX11 To AX12

  1. Removed Rev AX11 change bars. Added change bars to any change that could affect conformance or interpretation of the document or should be brought to the attention of terminal implementors or software engineers.

  2. Updated Reference Standards section and put at end after Change History per convention for other chapters.

  3. Added section to Introduction explaining chapter organization as a number of small sections. Re-organized entire chapter to group related controls by function instead of syntax.

  4. Modified all code to operate on the current page.

Terminology Section:

  1. Removed definitions of the following terms which are defined in the Code Extension section:

    • Bit Combination
    • Character
    • Control Character
    • Control Function
    • Control Sequence
    • Control String
    • Escape Character (ESC)
    • Escape Sequence
    • Final Character
    • Intermediate Character
    • Numeric Parameter
    • Parameter
    • Parameter String
    • Selective Parameter
  2. Added definition of Logical Display - the lines and columns available for storing and presenting graphic characters as seen by the application or host computer. A Logical Display may be organized as a single rectangular array of lines and columns (one page), or divided into a number of identically sized pages, each of which is a rectangular array of lines and columns.

  3. Added definition of Page - An addressable area of a Logical Display organized as a rectangular array of lines and columns. The number of lines and columns defines the Page Size.

  4. Added subsection titled "Code Extension Terms" listing terms defined in the Code Extension chapter of the VSRM (DEC STD 70-3).

  5. Removed the following terms which do not appear in the text of the chapter: Introducer; Transfer; Transmission Control.

  6. Clarified definition of Control Sequence Introducer (CSI) - The C1 control (represented by a single character in 8-⁠bits, or a two character ESC Fe sequence in 7-bits) which initiates a control sequence. CSI is a prefix affecting the interpretation of a limited number of contiguous bit combinations. [This should be in the Code Extension chapter as well, but isn't at this time]

  7. Clarified definition of Default - A function-dependent value that is assumed when no explicit value, or a value of 0, is specified.

  8. Clarified definition of Margin - A line which marks the upper or lower boundary of the scrolling region (vertical scroll margin). A column which marks the left or right boundary of the scrolling region (horizontal scroll margin).

Display Coordinate System and Addressing

  1. Logical Display: Described concept of Logical Display and Page Size, default sizes, and ability to change it.

  2. Margins and Scrolling: Re-organized text to combine syntax and semantics to be easier to follow. Added section summarizing interaction of controls with scrolling region. Added list of controls defined in this section. Added descriptions for: DECSLRM, DECLRMM, DECFI, DECBI to support left and right margins.

  3. Cursor Movement: Added DECXCPR extended cursor position report for use at Level 4, or with the Windowing Extension. Updated algorithms for CUF and CUB to check right and left margins.

Page Size and Arrangement:

  1. Added description of DECSCPP and DECSLPP to support Level 4, or Windowing Extension.

Page Movement:

  1. New Subsection describing page movement controls for use at Level 4, or with the Windowing Extension.

Windowing Extension:

  1. Completely new subsection describing Windowing Extension.

Visual Renditions

  1. Added new subsection on ANSI Color Text Extension. SGR parameters 31-37, 39, 41-47, 49. Color Maps. DECCTR - color table report. Interactions with other visual attributes. Guidelines for default color assignment. DECSTGLT - Select Text Graphics Look-Up Table (for alternate text rendition mapping).

Graphic Character Sets

  1. Expanded section on Grahic Character sets including which sets are required at different conformance levels and extensions. Designating sequences for character sets. 8-⁠bit Interface Architecture Extension. NRCS Extension.

Editing Functions:

  1. Modified description of character insertion to cover behavior with respect to the margins.

  2. Modified description of ICH, IL, and DL to be restriced to text within the Left Right Margins.

  3. Added descriptions of DECIC and DECDC to support left and right margins.

  4. Noted ECH, EL, DECSEL, ED, and DECSED are not affected by the margins.

OLTP Features

  1. Completely new subsection describing VT420 OLTP features.

Saving and Restoring Terminal State

  1. Terminal State Interrogation: Completely new subsection describing TSI

  2. Modified note on DECCIR (Cursor Information Report) to specify sequence returns UPSS designator if G-set was designated that way.

Internal Functions and Procedures

  1. Modified routines scroll_up and scroll_down to operate within the left and right margins.

  2. Added routines scroll_left and scroll_right.

Control Function Reference to Other Chapters

  1. Completely new subsection listing control functions and what chapter of the VSRM they are described in.

5.17 Reference Standards

DIGITAL STANDARDS

EL-00138-00
DEC STD 138 Registry of Control Functions for Character-Imaging Devices
EL-00169-00
DEC STD 169 Digital Standard Coded Graphic Character Sets for Hardware and Software

Copies of Digital Standards Can be obtained from Standards and Methods Control, CTS1-2/D4, DTN 287-3724, JOKUR::SMC

ANSI AND ISO STANDARDS

ANSI X3.4 - 1986
American National Standard Code for Information Interchange (ASCII character set)
ANSI X3.41 - 1974
American National Standard Code Extension Techniques for use with the 7-Bit Coded Character Set of the American National Standard Code for Information Interchange
ANSI X3.64 - 1979
Additional Controls for use with American National Standard Code for Information Interchange
dpANS X3.134.1-1985
8-bit ASCII Structure and Rules
dpANS X3.134.2-1985
7-bit and 8-bit ASCII Supplemental Multinational Graphic Character Set
ISO 646
7-Bit Coded Character Set for Information Interchange
ISO 2022:1986
Information Processing / ISO 7-Bit and 8-Bit Coded Character Sets - Code Extension Techniques
ISO 6429:1988
Information Processing / Additional Controls for use with Character Imaging Devices
ISO 8859-1:1987
Information Processing / 8-Bit Single-Byte Coded Character Sets - Part 1 : ISO Latin Alphabet Nr 1;

Copies of ANSI and ISO Standards can be obtained from local Digital Libraries.