|
|
The system console device can be either a terminal (a serial adapter device, tty1a) or a system keyboard display adapter monitor (tty01).
/dev/console is the device used by the system administrator for system maintenance (single-user) operations. It is the tty to which the first default shell is attached.
System error messages from the kernel are written to /dev/console, which is normally the current multiscreen. If /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.
When the video device returns to text mode, a notice message is displayed and the text of the kernel error can be recovered from /usr/adm/messages.
Initially, /dev/console is linked to /dev/systty. The actual physical device accessed via /dev/systty is selected during boot, and is typically the device used to control the bootup procedure. The default physical device /dev/systty is determined by boot(HW) when the system is brought up.
/dev/syscon is the system console device used by init. See init(M) for more information.
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 vga file when no corresponding adapter exists or no multiscreens are associated with it.
To get to the next consecutive console screen, enter <Ctrl><PrtSc>. Any active screen may be selected by entering <Alt><Fn> (or <Ctrl><Alt><Fn> when running in a graphical environment), where <Fn> is one of the function keys. For example, <F1> refers to the tty01 device.
Code examples are included in the section ``Examples'' in screen(HW) to help programmers use the ioctl(S) calls documented here.
For example, the red, green, and blue intensities for the
nth color map entry are represented by the values
of the array members n
3, n
3+1, and
n
3+2 respectively.
The argument arg to ioctl should point to an array of 192 unsigned characters. This array may be used to read the existing color map, or to set a new color map.
struct vid_info
{
short size; /* must be first field */
short m_num; /* multiscreen number, 0 based */
ushort mv_row, mv_col; /* cursor position */
ushort mv_rsz, mv_csz; /* text screen size */
struct colors mv_norm, /* normal attributes */
mv_rev, /* reverse video attributes */
mv_grfc; /* graphic character attributes */
uchar_t mv_ovscan; /* border color */
uchar_t mk_keylock; /* caps/num/scroll lock */
};
struct m6845_info
{
short size; /* must be first field */
ushort screen_top; /* offset of screen in video */
ushort cursor_type; /* cursor shape */
};
This is often used to map the low font values that normally correspond to ASCII control values to higher ASCII values, thus displaying the desired ROM characters.
Note that the MAP
ioctls map the memory associated with
the current mode. You must put the adapter into the desired
mode before performing mapping, or the pointers returned
will not be appropriate.
Refer to your hardware manual for details
on various displays, adapters, and controllers.
These ioctl requests can be used to map the display memory:
char *dp; int retval; . . . /* fd is a file descriptor for a multiscreen device */ retval = ioctl (fd, MAPCONS,0L); dp = (char *) retval; . . .Note that when the display memory is mapped into the user space, the adapter's m6845 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:
vidclasslist[].
For example:
char * ioctl(fd, MAP_CLASS, video_class_name) char *video_class_name;This returns a pointer to the frame buffer. See /etc/conf/pack.d/cn/class.h for descriptions of the existing classes. Note that the link kit must be installed in order to find this file. (The class.h file is normally generated by mkdev graphics.)
A process' I/O privilege level can be set, allowing for the
faster execution of I/O instructions with the
sysi86(S)
subfunction V86SC_IOPL:
sysi86 (SI86V86, V86SC_IOPL, 0x3000)
This sets the I/O privilege to 3 as described above. Only the superuser can do this.
struct kd_disparam
{
long type; /* display type */
char *addr; /* display memory address */
}
Possible values for the type field include:
KD_MONO for the IBM monochrome display adapter
KD_HERCULES for the Hercules monochrome graphics adapter
KD_CGA for the IBM color graphics adapter
KD_EGA for the IBM enhanced graphics adapter
KD_VGA for the IBM video graphics adapter
struct kd_dispinfo{
char *vaddr; /* memory address */
paddr_t physaddr; /* memory address */
unsigned long size; /* memory size */
}
Note, the user is responsible for programming the color/graphics adapter registers for the appropriate graphical state.
struct vt_mode {
char mode; /* VT mode */
char waitv; /* if !=0, vt hangs 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_PROCESS 0x01 /* process controls
switching */
The vt_mode structure will be filled in with the current
value for each field.
struct port_io_arg {
struct port_io_struct args[4];
};
As shown above, the port_io_arg structure points to an array of four
port_io_struct data structures. The port_io_struct
structure has the following format:
struct port_io_struct {
char dir; /* direction flag (in vs. out) */
unsigned short 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_struct
structures, load the port
with 0, and leave the unused structures at the end of the array.
Refer to hardware manuals for port addresses and functions
for the various adapters.
You can use the following ioctl commands to input or output a byte on the graphics adapter port:
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 output to the graphics adapter port.
struct fkeyarg {
unsigned short keynum;
char keydef [MAXFK];
char flen;
}
You can use the following
ioctl(S)
request to assign function key definitions:
See the scancode(HW) manual page for more function key ioctls.
The definition of ``scoansi'' changed with SCO OpenServer Release 5.0.6. Earlier versions of SCO OpenServer supported most (but not all) of the sequences described here. Most applications should experience no problems with the new functionality, but a backward compatibility mode is available for applications that rely on the previous behavior.
To enable backwards compatibility mode, run mkdev scoansi and select the option to use the new in-kernel scoansi emulator. You are then asked to relink the kernel and reboot the system. See mkdev(ADM) for details.
The console driver accepts both 7-bit CSI sequences and 8-bit sequences. The 8-bit CSI sequence collapses ``ESC ['' into a single 8-bit character, 0x9b. Thus, ``ESC [ 2 J'' (0x1b-0x5b-0x32-0x4a) and ``CSI 2 J'' (0x9b-0x32-0x4a) are equivalent.
In all of the sequences described here, if an argument is expected but omitted, a default value of 1 is implied. For example, ``CSI 1 B'' and ``CSI B'' are equivalent. Where this is not the case, it is highlighted and described in the text.
Beginning with SCO OpenServer Release 5.0.6 (or earlier versions if you have an updated console driver), the console driver now supports what is known as a scrolling region, a virtual screen defined by the CSR control sequence. Any lines outside the defined margins are not subject to scrolling, and under normal circumstances you cannot move the cursor outside of the scrolling region. In effect, this reduces the addressable size of the display (even though the physical screen may still be at 80 columns and 25 rows). All cursor addressing sequences and scrolling is limited to the defined region. In this way, a scrolling region is no different from a window that occupies the full screen. However, certain control sequences deal with absolute cursor position and thus can violate the boundaries of the scrolling region. Care must be taken when using these absolute position control sequences to avoid unexpected results.
The attributes and modes used to display characters on the screen are known as the graphics rendition, and can be controlled by the SGR (``set graphics rendition'') sequence described later. A set of SCO OpenServer specific control sequences can be used to control individuals portions of the graphics rendition. See -1 for details.
``scoansi'' always uses four sets of graphics attributes: current, normal, reverse and graphics. The current attribute is the attribute that is used when the screen is cleared, when new lines are introduced as a result of scrolling the screen, or when new characters are drawn on the screen. The normal attribute is the fallback attribute that is used when no attribute modifiers are active. The reverse attribute is used when reverse video mode is active, and the graphics attribute is used when a graphics (or linedraw) character neeeds to be displayed. It is possible, although uncommon, for all of these attributes to be completely different. For example, it is possible for the normal attribute to be grey text on a black background, for graphics characters to be displayed with a bright magenta foreground on a blue background, and for characters in reverse vide to be displayed as yellow text on a cyan background.
When you use the SGR or SCO OpenServer specific escape sequences to change attributes, you affect one or more of the attribute values. For example, setting the foreground color to red using the SGR sequence sets the normal and graphics foreground colors to red, and the reverse video background to red. Using the SCO OpenServer specific escape sequences, you can set just the normal and graphics foreground color without affecting the background color of the reverse video attribute. Once the color has been set, ``scoansi'' selects the appropriate attribute value (either normal, reverse or graphics, depending on the attribute modifiers and the character to be drawn) and makes that the current attribute. This attribute is then used for drawing new characters and when the screen is scrolled or a line or character is cleared.
It is possible to change the attributes that are used when new lines are created by a scroll, and the attributes used when characters are erased for any reason. The default behavior is to use the current attribute. However, it is possible to set a special terminal mode that will force the normal attribute to be used. See -1 for details.
Attributes are treated subtly differently if you enable backwards compatibility mode. This mode handles attributes (and other semantics) as the console driver did prior to SCO OpenServer Release 5.0.6. Where such differences exist, they are described for the graphics rendition that is affected. To understand how these attributes are used, print the various escape sequences out and study the visual effect that they have.
Font 1 can be used to display the actual glyphs as defined by the PC ROM BIOS. This font is used to display the so-called ``graphics'' characters, or linedraw characters. All characters are displayed without interpretation.
Font 2 is used to display ROM BIOS characters as well, but with slightly different rules. This font was invented in order to be able to display upper ASCII characters (8-bit ASCII characters, or characters above 0x7f). When using this font, all of the lower ASCII characters will have their glyphs displayed. For all other characters, if the high bit of the character is set, this font will unset it and then display the resulting glyph. If, however, the high bit is not set, the this font will set it and display the resulting glyph.
Font 3 is similar to font 2, except that the lower ASCII characters are processed as they are in font 0 (that is, they follow the semantics described for ``ASCII Control Sequences''). Any other character is displayed as in font 2. In other words, any character that has its high bit set will have it unset by this font and the resulting glyph displayed, and any input character that does not have its high bit set will have it set by the font, and the resulting glyph displayed.
For example, suppose that the character that was sent to the console was the character ``D''. In font 0, it would appear exactly like that, as a ``D''. The same applies in font 1. In fonts 2 and 3 however, since the character does not have its high bit set, the font will set it and then display the resulting glyph. Thus, the character 0x44 is now displayed as 0xc4, which is the character used to draw a single horizontal line.
If the character sent to the console was the actual character 0xc4, then in both fonts 0 and 1, it would appear as the horizontal line draw character. However, in fonts 2 and 3, because its high bit is set, the font will remove it and then display the resulting glyph, which is the character ``D''.
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
NL (Newline)
Moves the cursor down one line. Does not change the cursor's horizontal position. If this would cause the cursor to move beyond the bottom margin, the region will scroll upwards. | 0x0a | n/a | n/a |
|
CR (Carriage Return)
Moves the cursor to the left margin. | 0x0d | cr | cr |
|
BS (Backspace)
Moves the cursor backwards one position, non-destructively. Will not move backwards beyond the left margin. | 0x07 | n/a | n/a |
|
HT (Horizontal Tab)
Moves the cursor forwards to the next tab stop. Initially, tab stops are set 8 characters apart, although it is possible to change the tab stops beyond the right margin, and will not cause a scroll. However, if backwards compatibility mode is on (see below), then an attempt to tab beyond the right margin will cause the screen to scroll, and leave the cursor at the left margin. | 0x09 | ta | ht |
| BEL (Bell) Sounds the bell. The frequency and duration of the bell can be set by an SCO OpenServer specific escape sequence. See -1 for details. | 0x07 | bl | bel |
|
FF (Form Feed)
Clears the region and moves the cursor to the top and left margin. If the scrolling region is active, this sequence will still erase the entire screen. If the scrolling window is active, it will only erase the contents of the window. If backwards compatibility mode is on, the cursor will always be left at the top left corner of the screen. In the default mode, the cursor will be left at the top left of the region. | 0x0c | ff | ff |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
CUU (CUrsor Up)
Moves the cursor up p1 lines. Will never cause text to scroll, and the cursor will not move above the top margin. | CSI p1 A | UP | cuu |
|
CUD (CUrsor Down)
Moves the cursor down p1 lines. Will never cause text to scroll, and the cursor will not move below the bottom margin. | CSI p1 B | DO | cud |
|
CUF (CUrsor Forward)
Moves the cursor right p1 columns. Will not scroll text, and will not move beyond the right margin. Will not cause the cursor to wrap around to the next line (i.e there is no vertical motion). | CSI p1 C | RI | cuf |
|
CUB (CUrsor Backward)
Moves the cursor left p1 columns. Will not scroll text or move beyond the left margin. Will not cause the cursor to wrap up to the previous line (meaning there is no vertical motion). | CSI p1 D | LE | cub |
|
CNL (Cursor to Next Line)
Moves the cursor to the left margin, p1 lines down. Will not scroll text or allow the cursor to move below the bottom margin. | CSI p1 E | n/a | n/a |
|
CPL (Cursor to Previous Line)
Move the cursor to the left margin, p1 lines up. Will not scroll text or allow the cursor to move above the top margin. | CSI p1 F | n/a | n/a |
|
HPA (Horizontal Position Absolute)
Move the cursor to column p1. This is the only way to move the cursor outside of the scrolling region if one has been defined. This command is bound only by the screen size. | CSI p1 G | ch | hpa |
|
CUP (CUrsor Position)
Move the cursor to row p1, column p2. p1 and p2 are relative to the top left hand corner of the screen, unless a scrolling region is defined, in which case they are relative to the top left corner of the active region. Note that the addressing is row and column, which is the exact inverse of cartesian addressing (X,Y). If a scrolling region is active and cursor motion is bound by the region (see below on how to set this mode), then this sequence will move the cursor relative to the top left of the region, not the screen. | CSI p1;p2 H | cm | cup |
|
CFT (Cursor Forward Tab)
Move the cursor forward to the column p1 tab stops away. See -1 for semantic details. | CSI p1 I | ta | ht |
|
ED (Erase in Display)
Erases all or part of the active region. p1 indicates how much of the region to erase. p1=0 means erase from the current cursor position to the end. p1=1 means erase from the beginning of the active region to the current cursor position, inclusive. p1=2 means erase the entire region. If a scrolling region is active, this command still works across the entire screen boundary. If a scrolling region is active, it only works within the window. | CSI p1 J | cd | ed |
|
EL (Erase in Line)
Erases all or part of a line. p1 indicates how much of the line to erase. p1=0 means erase from the current cursor position to the the right margin). p1=1 means erase from the left margin to the current cursor position, inclusive. p1=2 means erase from the left to the right margins, inclusive. | CSI p1 K | ce | el |
|
IL (Insert Line)
Insert p1 blank lines below the current cursor position. If the scrolling region is active and the cursor is outside of the bounds of the active region, no action is taken and this sequence is ignored. Introduces blank lines at the cursor point. | CSI p1 L | AL | il |
|
DL (Delete Lines)
Delete p1 lines at the current cursor position. If the scrolling region is active and the cursor is outside of the bounds of the active region, then no action is takes and this sequence is ignored. Causes blank lines to be introduced at the bottom of the region. | CSI p1 M | DL | dl |
|
DCH (Delete CHaracters)
Deletes p1 characters at the current cursor position. If the scrolling region is defined, this command will still erase characters. However, if the scrolling region is active and the cursor is out of bounds, then the command is ignored. Introduces blank characters at the right margin, and causes characters to shift to the left. | CSI p1 P | DC | dch |
|
DL (Delete Lines)
An alternate form of CSI p1 M, described above. | CSI p1 R | DL | dl |
|
SU (Scroll Up)
Causes the active region to scroll upward p1 lines. In backwards compatibility mode, always scroll the entire screen. Introduces blank lines at the bottom margin. This instruction is always executed regardless of where the cursor position is. | CSI p1 S | SF | indn |
|
SD (Scroll Down)
Causes the active region to scroll upward p1 lines. In backwards compatibility mode, always scroll the entire screen. Introduces blank lines at the top margin. This instruction is always executed regardless of where the cursor position is. | CSI p1 T | SR | rin |
|
RIS (Reset Initial Screen)
Fully reset the emulator state. This will clear all margins (that is, remove any scrolling region), move the cursor to the top left corner of the screen (the ``home'' position), turn off any attribute modes such as bold, reverse, blink, underline etc, set the display font to font 0, set the current attribute to the defined normal attribute, clear the screen, and reset all TAB stops to be 8 spaces apart. Alternate control sequences defined below have the same effect. | CSI U | n/a | n/a |
|
ER (Erase in Region)
If the scrolling region is active, erase all or part of the region. p1 indicates how much of the region to erase. p1=0 erases from the current cursor position to the end of the region, inclusive. p1=1 erases from the start of the region to the current cursor position, inclusive. p1=2 erases the entire region. If the cursor is out of bounds, the command is ignored. | CSI p1 V | n/a | n/a |
|
ECH (Erase CHaracters)
Erases p1 characters from the cursor position towards the right margin. Will not erase characters beyond the right margin. | CSI p1 X | ec | ech |
|
CBT (Cursor Backwards Tabulation)
Moves the cursor backwards p1 tab stops. Will never move beyond the left margin, and never wraps. | CSI p1 Z | bt | cbt |
|
HPR (Horizontal Position Relative)
A synonym for CUF, described above. | CSI p1 a | RI | cuf |
|
RCH (Repeat Character)
Repeat character p1 p2 times. This is achieved as if a stream of characters p2 in length, all consisting of character p1 has been sent to the console. The same rules as apply for normal character scrolling and attribute values apply. | CSI p1;p2 b | rp | rep |
|
VPA (Vertical Position Absolute)
Sets the cursor to row p1. This sequence ignores the scrolling region and is the only way to move the cursor out of bounds (limited only by the screen size). | CSI p1 d | cv | vpa |
|
VPR (Vertical Position Relative)
A synonym for CUD, described above. | CSI p1 e | DO | cud |
|
HVP (Horizontal and Vertical Position Absolute)
Sets the cursor to the absolute column p1 and absolute row p2, ignoring the scrolling region and scrolling region. This is one of the only ways to move the cursor outside of the bounds of the scrolling region. The only bounds to this function are the screen size. | CSI p1;p2 f | n/a | n/a |
|
DGC (Display Graphics Character)
If iBCS2 mode is not active, display the character p1 as a PC ROM BIOS glyph. If iBCS2 mode is active, then this command clears tab stops. In this mode, p1=0 clears the tab under the cursor position, and p1=3 clears all tabs. See the description of CAT below for a description of how the cursor behaves when no TAB stops are set. | CSI p1 g | n/a | n/a |
| SM (Set Mode) | CSI p1 h | n/a | n/a |
|
RM (Reset Mode)
Sets or resets various terminal modes. p1 indicates which mode to set (or reset) according to the following table: | CSI p1 l | n/a | n/a |
| Value | Meaning |
|---|---|
| 2 | Lock/unlock the keyboard. When the keyboard is locked, it is not possible to enter ANY key strokes, not even a multiscreen switch. This is a dangerous mode to set, as it can cause the console to freeze, giving the impression that the keyboard is hung. Take care when setting this mode. |
| 3 | Set 132-column mode. This is currently ignored and will only be available in future versions of scoansi. |
| 4 | Enable / disable jump-scroll mode. This has no meaning on the console, but other scoansi compliant applications such as scoterm or TERMVision may change the way in which text is scrolled. |
| 6 | Forces cursor motion to be relative to the top left corner. This is ignored if backwards compatibility mode is enabled. In the default mode, all relative cursor motion commands will be unbound. Thus causes commands like CUP to move the cursor relative to the top left corner of the region. |
| 7 | Disable or enable automatic margins. Please note that this is the inverse of what you would expect. CSI 7 h will reset automatic margins, and CSI 7 l will set them. When automatic margins are disabled, characters printing at the right margin will simply start overwriting the last character. When automatic margins are set (the default), inserting a character at the right margin causes the cursor to wrap to the next line, scrolling the active region if necessary. |
| 25 | Enable or disable the cursor. When you re-enable the cursor, it will return to its previous shape. |
| 30 | Scrollbars on or off. Ignored on the console. Used only by scoterm and other GUI-based scoansi emulators. |
| 44 | Enable or disable margin bell. This is ignored on the console, but in scoterm and other GUI emulators, causes the bell to ring when you approach the right margin. |
| 48 | Enable or disable the cursor, as per 25 above. |
| 1048 | Enable or disable the cursor, as per 25 above. |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
MC (Media Copy)
Causes all or part of the screen to be sent to the pass-through printer. Parameter p1 indicates how much of the screen to send to the printer. Currently, only p1=2 is supported, which sends the entire screen contents. Future versions of scoansi may support other values. | CSI p1 i | ps | mc0 |
|
EDK (Enable or Disable Keyboard click)
If p1=0, enable the keyboard click, which causes a very brief tone to be played each time a key is pressed. This is no longer supported on the console. Only GUI versions of scoansi support this sequence (the console driver will recognize this, but simply ignore it). Any other value for p1 disables the keyboard click. | CSI p1 k | n/a | n/a |
|
SGR (Set Graphics Rendition)
Changes the attributes with which characters are displayed. This command can accept up to nine parameters. The parameters can be in any order. The table below shows the meaning of each value: | CSI px m | various | various |
| Value | Meaning |
|---|---|
| 0 | Disable all attribute modifiers (bold, underline, italic, reverse video, concealed and blinking). In the default mode, set the font back to font 0. In backwards compatibility mode, only set the font if the SGR0 control option is set (see below). Sets the current attribute back to the defined normal attribute. |
| 1 | Turn on bold mode. The current foreground color will now appear as a brighter color, if it was not already set to be a bright color by the color sequences defined below. |
| 2 | Sets the foreground colors. This sequence takes the next two arguments as the foreground and background color to set, respectively. It then sets the stored normal color to this attribute, and selects it. The color numbers used for this sequence are the ISO color numbers, not the ANSI color numbers (this is an SCO OpenServer extension.) For example, the sequence CSI 2;0;5 m sets the current normal attribute to be black text on a magenta background. |
| 3 | Italic / blink mode. In the default mode, this sequence enables italic mode on monochrome video adapters. It is ignored on CGA, EGA or color VGA adapters. If backwards compatibility mode is enabled, then this sequence is used to control the role of the blink bit in the M6845 video controller. The argument following the 3 indicated whether this bit should be interpreted as blink, or as bold background. For example, the sequence CSI 3;1 m will enable blinking text, whereas the sequence CSI 3;0 m will enable bright background colors. |
| 4 | Enable underline mode on monochrome adapters. |
| 5 | Enable blinking mode. If the M6845 has been programmed to allow blinking text, this will enable that mode. Otherwise, this will have the effect of making all background colors bright. |
| 6 | Disable blinking mode. If the M6845 has been programmed to allow blinking text, this will cause subsequent characters not to blink. |
| 7 | Enable reverse video. This will start using the attribute defined as the reverse video attribute. |
| 8 | Enable concealed mode. This will cause characters printed to be invisible (i.e. they will have the same foreground and background values). |
| 10 | Set display font 0. If backwards compatibility mode is enabled, this command will start using the normal attribute again, unless reverse video mode is active, in which case that attribute is used. |
|
11
12 13 | Set display fonts 1, 2 or 3 respectively. If backwards compatibility mode is enabled or the ``do not use graphics attribute'' mode is not set in the default mode, then these commands will start using the defined graphics attribute. |
| 21 | Disable bold mode. |
| 23 | Disable italic mode on monochrome adapters. |
| 24 | Disable underline mode on monochrome adapters. |
| 25 | Disable blinking mode. Synonymous with 6 above. |
| 26 | Enable blinking mode. Synonymous with 5 above. |
| 27 | Disable reverse video mode. In backwards compatibility mode this also stops using the graphics character printing attribute and will revert to using the normal attribute. |
| 28 | Disable concealed mode. Characters will now be displayed according to the correct attribute (normal, reverse or graphics, depending on other modes set). |
| 30-37 |
Set the foreground color according to the chart below:
30 Black 34 Blue
In backwards compatibility mode, this has the effect of removing bold mode, setting the normal and graphics attributes foreground to the specified color, and setting the reverse video attribute background to the specified color. In the default mode, if reverse video is active, this sets the current background to the color specified, else it sets the current foreground to the color specified. In this mode the bold bit is not modified. |
| 39 | Set the current foreground to the defined default. In backwards compatibility mode, this sets the current foreground to white text. In the default mode, it sets the current foreground to the color defined for the ``normal'' attribute. |
| 40-47 |
Set the background color according to the chart below:
40 Black 44 Blue
If backwards compatibility mode, this has the effect of removing blink mode, setting the normal and graphics attributes background to the specified color, and setting the reverse video attribute foreground to the specified color. In the default mode, if reverse video is active, this sets the current foreground to the color specified, else it sets the current background to the color specified. In this mode the blink bit is not modified. |
| 49 | Set the current background to the defined default. In backwards compatibility mode, this sets the current background to black. In the default mode, it sets the current background to the color defined for the ``normal'' attribute. |
| 50 | Reset to the original color pair. In backwards compatibility mode, set the normal attribute to white text on a black background, and reverse video to black text on a white background. In the default (new) mode, set the current attribute according to the current mode and the current values for reverse, normal or graphics modes. |
| 51 | Resets all colors to the system default of gray for the foreground and reverse background, and black for the background and reverse foreground. Only valid in new mode. |
| 90-97 |
Only valid in the new (default) emulation mode. Sets the
current foreground to the color specified. These colors are
different to the ANSI colors, as they use the standard ISO
color numbering scheme. Colors set with these sequences are
always bright colors (using one of these sequences enables
bold mode automatically). The color values are:
90 Black 94 Red
If reverse video mode is active, these sequences set the current background color. Note that these sequences operate only on the current display attribute, they do not modify the default values that sequences like CSI 50 m would revert to. |
| 100-107 |
Only valid in the new (default) emulation mode. Sets the
current background to the color specified. These colors are
different to the ANSI colors, as they use the standard ISO
color numbering scheme. Colors set with these sequences are
always bright colors (i.e. using one of these sequences enables
bold mode automatically and will program the M6845 controller
to allow for bold background colors). The color values are:
100 Black 104 Red
If reverse video mode is active, these sequences set the current background color. Note that these sequences operate only on the current display attribute, they do not modify the default values that sequences like CSI 50 m would revert to. |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
TCP (Transmit Cursor Position)
Cause the driver to return, via the keyboard input stream, the current cursor position. The string returned is the current row and column position, separated by a space and terminated with a newline. Thus, if the cursor was at row 5, column 12, this sequence would eject the string ``5 12\n''. Only valid in new mode. | CSI n | n/a | n/a |
|
TMP (Transmit Margin Position)
Cause the driver to return, via the keyboard input stream, the current margin position(s). Only valid in new mode. Parameter p1 indicates which margin position should be returned, and can be one of the following values (all strings are terminated with a newline): | CSI p1 o | n/a | n/a |
| Value | Meaning |
|---|---|
| 0 | Return all margin positions, each separated by a space and terminated with a newline. The order in which the margins are returned is top, bottom, left and right. For example, if a scrolling region is defined, and its upper left corner is at row 5 column 5, and its lower right corner is at row 20 column 75, this sequence would return the string ``5 20 5 75\n''. |
| 1 | Return just the top margin. |
| 2 | Return just the bottom margin. |
| 3 | Return just the left margin. |
| 4 | Return just the right margin. |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
| CSR (Change Scrolling Region) | CSI p1;p2 r | cs | csr |
| CSI p1-4 r | wi | wind |
In the second form, where 3 or more parameters are specified, the parameters are the top, bottom, left and right margins respectively. If you omit the last parameter, the extreme edge of the screen is assumed to be the right margin.
If any of the parameters are out of bounds, they are clipped. If any of the parameters would cause an overlap (i.e. the bottom margin is higher than the top margin, or the right margin is less that the left margin), then this command is ignored and no scrolling region or window will be active. If all of the parameters are correct, then the cursor is moved to the top left hand corner of the newly-created region. The new region will now define the bounds of all scroll and cursor motion operations.
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
SCP (Save Cursor Position)
Save the current cursor position. The cursor position can be restored later using the RCP sequence. Alternate control sequences described here have the same effect. | CSI s | sc | sc |
|
RCP (Restore Cursor Position)
Restore the cursor to the position it occupied at the last time an SCP sequence was received. Alternate control sequences described here the same effect. | CSI u | rc | rc |
|
SSW (Screen SWitch)
Make the multiscreen number specified by parameter p1 the current one. If p1 refers to an invalid multiscreen number, no action is taken. | CSI p1 z | n/a | n/a |
|
HPA2 (Horizontal Position Absolute)
This is a synonym for the sequence. | CSI p1 ` | ch | hpa |
|
ICH (Insert CHaracter)
Insert p1 blank characters at the current cursor position. This will cause the characters following the cursor to shift to the right. Characters that would move beyond the right margin are lost. | CSI p1 | IC | ich |
|
CUB (CUrsor Backwards)
This is a synonym for the CUB sequence. | CSI p1 SPACE | LE | cub |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
SCP (Save Cursor Position)
Save the current cursor position. This is a synonym for the ANSI SCP sequence. | ESC 7 | sc | sc |
|
RCP (Restore Cursor Position)
Restore the cursor to the position it occupied at the last time an SCP sequence was received. This is a synonym for the ANSI RCP sequence. | ESC 8 | rc | rc |
|
CFI (Cursor Forward Index)
Moves the cursor down exactly one line, scrolling the active region. | ESC D | n/a | n/a |
|
CBNL (Cursor to Beginning of Next Line)
Move the cursor to the beginning of the next line. If the cursor is at the bottom margin, the screen, region or window will scroll. | ESC E | n/a | n/a |
|
SHT (Set Horizontal TAB)
Set a tab stop at the current column, for all rows. | ESC H | st | hts |
|
CBPL (Cursor to Beginning of Previous Line)
Move the cursor to the left margin and then move up one line. If the cursor was on the top margin, this will cause the active region to scroll. | ESC I | n/a | n/a |
|
CRI (Cursor Reverse Index)
Move the cursor up exactly one line. If the cursor is already at the top margin, this will cause the active region to scroll. | ESC M | n/a | n/a |
|
SFK (Set Function Key)
This sequence is used to program the function keys, using the same syntax as the DOS ANSI.SYS driver does. defn is the definition of the function key, and is in the form: K"string". K is the function key number starting at zero plus the ASCII Value of 0. For example, <F1> would be ``0'', <F16> would be ``?'', and so on. The delimiter ``"'' may be any character not in ``string''. ``string'' is the set of characters to be transmitted when the specified function key is pressed. In ``string'' the ``^'' character causes the next character to have 32 subtracted from its ASCII value. Thus, ``^!'' results in an SOH (^A) character. | ESC Q defn | n/a | n/a |
|
RIS (Reset Initial Screen)
Fully reset the emulator state. This sequence is a synonym for the ANSI RIS sequence. | ESC c | n/a | n/a |
|
LMA (Lock Memory Above)
This is an alternative way to set the scrolling region, and is not valid in backwards compatibility mode. This sequence sets the top margin to the current line, and the bottom margin extends to the last row of the screen. This has the effect of locking the rows above the current line. This sequence will move the cursor to the beginning of the new region. | ESC l | n/a | n/a |
|
USR (Unlock Scrolling Region)
This sequence can be used to remove the scrolling region. The cursor is not moved from its current position. The top, bottom, left and right margins are set to cover the entire screen. | ESC m | n/a | n/a |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
SBC (Set Border Color)
Set the overscan (border) to the color specified. The color number comes from ``ISO Color Map'' | CSIS p1 A | n/a | n/a |
|
SBP (Set Bell Parameters)
Set the frequency (p1) and duration (p2) of the audible bell. The frequency is in units of 840.3 nanoseconds, and the duration is in units of 100 milliseconds. | CSIS p1;p2 B | n/a | n/a |
|
SCS (Set Cursor Shape)
Set the shape of the flashing cursor. Parameter p1 is the top scanline of the cursor, and p2 is the bottom scanline of the cursor. If you set the bottom scan line to a value less than the top scan line, the cursor will disappear. | CSIS p1;p2 C | n/a | n/a |
|
SBI (Set Background Intensity)
Turns the intensity of background colors on (p1 = 1) or off (p1 = 0). Any characters printed with the ``blink'' attribute modifier will instead be displayed as having an intense background. | CSIS p1 D | n/a | n/a |
|
SBB ( Set Background Blink bit)
Sets (p1 = 1) or clears (p1 = 0) the Blink versus Bold background bit in the M6845 CRT controller. The parameters are the exact inverse of the SBI sequence above. Other than that, they behave the same on the console. In GUI versions of scoansi, the application may distinguish between these two sequences. | CSIS p1 E | n/a | n/a |
|
SNF (Set Normal Foreground color)
Sets the normal foreground color to ISO color p1. | CSIS p1 F | n/a | n/a |
|
SNB (Set Normal Background color)
Sets the normal background color to ISO color p1. | CSIS p1 G | n/a | n/a |
|
SRF (Set Reverse Foreground color)
Sets the reverse video foreground color to ISO color p1. | CSIS p1 H | n/a | n/a |
|
SRB (Set Reverse Foreground color)
Sets the reverse video background color to ISO color p1. | CSIS p1 I | n/a | n/a |
|
SGF (Set Reverse Foreground color)
Sets the graphic character foreground color to ISO color p1. | CSIS p1 J | n/a | n/a |
|
SGB (Set Reverse Foreground color)
Sets the graphic character background color to ISO color p1. | CSIS p1 K | n/a | n/a |
|
SEF (Set Emulation Feature)
Control the various emulator features. Parameter p1 indicates the action to be taken: | CSIS p1 L | n/a | n/a |
| Value | Meaning |
|---|---|
| 0 | New regions filled with the current attribute (default) |
| 1 | New regions filled with the normal attribute |
| 2 | Disable iBCS2 compliance (default) |
| 3 | Enable iBCS2 compliance |
| 4 | Disable ANSI SGR0 interpretation (default) |
| 5 | Enable ANSI SGR0 interpretation |
| 6 | Disable backwards compatibility mode (default) |
| 7 | Enable backwards compatibility mode (resets margins too) |
| 8 | Cursor motion bound by region (default) |
| 9 | Cursor motion unbound |
| 10 | Enable 8-bit keyboard meta mode (default) |
| 11 | Disable 8-bit keyboard meta mode |
| 12 | Disable debugging for this screen (default) |
| 13 | Enable debugging for this screen (do not use) |
| 14 | Disable global video loop debugging (default) |
| 15 | Enable global video loop debugging (do not use) |
| 16 | Enable M6845 frame buffer optimization (default) |
| 17 | Disable M6845 frame buffer optimization (debugging only) |
| 20 | Disable using ESC for meta (high) bit. |
| 21 | Enable using ESC for meta (high) bit. |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
RAS (Return Attribute Setting)
Use this sequence to return the current settings for the attribute type specified by p1. Attributes are returned via the keyboard data input stream as text decimal numbers separated by a space and terminated with a newline. The attribute values returned use the ISO color numbering scheme. For example, if the current normal attribute setting is bright yellow on a blue background, CSIN 0 M would return ``14 1\n''. p1 can be one of the following values: | CSIS p1 M | n/a | n/a |
| Value | Meaning |
|---|---|
| 0 | Return the current normal attribute setting |
| 1 | Return the current reverse video attribute setting |
| 2 | Return the current graphic character attribute setting |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
HSC (Hide or Show Cursor)
Either hide or show the cursor. When you hide the cursor, scoansi remembers its previous shape, so that if you restore it, it is restored to its previous shape. p1 specifies how to handle the cursor, and can be one of the following values: | CSIS p1 c | various | various |
| Value | Meaning |
|---|---|
| 0 | Hide the cursor, saving its shape for a future restore |
| 1 | Restore the cursor after hiding or making it very visible |
| 2 | Make the cursor very visible, saving its shape for a future restore. If you move from a hidden to a very visible shape, the cursor shape is not stored. This ensures that when a restore command is given, the original cursor shape is restored. |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
|
PRC (Print ROM Character)
If only one argument is passed to this function, display the glyph for the PC ROM character specified by p1. If 3 parameters are passed, then then p2 and p3 are used to set the graphic character attribute foreground and background respectively, using the ISO color numbering scheme described below. | CSIS p1 g | n/a | n/a |
|
CHC (Clear and Home Cursor)
Much like the Form Feed (FF) ASCII control character, this sequence will erase the entire screen using the current fill attribute, but it will ignore the current scrolling region if set (the entire screen is always cleared, regardless of the scrolling region settings). The cursor will be left at the top left of the scrolling region. | CSIS l | n/a | n/a |
|
SSM (Set Specific Margin)
This sequence can be used to set any one of the 4 margins. Parameter p1 indicates which margin to set (p1=0 for the top margin, p1=1 for the bottom, p1=2 for the left and p1=3 for the right). p2 is the row or column to set the margin to. If after this control sequence has been processed, the top or bottom margins are not at the top of the screen, and the left and right margins are at the screen boundary, then the scrolling region is set to the size specified. If either of the left or right margins are not at the screen boundary then the scrolling region is bound by the current margins. | CSIS p1;p2 m | n/a | n/a |
|
RSM (ReSet Margins)
This sequence can be used to reset all of the margins to cover the entire screen. This will deactivate the scrolling region (if defined). If not, this sequence has no effect. The cursor is not moved. | CSIS r | n/a | n/a |
|
CAT (Clear All TABs)
Clear all tab stops. If a TAB character is received and there are no TAB stops set, then the TAB character will move the cursor to the right margin. If backwards compatibility mode is on, then the cursor moves one position beyond the margin, thus causing the cursor to wrap to the left margin on the next line, performing a scroll if necessary. | CSIS z | ct | tbc |
| Value | Color | Value | Color |
|---|---|---|---|
| 0 | Black | 8 | Gray |
| 1 | Blue | 9 | Light Blue |
| 2 | Green | 10 | Light Green |
| 3 | Cyan | 11 | Light Cyan |
| 4 | Red | 12 | Light Red |
| 5 | Magenta | 13 | Light Magenta |
| 6 | Brown | 14 | Yellow |
| 7 | White | 15 | Bright White |
CONFIG: console: Cannot allocate SCRNMEM = nk (NSCRN = n too many screens)Not enough memory was available for the video driver. Decrease the number of screens as set by the configurable parameter NSCRN.
WARNING: console: Kernel messages lost on non-text screen
Check kernel messages logfile
Kernel messages were lost while the console was in graphics mode and
did not appear. Check the last few lines of /usr/adm/messages
to find the messages.
PANIC: console: Too many keyboard groups (MAXKBGRPS max)There are more video devices attached to your system than the kernel is designed to support.
#include <stdio.h>#include <sys/types.h> #include <sys/signal.h> #include <sys/vtkd.h>
#define SIG_REL SIGUSR1 #define SIG_ACQ SIGUSR2
int Isdisplayed; /* flag: when are we flipped away */ char *Screenmem; /* physical map to the video RAM */ int graf(); /* Set everything up */ void grafend(); /* Restore user's text mode */ void grafquit(); /* Clean-up and exit */ void rel_screen(), acq_screen(); int Oldmode; /* save mode of user shell screen */
/* * Set up the graphics multiscreen stuff and call another * routine to set up card. */ graf() { struct vt_mode smode;
Isdisplayed = 1; /* * Set up to catch the screen switch signals. */ signal(SIG_REL, rel_screen); signal(SIG_ACQ, acq_screen); /* * Set up the data structure that asks the driver * to send you signals when the screens are switched. * mode == VT_PROCESS means send screen switch signals. * mode == VT_AUTO means turn off screen switch signals (regular mode). * relsig == the signal you want when the user switches away. * acqsig == the signal you want when the user switches back to you. */ smode.mode = VT_PROCESS; smode.waitv = 0; /* not implemented, reserved */ smode.relsig = SIG_REL; smode.acqsig = SIG_ACQ; smode.frsig = SIGINT; /* not implemented, reserved */
if(-1 == ioctl(0, VT_SETMODE, &smode)) { perror("screen switch signal ioctl VT_SETMODE"); exit(1); } signal(SIGINT, grafquit); grafmode(); }
/*
* this is the signal handler for when the user screen flips
* away from us.
*/
void
rel_screen()
{
signal(SIG_REL, rel_screen);
Isdisplayed = 0;
ega_save();
/*
* Tell the video driver that you have saved your state
* and it can now have the card to switch to the new screen.
* The video driver waits (forever) for this ioctl before
* it will complete the screen switch requested by the user.
* If you don't make this ioctl the screen switcher will
* be wedged until it gets one. It is best to have a
* small one line reldisp.c program to unwedge your screen
* switcher when development programs screw up from time
* to time.
*/
ioctl(0, VT_RELDISP, VT_TRUE);
}
/*
* this is the signal handler for when the user screen flips
* back to us.
*/
void
acq_screen()
{
signal(SIG_ACQ, acq_screen);
Isdisplayed = 1;
ega_restore();
/*
* Tell the video driver that you have restored your state
* and screen switching can now continue.
*/
ioctl(0, VT_RELDISP, VT_ACKACQ);
}
void
grafquit()
{
grafend();
exit(0);
}
/*
* restore text mode.
*/
void
grafend()
{
ioctl(0, MODESWITCH | Oldmode, (char *)0);
}
grafmode()
{
int adapter, privlcmd;
/*
* Confirm that we are on a supported video adapter.
*/
adapter = ioctl(0, CONS_CURRENT, (char *)0);
if(EGA != adapter && VGA != adapter)
{
puts("Stdin must be an EGA or VGA multiscreen");
exit(0);
}
/*
* Save the user's current text mode so you
* can restore it on exit.
*/
Oldmode = ioctl(0, CONS_GET, (char *)0);
/*
* Get privilege to do direct INs and OUTs to the video card.
*/
if(EGA == adapter)
privlcmd = EGA_IOPRIVL;
else
privlcmd = VGA_IOPRIVL;
if(-1 == ioctl(0, privlcmd, 1))
{
perror("I/O privilege denied");
exit(1);
}
/*
* Have the video driver reprogram the card for EGA 640x350 16 color mode.
*/
ega_grafmode();
/*
* Map the video card's frame buffer into your address space.
* This must be done after the mode switch command or you get
* frame buffer address for the wrong mode mapped in.
*/
Screenmem = (char *)ioctl(0, MAPCONS, (char *)0);
}
``System console bootstring'' in the SCO OpenServer Handbook
``Configuring video adapters'' in Configuring Video Adapters
``Setting up serial consoles'' in the SCO OpenServer Handbook