SCREEN(HW) XENIX System V SCREEN(HW)
Name
screen - tty[01-n], color, monochrome, ega, pga
- Display adapter and video monitor.
Description
The tty[01-n] device files provide character I/O between the
system and the video display monitor and keyboard. Each
file corresponds to a separate teletype device. Although
there is a maximum of 10 screens, the exact number available
(n) depends upon the amount of memory in the computer.
Each device consists of two files: a readable file from the
keyboard and a writable file to one of five display devices:
color, monochrome, ega, and pga. The color file provides
access to a color/graphics adapter; the monochrome file to
the monochrome adapter; the ega file to the enhanced
graphics adapter; the pga file to the professional graphics
adapter. The screens are modeled after a 24 line, 80 column
ASCII terminal, unless specified otherwise.
tty01 is the default output device for keyboard input. If
the /dev/console is the default output device for system
error messages, and the display being used is switched to
graphics mode, console messages are not displayed. They
are, instead, redirected to the kernel error handler where
they can then be retrieved by the application which took
over the screen.
Although all tty[01-n] devices may be open concurrently,
only one of the corresponding devices can be active at any
given time. The active device displays its own screen and
takes sole possession of the keyboard. It is an error to
attempt to access the color, monochrome, ega or pga file
when no corresponding adapter exists.
To get to the next consecutive screen, enter Ctrl-PrtSc
using the Ctrl key, and the PrtSc key. Any active screen
may be selected by entering alt-Fn, where Fn is one of the
function keys. F1 refers to the tty01 device.
Control Modes
To change the display mode used for the video monitor, open
the device file associated with that mode. For example, to
switch to display output on an installed CGA, a program
should open /dev/color and use the selector mapping ioctl s
on the file descriptor that is returned from the open call.
Using device files helps ensure future compatibility.
Programs can also use the stty(C) or stty(HW) commands, or
Page 1 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
an ioctl(S) with the following requests:
SWAPMONO Selects the monochrome display as
the output device for the video
monitor.
SWAPCGA Selects the regular color display
as the output device for the video
monitor.
SWAPPGA Selects the professional color
display as the output device for
the video monitor.
SWAPEGA Selects the enhanced color display
as the output device for the video
monitor.
To obtain information about the display adapter type
currently attached to the video monitor, you can use
ioctl(S) with the following request:
CONS_CURRENT Returns the display adapter type
currently attached to the video
monitor. The return value can be
one of: MONO, CGA, EGA, or PGA.
Display Modes
To switch display modes on the various display devices, you
can use the stty(C) or stty(HW) commands, or you can use
ioctl(S) with the following requests:
SW_B80x25 Selects 80x25 black and white text
display mode.
SW_C80x25 Selects 80x25 color text display
mode.
SW_BG320 Selects 320x200 black and white
graphics display mode.
SW_CG320 Selects 320x200 color graphics
display mode.
SW_BG640 Selects 640x200 black and white
graphics display mode.
Page 2 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
SW_EGAMONO80x25 Selects EGA (Enhanced Graphics
Adapter) mode 7 - emulates support
provided by the monochrome display.
SW_EGAMONOAPA Selects EGA support for 640x350
graphics display mode (EGA mode F).
SW_ENHMONOAPA2 Selects EGA mode F*.
SW_ENHB40x25 Selects enhanced EGA support for
40x25 black and white text display
mode.
SW_ENHC40x25 Selects enhanced EGA support for
the 40x25 color text display mode.
SW_ENHB80x25 Selects enhanced EGA support for
80x25 black and white text display
mode.
SW_ENHC80x25 Selects enhanced EGA support for
80x25 color text display mode.
SW_CG320_D Selects EGA support for 320x200
graphics display mode. (EGA mode
D.)
SW_CG640_E Selects EGA support for 640x200
graphics display mode (EGA mode E).
SW_CG640x350 Selects EGA support for 640x350
graphics display mode (EGA mode
10).
SW_ENH_CG640 Selects EGA mode 10*.
SW_MCAMODE Reinitializes the monochrome
adapter.
Switching to an invalid display mode for a display device
will result in an error.
Getting Display Modes
Page 3 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
To obtain information about the current display modes, you
can use ioctl(S) with the requests that follow. These apply
to the color graphics adapter, the enhanced graphics adapter
or the professional graphics adapter:
CGA_GET Returns the current display mode
setting of the color graphics
adapter.
PGA_GET Returns the current display mode
setting of the professional
graphics adapter.
EGA_GET Returns the current display mode
setting of the enhanced graphics
adapter.
MCA_GET Returns the current display mode
setting of the monochrome adapter.
CONS_GET Returns the current display mode
setting for whatever display
adapter is being used.
Memory Mapping Modes
The ioctl(S) routine is used to map the display memory of
the various devices into the user's data space. It returns
a selector for the display memory. The macro sotofar is
used to create a far pointer from this selector so the
display memory can be accessed. The sotofar macro is
located in /usr/include/sys/param.h. Refer to your hardware
manual for details on various displays, adapters, and
controllers.
You can use ioctl(S) requests to map the display memory as
follows:
MAPCONS Maps the display memory of the
adaptor currently being used into
the user's data space. Not meant to
work with MAPPGA1K.
MAPMONO Maps the monochrome adapter's
display memory into the user's data
space.
MAPCGA Maps the color adapter's display
memory into the user's data space.
Page 4 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
MAPPGA Maps the professional graphics
controller's display memory into
the user's data space.
MAPEGA Maps the enhanced graphics
adapter's display memory into the
user's data space.
MAPPGA1K Maps the professional graphics
controller 1K communications fifos
(etc.) into the user's data space.
For example, the following code can be used to acquire a
pointer to the start of the user data space associated with
the color graphics adapter display memory:
char far *dp;
int selector;
.
.
.
fd=open ("/dev/color", O_WRONLY);
selector = ioctl (fd, MAPCGA,0);
dp = sotofar (selector, 0);
.
.
.
Note that when the display memory is mapped into the user
space, the adapter's start address registers are not set.
The start address can be reset in two ways, so that the
start address of the display memory corresponds to the upper
left hand corner of the screen:
1. Switch modes with an ioctl() (the
``switch'' can be to the present mode).
See the ``Display Modes'' section of
this manual page.
2. Change the start address high and low
address with the in-on-port/out-on-port
ioctl().
The in-on-port/out-on-port ioctl()'s can also be used to
determine the current value in the start address register,
and then set up a pointer to point to the offset in the
mapped-in data space.
Graphics Adapter Port I/O
You can use ioctl(S) to read or write a byte from or to the
graphics adapter port. The arg parameter of the ioctl call
Page 5 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
uses the io_arg data structure:
struct port_io_arg {
struct port_io_struct args[4];
};
As shown above, the io_arg structure points to an array of
four port_io data structures. The port_io structure has the
following format:
struct port_io_struct {
char dir; /* direction flag (in vs. out) */
unsigned_int port; /* port address */
char data; /* byte of data */
};
You may specify one, two, three, or four of the
port_io_struct structures in the array for one ioctl call.
The value of dir can be either IN_ON_PORT to specify a byte
being input to 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 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 structures, load the
port with 0, and leave the unused structures at the end of
the array. Refer to the hardware manuals for port addresses
and functions for the various adapters.
You can use the following ioctl(S) commands to input or
output a byte on the graphics adapter port:
MGAIO Inputs or outputs a byte on the
monochrome adapter port as
specified.
CGAIO Inputs or outputs a byte on the
color graphics adapter port as
specified.
EGAIO Inputs or outputs a byte on the
enhanced graphics adapter port as
specified.
PGAIO Inputs or outputs a byte on the
professional graphics adapter port
as specified.
To input a byte on any of the graphics adapter ports, load
Page 6 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
dir with IN_ON_PORT and load 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 output to the graphics adapter port.
Function Keys
ioctl(S) can be used to define or obtain the current
definition of a function key. The arg parameter of the
ioctl call uses the fkeyarg data structure: struct fkeyarg {
unasigned int keynum; char keydef [MAXFK];
/*Comes
from char flen; ioctl.h via comcrt.h */ } You can use
the following ioctl(S) requests to obtain or assign function
key defintions:
GETFKEY Obtains the current definition of a
function key. The function key
number must be passed in keynum.
The string currently assigned to
the key will be returned in keydef
and the length of the string will
be returned in flen when the ioctl
is performed.
SETFKEY Assigns a given string to a
function key. The function key
number must be passed in keydef and
the length of the string (number of
characters) must be passed in flen.
Screen Attribute Sequences
The following character sequences are defined by ANSI
X3.64-1979 and may be used to control and modify the screen
display. Each Pn is replaced by the appropriate ASCII
number (decimal) to produce the desired effect. The last
column is for termcap(M) codes, where means not applicable.
The use of 7 or 8 bit characters in the escape sequence is a
valid invocation for each action defined. For example the
ANSI ED command can be invoked via the "ESC [ Pn S" (0x1b-
0x5b-Pn-0x4a, 7 bit chars) sequence or the "CSI Pn J"
(0x9b-Pn-0x4n, 8 bit chars) sequence.
Page 7 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
ANSI Sequence Action Termcap
Code
_________________________________________________________________
ED ESC[Pn J Erases all or cd
(Erase in CSIPn J part of a
Display) display. Pn=0:
erases from
active position
to end of dis-
play. Pn=1:
erases from the
beginning of
display to
active
position.
Pn=2: erases
entire display.
EL ESC[Pn K Erases all or ce
(Erase in CSIPn K part of a line.
Line) Pn=0: erases
from active
position to end
of line. Pn=1:
erases from
beginning of
line to active
position.
Pn=2: erases
entire line.
ECH ESC[Pn X Erases Pn n/a
(Erase CSIPn X characters
Character)
CBT ESC[Pn Z Moves active bt
(Cursor CSIPn Z position back
Backward Pn tab stops.
Tabulation)
SU ESC[Pn S Scroll screen sf
(Scroll CSIPn S up Pn lines,
Up) introducing new
blank lines at
bottom.
Page 8 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
SD ESC[Pn T Scrolls screen sr
(Scroll CSIPn T down Pn lines,
Down) introducing new
blank lines at
top.
CUP ESC[P1;P2 H Moves active cm
(Cursor CSIP1;P2 H position to
Position) location P1
(vertical) and
P2
(horizontal).
HVP ESC[P1;P2 f Moves active n/a
(Horizontal CSIP1;P2 f position to
& Vertical location P1
Position) (vertical) and
P2
(horizontal).
CUU ESC[Pn A Moves active up (ku)
(Cursor Up) CSIPn A position up Pn
number of
lines.
CUD ESC[Pn B Moves active do (kd)
(Cursor CSIPn B position down
Down) Pn number of
lines.
CUF ESC[Pn C Moves active nd (kr)
(Cursor CSIPn C position Pn
Forward) spaces to the
right.
CUB ESC[Pn D Moves active bs (kl)
(Cursor CSIPn D position Pn
Backward) spaces back-
ward.
HPA ESC[Pn ` Moves active n/a
(Horizontal CSIPn ` position to
Position column given by
Absolute) Pn.
HPR ESC[Pn a Moves active n/a
(Horizontal CSIPn a position Pn
Position characters to
Relative) the right.
Page 9 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
VPA ESC[Pn d Moves active n/a
(Vertical CSIPn d position to
Position line given by
Absolute) Pn.
VPR ESC[Pn e Moves active n/a
(Vertical CSIPn e position down
Position Pn number of
Relative) lines.
IL ESC[Pn L Inserts Pn new, al
(Insert CSIPn L blank lines.
Line)
ICH ESC[Pn @ Inserts Pn ic
(Insert CSIPn @ blank places
Character) for Pn
characters.
DL ESC[Pn M Deletes Pn dl
(Delete CSIPn M lines.
Line)
DCH ESC[Pn P Deletes Pn dc
(Delete CSIPn P number of
Character) characters.
CPL ESC[Pn F Moves active n/a
(Cursor to CSIPn F position to
Previous beginning of
Line) line, Pn lines
up.
CNL ESC[Pn E Moves active n/a
(Cursor CSIPn E position to
Next beginning of
Line) line, Pn lines
down.
SGR ESC[0 m Resets bold, n/a
(Select CSI0 m blink, blank,
Graphic underscore, and
Rendition) reverse.
Color: Restores
normal selected
colors.
ESC[1 m Sets bold. n/a
CSI1 m Color: Sets
intensity
(changes color
to lt_color).
Page 10 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
ESC[2h Lock keyboard. n/a
Ignores
keyboard input
until unlocked.
Characters are
not saved.
ESC[2i Send screen to n/a
host. Current
screen contents
are sent to the
application.
ESC[2l Unlock n/a
keyboard. Re-
enable keyboard
input.
ESC[4 m Sets n/a
CSI4 m underscore.
Color: No
effect.
ESC[5 m Sets blink. n/a
CSI5 m Color: Changes
background
lt_color to
color;
foreground
blinks.
ESC[7 m Sets reverse so
CSI7 m video. Color:
Uses reverse
selected
colors.
ESC[10 m Selectprimaryfont. GE
CSI10 m
ESC[11 m Select first n/a
CSI11 m alternate font.
Allows ASCII
characters less
than 32 to be
displayed as
ROM characters.
Page 11 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
ESC[12 m Select second GS
CSI12 m alternate font.
Toggles high
bit of extended
ASCII code
before dis-
playing as ROM
characters.
The following color codes and sequences are defined by
International Organization for Standardization ISO DP 6429.
_____________
| C Color |
|____________|
| 0 Black |
| 1 Red |
| 2 Green |
| 3 Yellow |
| 4 Blue |
| 5 Magenta|
| 6 Cyan |
| 7 White |
|____________|
Page 12 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
ISO Sequence Action Termcap
Code
_________________________________________________
SGR ESC[3Cm Color: Selects n/a
(Select foreground
Graphic color C.
Rendition)
ESC[4Cm Color: Selects n/a
background
color C.
ESC[8m Sets blank n/a
(non-display).
The following color codes and sequences are additional
control sequences.
_________________________________
| Cn Color | Cn Color |
|_____________|__________________|
| 0 Black | 8 Grey |
| 1 Blue | 9 Lt. Blue |
| 2 Green | 10 Lt. Green |
| 3 Cyan | 11 Lt. Cyan |
| 4 Red | 12 Lt. Red |
| 5 Magenta| 13 Lt. Magenta|
| 6 Brown | 14 Yellow |
| 7 White | 15 Lt. White |
|_____________|__________________|
Termcap
Name Sequence Action Code
_________________________________________________________________
SGR ESC[2;C1;C2 m Color only. n/a
Sets foreground
(C1) and
background (C2)
colors.
SGR ESC[7;C1;C2 m Reverse video. n/a
Color: Sets
foreground (C1)
and background
(C2) reverse
video colors.
SGR ESC[3;0 m Color only. n/a
Clears blink bit.
Page 13 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
SGR ESC[3;1 m Color only. n/a
Sets blink bit.
SGR ESC[4 m Underscores. n/a
Color: No effect
n/a ESC[=Ss;SeC Sets cursor to n/a
start at scan
line Ss, and
ends at scan
line Se.
Default
underline
cursor is 6,7
for color
adaptor and
11,12 for
monochrome.
n/a ESC[=CA where C is 0- n/a
15. Sets
border color on
color adaptors.
Color codes are
same as for
ESC[2;C1;C2m.
n/a ESC[Png Accesses n/a
alternate
graphics set.
Not the same as
``graphics mode.''
Refer to your
owner's manual
for
decimal/character
codes (Pn) and
possible output
characters.
n/a ESCQFn'string ' Define function n/a
key Fn with
string. String
delimiters
' and ' may be
any character
not in string.
Function keys
are numbered 0
through 9 (F1 =
0, F2 = 1,
etc.).
Page 14 (printed 8/7/87)
SCREEN(HW) XENIX System V SCREEN(HW)
n/a ESC[Pnz Pn should be n/a
CSIPnz equal to the
number of the
screen to
switch to.
Will only work
if screen was
configured for
at boot, else
no action will
take place.
n/a ESC[=F;TB Sets bell n/a
frequency and
duration. F is
the value
loaded into the
timer-counter,
and T is the
bell duration
in 1/10ths of a
second (initial
settings are
1500 and
2/10ths of a
second).
Files
/dev/console
/dev/tty[02 -n]
/dev/color
/dev/monochrome
/dev/ega
/dev/pga
See Also
console(M), ioctl(S), keyboard(HW), keymap(M), mapkey(M),
mapchan(M), multiscreen(M), setcolor(C), stty(C), systty(M),
termcap(M), tty(M)
Page 15 (printed 8/7/87)