Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ display(7) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stty(1)

ioctl(2)

console(7)

keyboard(7)

termio(7)

display(7)                      (RM400 only)                     display(7)

NAME
     display - system console display

DESCRIPTION
     The system console (and user's terminal) is composed of two separate
     pieces: the keyboard [see keyboard(7)] and the display. Because of
     their complexity, they are discussed in separate manual entries.

     The display normally consists of 25 lines of 80 columns each. The
     effect of writing characters to the console or to one of its virtual
     screens (/dev/console or /dev/vtxx) depends on the characters. All
     characters written to /dev/console are first processed by the terminal
     interface [see termio(7)]. For example, mapping newline characters to
     carriage return plus newline, and expanding tabs to spaces, will be
     done before the following processing:

     x         Where x is not one of the following, displays x.

     BEL       Generates a bell (audible tone, no modulation).

     CR        Places the cursor at column 1 of the current line.

     LF, VT    Places the cursor at the same column of the next line
               (scrolls if the the current line is line 25).

     FF        Clears the screen and places the cursor at line 1, column 1.

     S         Depends on the previous character: if a _ (underscore), see
               below; otherwise, if the cursor is not at column 1, it is
               moved to the left one position on the same line. If the cur-
               sor is at column 1 but not line 1, it is moved to column 79
               of the previous line. Finally, if the cursor is at column 1,
               line 1, it is not moved.

     Sx       Sets the "underscore" attribute for the character x to be
               displayed.

     ESCx      Where x is any of the 256 possible codes (except for c and
               [), displays that value uninterpreted. This is useful for
               utilizing the full set of graphics available on the display.
               Note again that the characters are processed through the
               terminal interface prior to this escape sequence. Therefore,
               to get some of the possible 256 characters it is necessary
               that the character not be postprocessed. The easiest way to
               accomplish this is to turn off OPOST in the coflag field
               [see termio(7)]; however, this may have other side effects.









Page 1                       Reliant UNIX 5.44                Printed 11/98

display(7)                      (RM400 only)                     display(7)

     The display can be controlled by means of ANSI X3.64 escape sequences,
     which are specific sequences of characters, preceded by the ASCII
     character ESC. The escape sequences are the following:

     ESCc             Clears the screen and places the cursor at line 1,
                      column 1.

     ESCQ n 'string'  Defines the function key n with string. The string
                      delimiter ' may be any character not in string. Func-
                      tion keys are numbered 0 through 11 (F1 = 0, F2 = 1,
                      etc.)

     ESC[ n @         Insert character - inserts n blanks at the current
                      cursor position.

     ESC[ n `         Horizontal position absolute - moves active position
                      to column given by n.

     ESC[ n A         Cursor up - moves the cursor up n lines (default:
                      n=1).

     ESC[ n a         Horizontal position relative - moves active position
                      n characters to the right (default: n=1).

     ESC[ n B         Cursor down - moves the cursor down n lines (default:
                      n=1).

     ESC[ n C         Cursor right - moves the cursor right n columns
                      (default: n=1).

     ESC[ n c         Where n is 0 (underline cursor), 1 (blockcursor), or
                      2 (no cursor). 0 is the default value for n.

     ESC[ n D         Cursor left - moves the cursor left n columns
                      (default: n=1).

     ESC[ n d         Vertical position absolute - moves active position to
                      line given by n.

     ESC[ n E         Cursor next line - moves the cursor to column 1 of
                      the next line, then down n-1 lines (default: n=1).

     ESC[ n e         Vertical position relative - moves the active posi-
                      tion down n lines (default: n=1).

     ESC[ n F         Cursor previous line - moves the cursor to column 1
                      of the current line, then up n lines (default: n=1).

     ESC[ n G         Cursor horizontal position - moves the cursor to
                      column n of the current line (default: n=1).




Page 2                       Reliant UNIX 5.44                Printed 11/98

display(7)                      (RM400 only)                     display(7)

     ESC[ n; m H      Position cursor - moves the cursor to column m of
                      line n (default: n=1, m=1).

     ESC[ n; m f      Position cursor - moves the cursor to column m of
                      line n (default: n=1, m=1).

     ESC[ n J         Erase window - erases from the current cursor posi-
                      tion to the end of the window if n=0, from the begin-
                      ning of the window to the current cursor position if
                      n=1, and the entire window if n=2 (default: n=0).

     ESC[ n K         Erase line - erases from the current cursor position
                      to the end of the line if n=0, from the beginning of
                      the line to the current cursor position if n=1, and
                      the entire line if n=2 (default: n=0).

     ESC[ n L         Insert line - inserts n lines at the current cursor
                      position (default: n=1).

     ESC[ n M         Delete line - deletes n lines starting at the current
                      cursor position (default: n=1).

     ESC[ n P         Delete character - deletes n characters from a line
                      starting at the current cursor position (default:
                      n=1).

     ESC[ n S         Scroll up - scrolls the characters in the current
                      window up n lines. The bottom n lines are cleared to
                      blanks (default: n=1).

     ESC[ n T         Scroll down - scrolls the characters in the current
                      window down n lines. The top n lines are cleared to
                      blanks (default: n=1).

     ESC[ n X         Erase character - erases n character positions start-
                      ing at the current cursor position (default: n=1).

     ESC[ n Z         Cursor Backward Tabulation - moves active position
                      back n tab stops.

     ESC[ 2h          Locks the keyboard and ignores keyboard input until
                      unlocked. Characters are not saved.

     ESC[ 2i          Sends the screen to the host. The current screen
                      display is sent to the application.

     ESC[ 2l          Unlocks the keyboard. Re-enables keyboard input.







Page 3                       Reliant UNIX 5.44                Printed 11/98

display(7)                      (RM400 only)                     display(7)

     ESC[ Ps ; Ps ; m Character attributes - each Ps is one of the follow-
                      ing characters; multiple characters are separated by
                      semicolons. These parameters apply to successive
                      characters being displayed, in an additive manner
                      (e.g. both bold and underscoring can be selected).
                      (Default: Ps=0.)
                      _____________________________________________________
                     |  Ps      Meaning                                   |
                     |____________________________________________________|
                     |   0      all attributes off (normal display)       |
                     |          (white foreground, black background)      |
                     |   1      bold intensity                            |
                     |   4      underscore on                             |
                     |   7      reverse video                             |
                     |   8      sets blank (non-display)                  |
                     |  10      selects the primary font                  |
                     |  11      selects the first alternate font; lets    |
                     |          ASCII characters less than 32 be          |
                     |          displayed as ROM characters (not imple-   |
                     |          mented).                                  |
                     |  12      selects a second alternate font; sets the |
                     |          high bit of extended ASCII code before    |
                     |          displaying as ROM characters.             |
                     |____________________________________________________|

     ESC[ Pn d        Moves the cursor to the line specified by Pn.

   ioctl Calls

     The following ioctl calls may be used to change the display used for
     the video monitor. If the virtual terminal has not been put in process
     mode (see the VTSETMODE ioctl), setting the display mode to a non-
     text mode will turn off VT switching. VT switches will be re-enabled
     after the display mode has been reset to a text mode.

     Note: All of the following ioctls are performed on either a file
     descriptor to the virtual terminals or to the special file /dev/video.
     ioctls to /dev/video are indicated with an asterisk (*). For the
     ioctls to /dev/video to work, the controlling tty for the process must
     be the virtual terminal on which the operation is to be performed. If
     the tty is not a virtual terminal, the return value will be -1 and
     errno will be set to EINVAL.

     Switching to an invalid display mode for a display device will result
     in an error.

     KIOCSOUND         Start sound generation. Turn on sound. The "arg" is
                       the frequency desired. A frequency of 0 turns off
                       the sound.





Page 4                       Reliant UNIX 5.44                Printed 11/98

display(7)                      (RM400 only)                     display(7)

     KDGETLED          Get keyboard LED status. The argument is a pointer
                       to a character. The character will be filled with a
                       boolean combination of the following values:

                       LEDSCR      0x01   (flag bit for scroll lock)
                       LEDCAP      0x04   (flag bit for caps lock)
                       LEDNUM      0x02   (flag bit for num lock)

     KDSETLED          Set keyboard LED status. The argument is a character
                       whose value is the boolean combination of the values
                       listed under KDGETLED.

     KDMKTONE          Generate a fixed length tone. The argument is a 32
                       bit value, with the lower 16 bits set to the fre-
                       quency and the upper 16 bits set to the duration (in
                       milliseconds).

     KDGKBTYPE         Get keyboard type. The argument is a pointer to a
                       character type. The character will be returned with
                       one of the following values:

                       KB84        0x01   (84 key keyboard)
                       KB101       0x02   (101 key keyboard)
                       KBOTHER     0x03   (other type keyboard)

     KDSETMODE (*)     Set console in text or graphics mode. The argument
                       is of type integer, which should contain one of the
                       following values:

                       KDTEXT      0x00   (sets console to text mode)
                       TKDGRAPHICS 0x01   (sets console in graphics mode)

                       If the mode is set to KDGRAPHICS and the Virtual
                       Terminal is not in process mode (see the VTSETMODE
                       ioctl), no virtual terminal switches will be possi-
                       ble until the mode is reset to KDTEXT, KDTEXT0, or
                       KDTEXT1.

                       Note, the user is responsible for programming the
                       color/graphics adaptor registers for the appropriate
                       graphical state.

     KDGETMODE         Get current mode of console. Returns integer argu-
                       ment containing either KDTEXT or KDGRAPHICS as
                       defined in the KDSETMODE ioctl description.









Page 5                       Reliant UNIX 5.44                Printed 11/98

display(7)                      (RM400 only)                     display(7)

     VTOPENQRY        Find an available virtual terminal. The argument is
                       a pointer to a long. The long will be filled with
                       the number of the first available VT that no other
                       process has open or -1 if none are available.

     VTGETMODE (*)    Determine what mode the active virtual terminal is
                       currently in, either VTAUTO or VTPROCESS. The
                       argument to the ioctl is the address of the follow-
                       ing type of structure:

                 struct vtmode
                 {
                     char  mode;    /* VT mode */
                     char  waitv;   /* if set, hang on writes when not active */
                     short relsig;  /* signal to use for release request */
                     short acqsig;  /* signal to use for display acquired */
                     short frsig;   /* not used set to 0 */
                 };

                 #define VTAUTO    0x00  /* automatic VT switching */
                 #define VTPROCESS 0x01  /* process controls switching */

                       The vtmode structure will be filled in with the
                       current value for each field.

     VTGETSTATE (*)   The VTGETSTATE ioctl returns global virtual termi-
                       nal state information. It returns the active virtual
                       terminal in the vactive field, and the number of
                       active virtual terminals and a bit mask of the glo-
                       bal state in the vtstate field, where bit x is the
                       state of vt x (1 indicates that the virtual terminal
                       is open).

     VTSETMODE (*)    Set the virtual terminal mode. The argument is a
                       pointer to a vtmode structure, as defined above.



















Page 6                       Reliant UNIX 5.44                Printed 11/98

display(7)                      (RM400 only)                     display(7)

     VTSENDSIG (*)    The VTSENDSIG ioctl specifies a signal (in
                       vtsignal) to be sent to a bit mask of virtual ter-
                       minals (in vtstate).

                       The data structure used by the VTGETSTATE and
                       VTSENDSIG ioctls is:

                   struct vtstat
                   {
                       ushort vactive;  /* active vt */
                       ushort vsignal;  /* signal to send (VTSENDSIG) */
                       ushort vstate;   /* vt bit mask (VTSENDSIG and
                                            VTGETSTATE) */
                   };

                       and is defined in /usr/include/sys/vt.h.

     VTRELDISP (*)    Used to tell the virtual terminal manager that the
                       display has or has not been released by the process.
                       A non-zero argument indicates that the display has
                       been released; a zero argument indicates refusal to
                       release the display.

     VTACTIVATE       Makes the virtual terminal number specified in the
                       argument the active VT. The VT manager will cause a
                       switch to occur in the same manner as if a hotkey
                       sequence had been typed at the keyboard. If the
                       specified VT is not open or does not exist, the call
                       will fail and errno will be set to ENXIO.

     KIOCINFO          This call tells the user what the device is.

     GIOSCRNMAP (*)   This call gets the screen mapping table from the
                       kernel.




















Page 7                       Reliant UNIX 5.44                Printed 11/98

display(7)                      (RM400 only)                     display(7)

     GIOATTR          This call returns the current screen attribute. The
                       bits are interpreted as follows:

                       Bit 0 determines underlining for black and white
                       monitors (1 = underlining on).

                       Bits 0-2, for color monitors only, select the fore-
                       ground color. The following list indicates what
                       colors are selected by the given value:

                       The value 0 selects black.
                       The value 1 selects red.
                       The value 2 selects green.
                       The value 4 selects blue.
                       The value 5 selects magenta.
                       The value 6 selects cyan.
                       The value 7 selects white.

                       Bit 3 is the intensity bit (1 = intensity on).

                       Bits 4-6, for color monitors only, select the back-
                       ground color. For a list of colors and their values,
                       see the list under foreground colors.

                       Bit 7 is the blink bit (1 = blink on).

     GIOCOLOR (*)     This call returns a non-zero value if the current
                       display is a color display, otherwise, it returns a
                       zero.

























Page 8                       Reliant UNIX 5.44                Printed 11/98

display(7)                      (RM400 only)                     display(7)

     PIOSCRNMAP       This call puts the screen mapping table in the ker-
                       nel.

                       The screen mapping table maps extended ASCII (8-bit)
                       characters to ROM characters. It is an array [256]
                       of char (typedef scrnmapt) and is indexed by
                       extended ASCII values. The value of the elements of
                       the array are the ROM character to display.

                       For example, the following will change the ASCII
                       character "#" to be displayed as an British pound
                       sign.

                   #include <sys/console.h>
                   changepound()
                   {
                       scrnmapt scrntab;
                       /* get screen mapping table of standard output */
                       if (ioctl(0,GIOSCRNMAP, scrntab)==-1)
                       {
                           perror("screenmap read");
                           exit(-1);
                       }
                       /* 156 is the ROM value of British pound sign and 30
                          is the ASCII value of '#'. */
                       scrntab[30] = 156;
                       if (ioctl(0, PIOSCRNMAP, scrntab) == -1)
                       {
                           perror("screenmap write");
                           exit(-1);
                       }
                   }

NOTES
     Although it is possible to write character sequences which set arbi-
     trary bits on the screen in any of the three graphics modes, this mode
     of operation is not currently supported.

FILES
     /dev/console

     /dev/vt00-n

     /dev/video

     /usr/include/sys/kd.h

SEE ALSO
     stty(1), ioctl(2), console(7), keyboard(7), termio(7).





Page 9                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026