Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stty(1)

console(7)

keyboard(7)

termio(7)

ioctl(2)



          display(7)           INTERACTIVE UNIX System           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, and because there are
               three possible display interfaces (monochrome, color graph-
               ics, and enhanced graphics adapters), they are discussed in
               separate manual entries.

               The display normally consists of 25 lines of 80 columns
               each; 40-column lines are also supported by the
               color/graphics adapter, and 43 lines of 80-columns each are
               supported by the enhanced graphics adapter.  Writing charac-
               ters to the console or one of its virtual screens
               (/dev/console or /dev/vtxx) has an effect which depends on
               the characters.  All characters written to /dev/console are
               first processed by the terminal interface (see termio(7)).
               For example, mapping new-line characters to carriage return
               plus new-line, 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 current line is line 25).

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

               BS      Depends on the previous character:  if an _ (under-
                       score), 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 cursor is at column 1, it is
                       not moved.

               _BSx    Sets the underscore attribute for the character x to
                       be displayed.  The underscore attribute for the
                       color/graphics adapter is a red background with a
                       white foreground.

               ESCx    Where x is any of the 256 possible codes (except c,
                       [, and H), displays that value uninterpreted.  This
                       is useful for utilizing the full set of graphics
                       available on the display.  Note again that the char-
                       acters are processed through the terminal interface
                       prior to this escape sequence.  Therefore, to get
                       some of the possible 256 characters, it is necessary


          Rev. 1.3                                                   Page 1





          display(7)           INTERACTIVE UNIX System           display(7)



                       that the character not be postprocessed.  The easi-
                       est way to accomplish this is to turn off OPOST in
                       the c_oflag field (see termio(7)); however, this may
                       have other side effects.

               The display can be controlled by means of ANSI X3.64 escape
               sequences, which are specific sequences of characters, pre-
               ceded by the ASCII character ESC.  The escape sequences,
               which work on either the monochrome, color graphics, or
               enhanced graphics adapter, are the following:

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

               ESCH          Sets a tab stop at the current cursor posi-
                             tion.  This escape sequence will be ignored if
                             a tab is already set.

               ESC Q n 'string'
                             Defines the function key n with string.  The
                             string delimiter ' may be any character not in
                             string.  Function 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 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).



          Rev. 1.3                                                   Page 2





          display(7)           INTERACTIVE UNIX System           display(7)



               ESC[ n e      Vertical Position Relative - moves the active
                             position 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).

               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
                             position to the end of the window if n=0, from
                             the beginning 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 cur-
                             sor 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
                             starting at the current cursor position
                             (default:  n=1).

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


          Rev. 1.3                                                   Page 3





          display(7)           INTERACTIVE UNIX System           display(7)



               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.

               ESC[ ? 7 l    Sets the no-wrap flag, causing characters
                             typed after column 80 to remain at column 80.

               ESC[ n g      Delete tab stop - removes the tab stop at the
                             current cursor position if n=0, removes all
                             tab stops if n=3 (default: n=0).

               ESC[ Ps ; Ps; ... m
                             Character attributes - each Ps is one of the
                             following 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).  Only
                             the parameters through 7 apply to the mono-
                             chrome adapter; all parameters apply to the
                             color/graphics adapter and the enhanced graph-
                             ics adapter (default:  Ps=0).




























          Rev. 1.3                                                   Page 4





          display(7)           INTERACTIVE UNIX System           display(7)



               ________________________________________________________________
              | Ps                               Meaning                      |
              |_______________________________________________________________|
              | 0           all attributes off (normal display)               |
              |             (white foreground with black background)          |
              | 1           bold intensity                                    |
              | 4           underscore on                                     |
              |             (white foreground with red background on color)   |
              | 5           blink on                                          |
              | 7           reverse video                                     |
              | 30          black         (gray)                foreground    |
              | 31          red           (light red)           foreground    |
              | 32          green         (light green)         foreground    |
              | 33          brown         (yellow)              foreground    |
              | 34          blue          (light blue)          foreground    |
              | 35          magenta       (light magenta)       foreground    |
              | 36          cyan          (light cyan)          foreground    |
              | 37          white         (bright white)        foreground    |
              | 40          black         (gray)                background    |
              | 41          red           (light red)           background    |
              | 42          green         (light green)         background    |
              | 43          brown         (yellow)              background    |
              | 44          blue          (light blue)          background    |
              | 45          magenta       (light magenta)       background    |
              | 46          cyan          (light cyan)          background    |
              | 47          white         (bright white)        background    |
              | ESC[ 3 Cm   Set foreground color C where C                    |
              |             represents the color defined in Table 1           |
              |             below.                                            |
              | ESC[ 4 Cm   Set backgound color C where C                     |
              |             represents the color defined in Table 1           |
              |             below.                                            |
              | ESC[ 8 m    sets blank (non-display)                          |
              | ESC[ 10 m   selects the primary font                          |
              | ESC[ 11 m   selects the first alternate font; lets            |
              |             ASCII characters less than 32 be                  |
              |             displayed as ROM characters                       |
              | ESC[ 12 m   selects a second alternate font; tog-             |
              |             gles high bit of extended ASCII code              |
              |             before displaying as ROM characters               |
              | ESC[=cF     Set normal foreground color to c where            |
              |             c represents a color defined in Table 2           |
              |             below.                                            |
              | ESC[=cG     Set normal background color to c where            |
              |             c represents a color defined in Table 1           |
              |             below.                                            |
              | ESC[=cH     Set reverse foreground color to c where           |
              |             c represents a color defined in Table 2           |
              |             below.                                            |
              | ESC[=cI     Set reverse background color to c where           |
              |             c represents a color defined in Table 2           |
              |_______________________________________________________________|



          Rev. 1.3                                                   Page 5





          display(7)           INTERACTIVE UNIX System           display(7)



         |                  below.                                       |
         | ESC[=cJ     Set graphic foreground color to c where           |
         |             c represents a color defined in Table 2           |
         |             below.                                            |
         | ESC[=cK     Set graphic background color to c where           |
         |             c represents a color defined in Table 2           |
         |             below.                                            |
         | ESC[=cA     Set the overscan (border) color to c              |
         |             where c represents a color defined in             |
         |             Table 2 below.                                    |
         |_______________________________________________________________|

                    _____________
                   |   TABLE 1  |
                   |__|_________|
                   | C|   Color |
                   |__|_________|
                   | 0|  Black  |
                   |__|_________|
                   | 1|  Red    |
                   |__|_________|
                   | 2|  Green  |_______________________________
                   |__|________||           TABLE 2            |
                   | 3|  Yellow||_|_________|____|_____________|
                   |__|________||C|  Color  |  C |  Color      |
                   | 4|  Blue  ||_|_________|____|_____________|
                   |__|________||0|  Black  |  8 |  Grey       |
                   | 5|  Magenta
|
|_|_________|____|_____________| |__|________||1| Blue | 9 | Lt. Blue | | 6| Cyan ||_|_________|____|_____________| |__|________||2| Green | 10| Lt. Green | | 7| White ||_|_________|____|_____________| |__|________||3| Cyan | 11| Lt. Cyan | |__|_________|____|_____________| | 4| Red | 12| Lt. Red | |__|_________|____|_____________| | 5| Magenta| 13| Lt. Magenta| |__|_________|____|_____________| | 6| Brown | 14| Yellow | |__|_________|____|_____________| | 7| White | 15| Lt. White | |__|_________|____|_____________| Note that for character attributes 30-37, the color selected for foreground will depend on whether the bold intensity attribute (1) is currently on. If not, the first color listed will result; otherwise the second color listed will result. Similarly, for character attributes 40-47, the color selected for background will depend on whether the blink attribute (5) is currently on. If the blink attribute is not on, then the first color listed will Rev. 1.3 Page 6


          display(7)           INTERACTIVE UNIX System           display(7)



                    result.  If the blink attribute is on, then the second
                    color listed will result.

             Ioctl Calls
               The following ioctl calls can be used to change the display
               used for the video monitor:

               SWAPMONO
                    This call selects the monochrome adapter as the output
                    device for the system console.

               SWAPCGA
                    This call selects the color/graphics adapter as the
                    output device for the system console.

               SWAPEGA
                    This call selects the enhanced graphics adapter as the
                    output device for the system console.

               SWAPVGA
                    This call selects the video graphics array adapter as
                    the output device for the system console.

               The following ioctl call may be used to obtain more informa-
               tion about the display adapter currently attached to the
               video monitor:

               CONS_CURRENT
                    This call returns the display adapter type currently
                    attached to the video monitor.  The return value can be
                    one of:  MONO, CGA, EGA, or VGA.

               The following ioctl calls may be used to switch display
               modes on the various video adapters:

               SW_B40x25
                    This call selects 40x25 (40 columns by 25 rows) black
                    and white text display mode.  It is valid only for CGA,
                    EGA, and VGA devices.

               SW_C40x25
                    This call selects 40x25 (40 columns by 25 rows) color
                    text display mode.  It is valid only for CGA, EGA, and
                    VGA devices.

               SW_B80x25
                    This call selects 80x25 (80 columns by 25 rows) black
                    and white text display mode.  It is valid only for CGA,
                    EGA, and VGA devices.

               SW_C80x25
                    This call selects 80x25 (80 columns by 25 rows) color
                    text display mode.  It is valid only for CGA, EGA, and


          Rev. 1.3                                                   Page 7





          display(7)           INTERACTIVE UNIX System           display(7)



                    VGA devices.

               SW_BG320
                    This call selects 320x200 black and white graphics
                    display mode.  It is valid only for CGA, EGA, and VGA
                    devices.

               SW_CG320
                    This call selects 320x200 color graphics display mode.
                    It is valid only for CGA, EGA, and VGA devices.

               SW_BG640
                    This call selects 640x200 black and white graphics
                    display mode.  It is valid only for CGA, EGA, and VGA
                    devices.

               SW_CG320_D
                    This call selects EGA support for 320x200 graphics
                    display mode (EGA mode D).  It is valid only for EGA
                    and VGA devices.

               SW_CG640_E
                    This call selects EGA support for 640x200 graphics
                    display mode (EGA mode E).  It is valid only for EGA
                    and VGA devices.

               SW_EGAMONOAPA
                    This call selects EGA support for 640x350 graphics
                    display mode (EGA mode F).  It is valid only for EGA
                    and VGA devices.

               SW_ENH_MONOAPA2
                    This call selects EGA support for 640x350 graphics
                    display mode with extended memory (EGA mode F*).  It is
                    valid only for EGA and VGA devices.

               SW_CG640x350
                    This call selects EGA support for 640x350 graphics
                    display mode (EGA mode 10).  It is valid only for EGA
                    and VGA devices.

               SW_ENH_CG640
                    This call selects EGA support for 640x350 graphics
                    display mode with extended memory (EGA mode 10*).  It
                    is valid only for EGA and VGA devices.

               SW_EGAMONO80x25
                    This call selects EGA monochrome text display mode (EGA
                    mode 7), which emulates support provided by the mono-
                    chrome adapter.  It is valid only for EGA and VGA
                    devices.

               SW_ENHB40x25


          Rev. 1.3                                                   Page 8





          display(7)           INTERACTIVE UNIX System           display(7)



                    This call selects enhanced 40x25 black and white text
                    display mode.  It is valid only for EGA and VGA
                    devices.

               SW_ENHC40x25
                    This call selects enhanced 40x25 color text display
                    mode.  It is valid only for EGA and VGA devices.

               SW_ENHB80x25
                    This call selects enhanced 80x25 black and white
                    display mode.  It is valid only for EGA and VGA
                    devices.

               SW_ENHC80x25
                    This call selects enhanced 80x25 color text display
                    mode.  It is valid only for EGA and VGA devices.

               SW_ENHB80x43
                    This call selects enhanced 80x43 black and white text
                    display mode.  It is valid only for EGA and VGA
                    devices.

               SW_ENHC80x43
                    This call selects enhanced 80x43 color text display
                    mode.  It is valid only for EGA and VGA devices.

               SW_MCAMODE
                    This call reinitializes the monochrome adapter.  It is
                    valid only for monochrome adapters.

               SW_VGA_B132x25
                    This call selects enhanced 132x25 black and white text
                    display mode.  It is valid only on Sigma VGA/H adapters
                    with 132 column support.

               SW_VGA_C132x25
                    This call selects enhanced 132x25 color text display
                    mode.  It is valid only on Sigma VGA/H adapters with
                    132 column support.

               SW_VGA_B132x43
                    This call selects enhanced 132x43 black and white text
                    display mode.  It is valid only on Sigma VGA/H adapters
                    with 132 column support.

               SW_VGA_C132x43
                    This call selects enhanced 132x43 color text display
                    mode.  It is valid only on Sigma VGA/H adapters with
                    132 column support.






          Rev. 1.3                                                   Page 9





          display(7)           INTERACTIVE UNIX System           display(7)



               SW_VGAMONOAPA
                    This call selects VGA support for 640x350 monochrome
                    graphics display support (VGA mode F+).  It is valid
                    only for VGA devices.

               SW_VGA_CG640
                    This call selects VGA support for 640x350 color graph-
                    ics display support (VGA mode 10+).  It is valid only
                    for VGA devices.

               SW_VGA_B40x25
                    This call selects VGA support for VGA 40x25 (40 columns
                    by 25 rows) black and white text display mode.  It is
                    valid only for VGA devices.

               SW_VGA_C40x25
                    This call selects VGA support for VGA 40x25 (40 columns
                    by 25 rows) color text display mode.  It is valid only
                    for VGA devices.

               SW_VGAB80x25
                    This call selects VGA support for VGA 80x25 (80 columns
                    by 25 rows) black and white text display mode.  It is
                    valid only for VGA devices.

               SW_VGAC80x25
                    This call selects VGA support for VGA 80x25 (80 columns
                    by 25 rows) color text display mode.  It is valid only
                    for VGA devices.

               SW_VGAMONO80x25
                    This call selects VGA monochrome text display mode (VGA
                    mode 7+).  It is valid only for VGA devices.

               SW_BG640x480
                    This call selects VGA 640x480 black and white graphics
                    display mode (VGA mode 11).  It is valid only for VGA
                    devices.

               SW_CG640x480
                    This call selects VGA 640x480 color graphics display
                    mode (VGA mode 12).  It is valid only for VGA devices.

               SW_VGA_CG320
                    This call selects VGA 320x200 color graphics display
                    mode (VGA mode 13).  It is valid only for VGA devices.

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

               The following ioctls may be used to obtain information about
               the current display modes:



          Rev. 1.3                                                  Page 10





          display(7)           INTERACTIVE UNIX System           display(7)



               CONS_GET
                    This call returns the current display mode setting for
                    whatever display adapter is being used.  Possible
                    return values include:

                    DM_B40x25 (0), black and white 40 columns.  CGA and EGA
                    only.

                    DM_C40x25 (1), color 40 columns.  CGA and EGA only.

                    DM_B80x25 (2), black and white 80 columns.  CGA and EGA
                    only.

                    DM_C80x25 (3), color 80 columns.  CGA and EGA only.

                    DM_BG320 (4), black and white graphics 320x200.  CGA
                    and EGA only.

                    DM_CG320 (5), color graphics 320x200.  CGA and EGA
                    only.

                    DM_BG640 (6), black and white graphics 640x200 high-
                    resolution.  CGA and EGA only.

                    DM_EGAMONO80x25 (7), EGA-mono 80x25.  EGA only.

                    DM_ENH_B80x43 (10), EGA enhanced black and white 80x43.

                    DM_ENH_C80x43 (11), EGA enhanced color 80x43.

                    DM_CG320_D (13), EGA mode D.

                    DM_CG640_E (14), EGA mode E.

                    DM_EGAMONOAPA (15), EGA mode F.

                    DM_CG640x350 (16), EGA mode 10.

                    DM_ENHMONOAPA2 (17), EGA mode F with extended memory.

                    DM_ENH_CG640 (18), EGA mode 10*.

                    DM_ENH_B40x25 (19), EGA enhanced black and white 40
                    columns.

                    DM_ENH_C40x25 (20), EGA enhanced color 40 columns.

                    DM_ENH_B80x25 (21), EGA enhanced black and white 80
                    columns.

                    DM_ENH_C80x25 (22), EGA enhanced color 80 columns.

                    DM_VGA_C40x25 (23), VGA color 40x25.


          Rev. 1.3                                                  Page 11





          display(7)           INTERACTIVE UNIX System           display(7)



                    DM_VGA_C80x25 (24), VGA color 80x25.

                    DM_VGAMONO80x25 (25), VGA mode 7+.

                    DM_BG640x480 (26), VGA black and white graphics 640x480
                    (VGA mode 11).

                    DM_CG640x480 (27), VGA color graphics 640x480 (VGA mode
                    12).

                    DM_VGA_CG320 (28), VGA color graphics 320x200 (VGA mode
                    13).

                    DM_VGA_B40x25 (29), VGA black and white 40x25.

                    DM_VGA_B80x25 (30), VGA black and white 80x25.

                    DM_VGAMONOAPA (31), VGA mode F+.

                    DM_VGA_CG640 (32), VGA mode 10+.

                    DM_VGA_B132x25 (35), VGA enhanced black and white
                    132x25.

                    DM_VGA_C132x25 (36), VGA enhanced color 132x25.

                    DM_VGA_B132x43 (37), VGA enhanced black and white
                    132x43.

                    DM_VGA_C132x43 (38), VGA enhanced color 132x43.

                    M_MCA_MODE (0xff), monochrome adapter mode.

               MCA_GET
                    This call returns the current display mode setting of
                    the monochrome adapter.  See CONS_GET for a list of
                    return values.  If the monochrome adapter is not
                    installed, the call will fail and erno will be set to
                    22 (EINVAL).

               CGA_GET
                    This call returns the current display mode setting of
                    the color/graphics adapter.  See CONS_GET for a list of
                    return values.  If the color graphics adapter is not
                    installed, the call will fail and erno will be set to
                    22 (EINVAL).

               EGA_GET
                    This call returns the current display mode setting of
                    the enhanced graphics adapter.  See CONS_GET for a list
                    of return values.  If the enhanced graphics adapter is
                    not installed, the call will fail and erno will be set
                    to 22 (EINVAL).


          Rev. 1.3                                                  Page 12





          display(7)           INTERACTIVE UNIX System           display(7)



               VGA_GET
                    This call returns the current display mode setting of
                    the video graphics array adapter.  See CONS_GET for a
                    list of return values.  If the video graphics array
                    adapter is not installed, the call will fail and erno
                    will be set to 22 (EINVAL).

               The following ioctl calls may be used to map the video
               adapter's memory into the user's data space:

               MAPCONS
                    This call maps the display memory of the adapter
                    currently being used into the user's data space.

               MAPMONO
                    This call maps the monochrome adapter's display memory
                    into the user's data space.

               MAPCGA
                    This call maps the color/graphics adapter's display
                    memory into the user's data space.

               MAPEGA
                    This call maps the enhanced graphics adapter's display
                    memory into the user's data space.

               MAPVGA
                    This call maps the video graphics array adapter's
                    display memory into the user's data space.

               You can use ioctl calls to input a byte from the graphics
               adapter port or to output a byte to the graphics adapter
               port.  The argument to the ioctl uses the port_io_arg data
               structure:
                 struct port_io_arg {
                      struct port_io_struc_args[4];
                 };

               As shown in the previous example, the port_io_arg structure
               points to an array of four port_io_struc data structures.
               The port_io_struc has the following format:
                 struc port_io_struc {
                      char dir;      /* direction flag (in vs. out) */
                      unsigned short port;/* port address */
                      char data;     /* byte of data */
                 };

               You can specify one, two, three, or four of the
               port_io_struc structures in the array for one ioctl call.
               The value of dir can be either IN_ON_PORT (to specify a byte
               being input from the graphics adapter port) or OUT_ON_PORT
               (to specify a byte being output to the graphics adapter
               port).  Port is an integer specifying the port address of


          Rev. 1.3                                                  Page 13





          display(7)           INTERACTIVE UNIX System           display(7)



               the desired graphics adapter port.  Data is the byte of data
               being input or output as specified by the call.  If you are
               not using any of the port_io_struc structures, load the port
               with 0, and leave the unused structures at the end of the
               array.  Refer to your hardware manuals for port addresses
               and functions for the various adapters.

               The following ioctl calls may be used to input or output
               bytes on the graphics adapter port:

               MCAIO   This call inputs or outputs a byte on the monochrome
                       adapter port as specified.

               CGAIO   This call inputs or outputs a byte on the
                       color/graphics adapter port as specified.

               EGAIO   This call inputs or outputs a byte on the enhanced
                       graphics adapter port as specified.

               VGAIO   This call inputs or outputs a byte on the video
                       graphics array adapter port as specified.

               To input a byte on any of the graphics adapter ports, load
               dir with IN_ON_PORT and load port with the port address of
               the graphics adapter.  The byte input from the graphics
               adapter port will be returned in data.

               To output a byte, load dir with OUT_ON_PORT, load port with
               the port address of the graphics adapter, and load data with
               the byte you want to output to the graphics adapter port.

               The following ioctls can be used with either the monochrome,
               color graphics, or enhanced graphics adapters:

               KDDISPTYPE
                    This call returns display information to the user.  The
                    argument expected is the buffer address of a structure
                    of type kd_disparam into which display information is
                    returned to the user.  The kd_disparam structure is
                    defined as follows:
                    struct kd_disparam {
                     long type;         /* display type */
                     char *addr;        /* display memory address */
                     ushort ioaddr[MKDIOADDR];/* valid I/O addresses */
                    }

                    Possible values for the type field include:


                    KD_MONO (0x01) IBM monochrome display adapter
                    KD_HERCULES (0x02)Hercules monochrome graphics adapter
                    KD_CGA (0x03)  IBM color graphics adapter
                    KD_EGA (0x04)  IBM enhanced graphics adapter


          Rev. 1.3                                                  Page 14





          display(7)           INTERACTIVE UNIX System           display(7)



                    KD_VGA (0x05)  VGA adapter

                    The addr member indicates the physical address of the
                    display.  It will be one of:


                    MONO_BASE      0xb0000
                    COLOR_BASE     0xb8000
                    EGA_BASE       0xa0000

                    The ioaddr member contains the global keyboard/display
                    port list that is used for direct ins and outs to the
                    screen.  When using a VGA display, the result of a
                    KDISPTYPE ioctl is the same as with an EGA display.

               KIOCSOUND
                    This call starts the sound generation.  It turns on
                    sound.  The argument is the inverse frequency desired.
                    A value of 0 turns off the sound.

               KDGETLED
                    This call gets the keyboard LED status.  The argument
                    is a pointer to a character.  The character will be
                    filled with a boolean combination of the following
                    values:
                        LED_SCR      0x01(flag bit for scroll lock)
                        LED_CAP      0x04(flag bit for caps lock)
                        LED_NUM      0x02(flag bit for num lock)

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

               KDMKTONE
                    This call generates a fixed length tone.  The argument
                    is a 32-bit value, with the lower 16 bits set to the
                    inverse frequency and the upper 16 bits set to the
                    duration (in milliseconds).

               KDGKBTYPE
                    This call gets keyboard type.  The argument is a
                    pointer to a character type.  The character will be
                    returned with one of the following values:
                        KB_84        0x01(84-key keyboard)
                        KB_101       0x02(101-key keyboard)
                        KB_OTHER     0x03

               KDADDIO
                    This call adds the I/O port address to the list of
                    valid video adapter addresses.  Argument is an unsigned
                    short type which should contain a valid port address
                    for the installed video adapter.


          Rev. 1.3                                                  Page 15





          display(7)           INTERACTIVE UNIX System           display(7)



               KDDELIO
                    This call deletes the I/O port address from the list of
                    valid video adapter addresses.  Argument is an unsigned
                    short type which should contain a valid port address
                    for the installed video adapter.

               KDENABIO
                    This call enables ins and outs to video adapter ports.
                    No argument.

               KDDISABIO
                    This call disables ins and outs to video adapter ports.
                    No argument.

               KDSBORDER
                    This call sets the screen color border in EGA text
                    mode.  The argument is of type character.  Each bit
                    position corresponds to a color selection.  From bit
                    position 0 to bit position 6, the color selections are
                    respectively blue, green, red, secondary blue, secon-
                    dary green, and secondary red.  Setting the bit posi-
                    tion to a logic one will select the desired color or
                    colors.

               KDSCROLL
                    This call is used to set the hardware scrolling feature
                    to be on or off.  Most CGA, EGA, and VGA displays pro-
                    vide hardware-assisted scrolling for better output per-
                    formance.  The default is hardware scrolling turned
                    off.  A nonzero argument enables scrolling; a zero
                    argument disables it.

               KDSETMODE
                    This call sets the mode of the display driver to the
                    integer argument given.  The modes that may be speci-
                    fied are:
                        KD_TEXT0     0x00
                        KD_GRAPHICS  0x01
                        KD_TEXT1     0x02
                    KD_TEXT is a synonym for KD_TEXT0.

                    KD_TEXT0 indicates that all text on the display must be
                    written with the write system call.  The display will
                    automatically be saved and restored on ``hot key''
                    screen switches.  Upon leaving KD_TEXT0 mode, the
                    display contents will be saved; upon returning to
                    KD_TEXT0 mode, the display will be restored from the
                    saved display.  KD_TEXT1 works in the same manner as
                    KD_TEXT0, except that the display is not restored when
                    the user returns to KD_TEXT1 mode.





          Rev. 1.3                                                  Page 16





          display(7)           INTERACTIVE UNIX System           display(7)



                    KD_GRAPHICS mode indicates that the user will have
                    direct control of the display.  It will be necessary to
                    map in the display using the KDMAPDISP ioctl subsequent
                    to setting KD_GRAPHICS mode to store characters
                    directly onto the display.  In this mode, all writes to
                    the display using the write system call are ignored.
                    In KD_GRAPHICS mode, the user is responsible for saving
                    and restoring the display on ``hot key'' switches.
                    This requires that the virtual terminal must be in pro-
                    cess (VT_PROCESS) mode prior to setting KD_GRAPHICS
                    mode.

                    In KD_GRAPHICS mode, there will not necessarily be
                    graphics on the display.  When setting KD_TEXT0 or
                    KD_TEXT1 mode, the ioctl will fail if the display is
                    mapped in [EIO].  When setting KD_GRAPHICS mode, the
                    ioctl will fail if the virtual terminal is not in pro-
                    cess (VT_PROCESS) mode [EACCES].

               KDGETMODE
                    This call gets the current mode of the console.  It
                    returns an integer argument containing KD_TEXT,
                    KD_TEXT1, or KD_GRAPHICS as defined in the KDSETMODE
                    ioctl description.

               KDMAPDISP
                    This call allows one to have direct access to the
                    display and I/O ports.  It is especially useful in pro-
                    viding a way to do nonportable but fast graphics on the
                    display.  The following structure, defined in
                    <sys/kd.h>, is pointed to by the argument to the ioctl:


                    struct kd_memloc {
                     char  *vaddr; /* virtual address to map to*/
                     char  *physaddr;/* physical address to map from */
                     long  length; /* size in bytes to map */
                     long  ioflg;  /* enable I/O addresses if non-zero */
                    };

                    The vaddr argument is the linear address in the process
                    where the display buffer will appear.  This address
                    must be on a page (4K byte) boundary.  The physaddr
                    argument is the physical address of the screen.  It
                    must be between 0xA0000 and 0xC0000.  It must also be
                    on a page boundary.  The length argument is the size of
                    the display buffer that will be mapped in.  It must be
                    a multiple of 4K bytes.  The ioflg argument tells
                    whether (1) or not (0) to enable the global
                    keyboard/display ports for direct access to the I/O
                    ports similar to the KDENABIO and KDDISABIO ioctl.

                    The memory that had existed at address vaddr for length


          Rev. 1.3                                                  Page 17





          display(7)           INTERACTIVE UNIX System           display(7)



                    bytes will be irretrievably deleted, and the current
                    contents of the display buffer will be placed at those
                    locations.  It is necessary for the virtual terminal to
                    be in process (VT_PROCESS) mode and for the display
                    device to be in KD_GRAPHICS mode.  One way of allocat-
                    ing the virtual memory in the user's address space that
                    will be mapped to the screen is to call malloc request-
                    ing (length + 4096) bytes.  Then using the address that
                    malloc returns, round it up to the next page (4K byte)
                    boundary and use the result as vaddr.

                    The ioctl will fail if the virtual terminal is not in
                    process mode or if the display is not in KD_GRAPHICS
                    mode [EACCES].  It will fail if any of the arguments
                    are out of range or not properly aligned [EFAULT].  It
                    will fail if the display is already mapped to [EIO].

               KDUNMAPDISP
                    This call unmaps the direct access to the display and
                    disables the direct usage of the I/O ports.  The map
                    must have been set up with KDMAPDISP by the current
                    process.  The memory where the display had been becomes
                    zeroes.  The ioctl will fail if the current process is
                    not the one that did the mapping [EACCES].

               VT_OPENQRY
                    This call finds 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.

               VT_GETMODE
                    This call determines what mode the active virtual ter-
                    minal is currently in, either VT_AUTO or VT_PROCESS.
                    The argument to the ioctl is the address of the follow-
                    ing type of structure:
                    struct vt_mode {
                     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;/* signal to use for forced release */
                     }

                    #define VT_AUTO   0x00/* automatic VT switching */
                    #define VT_PROCESS0x01/* process controls switching */
                    The vt_mode structure will be filled in with the
                    current value for each field.

               VT_SETMODE
                    Set the virtual terminal mode.  The argument is a
                    pointer to a vt_mode structure, as defined above.


          Rev. 1.3                                                  Page 18





          display(7)           INTERACTIVE UNIX System           display(7)



               VT_RELDISP
                    This call is 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.

               VT_ACTIVATE
                    This call 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 hot-
                    key 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.

               GIO_SCRNMAP
                    This call gets the screen mapping table from the ker-
                    nel.

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

                    Bit 0 determines underlining for black and white moni-
                    tors (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=blink 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).

               GIO_COLOR
                    This call returns a non-zero value if the current
                    display is a color display; otherwise, it returns a
                    zero.



          Rev. 1.3                                                  Page 19





          display(7)           INTERACTIVE UNIX System           display(7)



               PIO_SCRNMAP
                    This call puts the screen mapping table in the kernel.

               The screen mapping table maps extended ASCII (8-bit) charac-
               ters to ROM characters.  It is an array [256] of char
               (typedef scrnmap_t) 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 program will cause the ASCII
               character # to be displayed as an English pound sign:

                   #include <sys/types.h>
                   #include <sys/at_ansi.h>
                   #include <sys/kd.h>
                   main() {
                   scrnmap_t scrntab;
                       /* get screen mapping table of standard output */
                   if (ioctl(0,GIO_SCRNMAP, scrntab)==-1)
                       {
                       perror("screenmap read");
                       exit(-1);
                       }
                   /* 156 is the ROM value of English pound sign and 30
                       is the ASCII value of `#'.
                   */
                   scrntab[30] = 156;
                   if (ioctl(0, PIO_SCRNMAP, scrntab) == -1)
                       {
                       perror("screenmap write");
                       exit(-1);
                       }
                   }

          FILES
               /dev/console
               /dev/vt00-n
               /usr/include/sys/kd.h

          SEE ALSO
               stty(1), console(7), keyboard(7), termio(7).
               ioctl(2) in the INTERACTIVE SDS Guide and Programmer's
               Reference Manual.

          WARNINGS
               Although it is possible to write character sequences which
               set arbitrary bits on the screen in any of the three graph-
               ics modes, this mode of operation is not currently sup-
               ported.

               It is currently not possible to access the 6845 start
               address registers.  Thus, it is impossible to determine the
               beginning of the color monitor's screen memory.


          Rev. 1.3                                                  Page 20





          display(7)           INTERACTIVE UNIX System           display(7)



               The alternate/background color bit (bit 4) of the color
               select register does not appear to affect background colors
               in alphanumeric modes.

               The low-resolution graphics mode appears to be 80 across by
               100 down.

          ADDED VALUE
               This entry, supplied by INTERACTIVE Systems Corporation,
               contains enhancements to UNIX System V.













































          Rev. 1.3                                                  Page 21



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