| DOC HOME | SITE MAP | MAN PAGES | GNU INFO | SEARCH | PRINT BOOK |
The system console device can be either a terminal(a serial adapter device,tty1a) or a systemkeyboard display adapter monitor (tty01).
/dev/console is the device used by the systemadministrator for system maintenance (single-user) operations.It is thetty to which the first default shell is attached.
System error messages from the kernel are written to/dev/console, which is normally the currentmultiscreen. If/dev/console is the defaultoutput device for system error messages, and the displaybeing used is switched to graphics mode, console messagesare not displayed.
When the video device returns to text mode, a noticemessage is displayed and the text of the kernel error canbe recovered from/usr/adm/messages.
Initially,/dev/consoleis linked to/dev/systty.The actual physical device accessed via/dev/systtyis selected during boot,and is typically the device used to control the bootup procedure.The default physical device/dev/systtyis determined byboot(HW)when the system is brought up.
/dev/syscon is the system console device used byinit.Seeinit(M)for more information.
Although alltty[01-n]devices may be open concurrently, only one of thecorresponding devices can be active at any given time. Theactive device displays its own screen and takes solepossession of the keyboard. It is an error to attempt toaccess thecolor,monochrome,ega, orvgafile when no corresponding adapter exists or nomultiscreens are associated with it.
To get to the next consecutive console screen, enter<Ctrl><PrtSc>. Any active screen may be selected byentering <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 thetty01 device.
Code examples are included in the section ``Examples'' inscreen(HW)to help programmersuse theioctl(S)calls documented here.
For example, the red, green, and blue intensities for thenth color map entry are represented by the valuesof the array membersn
3,n
3+1, andn
3+2 respectively.
The argumentarg toioctl should point to anarray of 192 unsigned characters. This array may be used to readthe 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 valuesthat normally correspond to ASCII control values to higherASCII values, thus displaying the desired ROM characters.
Note that theMAP
ioctls map the memory associated withthe current mode. You must put the adapter into the desiredmode before performing mapping, or the pointers returnedwill not be appropriate.Refer to your hardware manual for detailson various displays, adapters, and controllers.
Theseioctlrequests 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 userspace, the adapter's m6845 start address registers are not set.The start address can be reset in two ways, so that thestart address of the display memory corresponds to theupper 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 ofthe existing classes. Note that the link kitmustbe installed in order to find this file. (Theclass.h file is normally generated bymkdevgraphics.)
A process' I/O privilege level can be set, allowing for thefaster execution of I/O instructions with thesysi86(S)subfunctionV86SC_IOPL:
sysi86 (SI86V86,V86SC_IOPL, 0x3000)
This sets the I/O privilege to 3 as described above. Only thesuperuser can do this.
struct kd_disparam { long type; /* display type */ char *addr; /* display memory address */ }Possible values for thetype 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 adapterregisters 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 */
Thevt_mode structure will be filled in with the currentvalue for each field. struct port_io_arg { struct port_io_struct args[4]; };As shown above, theport_io_arg structure points to an array of fourport_io_struct data structures. Theport_io_structstructure 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 theport_io_structstructures in the array for oneioctl call. The value ofdir can be eitherIN_ON_PORT to specify a byte beinginput to the graphics adapter port orOUT_ON_PORT to specify abyte being output to the graphics adapter port.port is an integer specifying the port address of the desiredgraphics adapter port.datais the byte of data being input or output as specified by the call.If you are not using any of theport_io_structstructures, load theportwith 0, and leave the unused structures at the end of the array.Refer to hardware manuals for port addresses and functionsfor the various adapters.
You can use the followingioctl commands to input or outputa byte on the graphics adapter port:
dir withIN_ON_PORT and loadportwith the port address of the graphics adapter. The byte input fromthe graphics adapter port will be returned indata.To output a byte, loaddirwithOUT_ON_PORT, loadportwith the port address of the graphics adapter, and loaddatawith the byte you want output to the graphics adapter port.
struct fkeyarg { unsigned short keynum; char keydef [MAXFK]; char flen; }You can use the followingioctl(S)request to assign function key definitions:See thescancode(HW)manual page for more function keyioctls.
The definition of ``scoansi'' changed with SCO OpenServer Release 5.0.6.Earlier versions of SCO OpenServer supported most (but not all) of thesequences described here. Most applications should experience noproblems with the new functionality, but a backward compatibility modeis available for applications that rely on the previous behavior.
To enable backwards compatibility mode, runmkdev scoansiand select the option to use the new in-kernel scoansi emulator.You are then asked to relink the kernel and reboot the system.Seemkdev(ADM)for details.
The console driver accepts both7-bit CSI sequences and 8-bit sequences.The 8-bit CSI sequencecollapses ``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, adefault value of 1 is implied. For example, ``CSI 1 B'' and ``CSI B'' areequivalent. Where this is not the case, it is highlighted and describedin the text.
Beginning with SCO OpenServer Release 5.0.6(or earlier versions if youhave an updated console driver), the console driver now supports whatis known as ascrolling region, a virtual screen definedby the CSR control sequence. Any lines outside the defined marginsare not subject to scrolling, and under normal circumstances you cannotmove the cursor outside of the scrolling region. In effect, this reducesthe addressable size of the display (even though the physical screen maystill be at 80 columns and 25 rows). All cursor addressing sequences andscrolling is limited to the defined region. In this way, a scrollingregion is no different from a window that occupies the full screen.However, certain control sequences deal with absolute cursor positionand thus can violate the boundaries of the scrolling region.Care must be taken when using these absolute position controlsequences to avoid unexpected results.
The attributes and modes used to display characters on the screen are knownas thegraphics rendition, and can be controlled by the SGR (``setgraphics rendition'') sequence described later.A set of SCO OpenServer specific control sequencescan be used to control individuals portionsof the graphics rendition. See-1for details.
``scoansi'' always uses four sets of graphics attributes:current, normal, reverse and graphics. The currentattribute is the attribute that is used when the screen is cleared, whennew lines are introduced as a result of scrolling the screen, or when newcharacters are drawn on the screen. The normal attribute is the fallbackattribute that is used when no attribute modifiers are active. The reverseattribute is used when reverse video mode is active, and the graphicsattribute is used when a graphics (or linedraw) character neeeds to bedisplayed. It is possible, although uncommon, for all of these attributesto be completely different. For example, it is possible for the normalattribute to be grey text on a black background, for graphics characters tobe displayed with a bright magenta foreground on a blue background, and forcharacters in reverse vide to be displayed as yellow text on a cyanbackground.
When you use the SGRor SCO OpenServer specific escape sequences to change attributes,you affect one or more of the attribute values.For example, setting the foreground color to redusing the SGR sequencesets 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 colorwithout 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 modifiersand the character to be drawn)and makes that the current attribute.This attribute is then used for drawing new charactersand when the screen is scrolledor a line or character is cleared.
It is possible to change the attributes that are used when new lines arecreated by a scroll, and the attributes used when characters are erasedfor any reason. The default behavior is to use the current attribute.However, it is possible to set a special terminal mode that will force thenormal attribute to be used. See-1for details.
Attributes are treated subtly differently if you enablebackwards compatibility mode.This mode handles attributes (and other semantics) asthe console driver did prior to SCO OpenServer Release 5.0.6.Where such differences exist, they are described for the graphicsrendition that is affected. To understand how these attributes areused, print the various escape sequences out andstudy the visual effect that they have.
Font 1 can be used to display the actual glyphs as defined by the PC ROMBIOS. This font is used to display the so-called ``graphics'' characters,or linedraw characters. All characters are displayed withoutinterpretation.
Font 2 is used to display ROM BIOS characters as well, but with slightlydifferent rules. This font was invented in order to be able to displayupper ASCII characters (8-bit ASCII characters, or characters above0x7f). When using this font, all of the lower ASCII characters will havetheir glyphs displayed. For all other characters, if the high bit of thecharacter is set, this font will unset it and then display the resultingglyph. If, however, the high bit is not set, the this font will set it anddisplay the resulting glyph.
Font 3 is similar to font 2, except that the lower ASCII characters areprocessed as they are in font 0 (that is, they follow thesemantics described for``ASCII Control Sequences'').Any other character is displayed asin font 2. In other words, any character that has its high bit setwill have it unset by this font and the resulting glyph displayed, and anyinput character that does not have its high bit set will have it set by thefont, and the resulting glyph displayed.
For example, suppose that the character that was sent to the console wasthe 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 thecharacter does not have its high bit set, the font will set it and thendisplay the resulting glyph. Thus, the character 0x44 is now displayed as0xc4, which is the character used to draw a single horizontal line.
If the character sent to the console was the actual character 0xc4, then inboth fonts 0 and 1, it would appear as the horizontal line drawcharacter. However, in fonts 2 and 3, because its high bit is set, thefont will remove it and then display the resulting glyph, which is thecharacter ``D''.
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
| NL (Newline) Moves the cursor down one line. Does not change the cursor'shorizontal position. If this would cause the cursor to move beyond thebottom 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 notmove backwards beyond the left margin. | 0x07 | n/a | n/a |
| HT (Horizontal Tab) Moves the cursor forwards to the next tab stop. Initially, tab stopsare set 8 characters apart, although it is possible to change thetab stopsbeyond the right margin, and will not cause a scroll. However, ifbackwards compatibility mode is on (see below), then an attempt to tabbeyond the right margin will cause the screento 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 byan SCO OpenServer specific escape sequence. See-1for details. | 0x07 | bl | bel |
| FF (Form Feed) Clears the region and moves the cursor to the top and left margin. Ifthe scrolling region is active, this sequence will still erase theentire screen. If the scrolling window is active, it will only erasethe contents of the window. If backwards compatibility mode is on, thecursor will always be left at the top left corner of the screen. In thedefault 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 thecursor 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, andthe 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 notmove beyond the right margin. Will not cause the cursor to wrap aroundto 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 beyondthe left margin. Will not cause the cursor to wrap up to the previousline (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 scrolltext 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 textor 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 cursoroutside of the scrolling region if one has been defined. This command isbound 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 topleft hand corner of the screen, unless a scrolling region is defined, inwhich 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 ofcartesian addressing (X,Y). If a scrolling region is active and cursormotion is bound by the region (see below on how to set this mode), thenthis sequence will move the cursor relative to the top left of theregion, 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-1for 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 regionto erase. p1=0 means erase from the current cursor position to the end.p1=1 means erase from the beginning of the active region tothe current cursor position, inclusive. p1=2 means erase the entireregion. If a scrolling region is active, this command still worksacross the entire screen boundary. If a scrolling region is active, itonly 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 toerase. p1=0 means erase from the current cursor position to thethe right margin). p1=1 means erase from the left marginto the current cursor position, inclusive. p1=2 means erase from theleft to the right margins, inclusive. | CSI p1 K | ce | el |
| IL (Insert Line) Insert p1 blank lines below the current cursor position. If thescrolling region is active and the cursor isoutside of the bounds of the active region, no action is taken andthis 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 scrollingregion is active and the cursor is outside of thebounds of the active region, then no action is takes and thissequence is ignored. Causes blank lines to be introduced at the bottomof the region. | CSI p1 M | DL | dl |
| DCH (Delete CHaracters) Deletes p1 characters at the current cursor position. If the scrollingregion is defined, this command will still erase characters. However,if the scrolling region is active and the cursor is out ofbounds, then the command is ignored. Introducesblank characters at the right margin, and causes characters to shift tothe 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 p1lines. In backwards compatibility mode, always scroll the entirescreen. Introduces blank lines at the bottom margin. This instructionis always executed regardless of where the cursor position is. | CSI p1 S | SF | indn |
| SD (Scroll Down) Causes the active region to scroll upward p1lines. In backwards compatibility mode, always scroll the entirescreen. Introduces blank lines at the top margin. This instruction isalways 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 thetop left corner of the screen (the ``home'' position), turn off anyattribute modes such as bold, reverse, blink, underline etc, set thedisplay font to font 0, set the current attribute to the defined normalattribute, clear the screen, and reset all TAB stops to be 8 spacesapart. 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 allor part of the region. p1 indicates how much of the region toerase. p1=0 erases from the current cursor position to the end of theregion, inclusive. p1=1 erases from the start of the region to thecurrent 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 leftmargin, 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 ofcharacters p2 in length, all consisting of character p1 has been sentto the console. The same rules as apply for normal character scrollingand attribute values apply. | CSI p1;p2 b | rp | rep |
| VPA (Vertical Position Absolute) Sets the cursor to row p1. This sequence ignores the scrolling regionand is the only way to move the cursor out of bounds (limited only bythe 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, ignoringthe scrolling region and scrolling region. This is one of the only waysto move the cursor outside of the bounds of the scrolling region. Theonly 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 BIOSglyph. If iBCS2 mode is active, then this command clears tab stops. Inthis mode, p1=0 clears the tab under the cursor position, and p1=3clears all tabs. See the description of CAT below for a description ofhow 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 isnot possible to enter ANY key strokes, not even a multiscreenswitch. This is a dangerous mode to set, as it can cause theconsole to freeze, giving the impression that the keyboard ishung. Take care when setting this mode. |
| 3 | Set 132-column mode. This is currently ignored and will only beavailable in future versions of scoansi. |
| 4 | Enable / disable jump-scroll mode. This has no meaning on theconsole, but other scoansi compliant applications such asscoterm 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. Inthe default mode, all relative cursor motion commandswill be unbound. Thus causes commands like CUP to move thecursor relative to the top left corner of the region. |
| 7 | Disable or enable automatic margins. Please note that this isthe inverse of what you would expect. CSI 7 h will resetautomatic margins, and CSI 7 l will set them. When automaticmargins are disabled, characters printing at the right marginwill simply start overwriting the lastcharacter. When automatic margins are set (the default),inserting a character at the right margin causes the cursor towrap to the next line, scrolling the active region if necessary. |
| 25 | Enable or disable the cursor. When you re-enable the cursor, itwill return to its previous shape. |
| 30 | Scrollbars on or off. Ignored on the console. Used only byscoterm 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 ringwhen 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-throughprinter. Parameter p1 indicates how much of the screen to send to theprinter. Currently, only p1=2 is supported, which sends the entirescreen 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 beplayed each time a key is pressed. This is no longer supported on theconsole. Only GUI versions of scoansi support this sequence (the consoledriver will recognize this, but simply ignore it). Any other value forp1 disables the keyboard click. | CSI p1 k | n/a | n/a |
| SGR (Set Graphics Rendition) Changes the attributes with which characters are displayed. Thiscommand can accept up to nine parameters. The parameters can be in anyorder. 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 (seebelow). Sets the current attribute back to the defined normal attribute. |
| 1 | Turn on bold mode. The current foreground color will now appearas a brighter color, if it was not already set to be a brightcolor by the color sequences defined below. |
| 2 | Sets the foreground colors. This sequence takes the next twoarguments as the foreground and background color to set,respectively. It then sets the stored normal color to thisattribute, and selects it. The color numbers used for thissequence are the ISO color numbers,not the ANSI colornumbers (this is an SCO OpenServer extension.) For example, the sequenceCSI 2;0;5 m sets the current normal attribute to be black texton a magenta background. |
| 3 | Italic / blink mode. In the default mode, this sequence enablesitalic mode on monochrome video adapters. It is ignored on CGA,EGA or color VGA adapters. If backwards compatibility mode isenabled, then this sequence is used to control the role of theblink bit in the M6845 video controller. The argumentfollowing the 3 indicated whether this bit should beinterpreted as blink, or as bold background. For example, thesequence CSI 3;1 m will enable blinking text, whereas thesequence 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 allowblinking text, this will enable that mode. Otherwise, this willhave the effect of making all background colors bright. |
| 6 | Disable blinking mode. If the M6845 has been programmed toallow blinking text, this will cause subsequent charactersnot to blink. |
| 7 | Enable reverse video. This will start using the attributedefined as the reverse video attribute. |
| 8 | Enable concealed mode. This will cause characters printed tobe invisible (i.e. they will have the same foreground andbackground 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 thatattribute is used. |
| 11 12 13 | Set display fonts 1, 2 or 3 respectively. If backwardscompatibility mode is enabled or the ``do not use graphicsattribute'' mode is not set in the default mode, then thesecommands 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 thisalso stops using the graphics character printing attribute and willrevert to using the normal attribute. |
| 28 | Disable concealed mode. Characters will now be displayedaccording to the correct attribute (normal, reverse orgraphics, depending on other modes set). |
| 30-37 | Set the foreground color according to the chart below:30 Black 34 BlueIn backwards compatibility mode, this has the effect of removingbold mode, setting the normal and graphics attributesforeground to the specified color, and setting the reversevideo attribute background to the specified color. In thedefault mode, if reverse video is active, this sets the currentbackground to the color specified, else it sets the currentforeground to the color specified. In this mode the bold bit isnot modified. |
| 39 | Set the current foreground to the defined default. In backwardscompatibility mode, this sets the current foreground to whitetext. In the default mode, it sets the current foreground tothe color defined for the ``normal'' attribute. |
| 40-47 | Set the background color according to the chart below:40 Black 44 BlueIf backwards compatibility mode, this has the effect of removingblink mode, setting the normal and graphics attributesbackground to the specified color, and setting the reversevideo attribute foreground to the specified color. In thedefault mode, if reverse video is active, this sets the currentforeground to the color specified, else it sets the currentbackground to the color specified. In this mode the blink bitis not modified. |
| 49 | Set the current background to the defined default. In backwardscompatibility mode, this sets the current background to black.In the default mode, it sets the current background tothe color defined for the ``normal'' attribute. |
| 50 | Reset to the original color pair. In backwards compatibilitymode, set the normal attribute to white text on a blackbackground, and reverse video to black text on a whitebackground. In the default (new) mode, set the currentattribute according to the current mode and the current valuesfor reverse, normal or graphics modes. |
| 51 | Resets all colors to the system default of grayfor the foreground and reverse background, andblack for the background and reverse foreground.Only valid in new mode. |
| 90-97 | Only valid in the new (default) emulation mode. Sets thecurrent foreground to the color specified. These colors aredifferent to the ANSI colors, as they use the standard ISOcolor numbering scheme. Colors set with these sequences arealways bright colors (using one of these sequences enablesbold mode automatically). The color values are:90 Black 94 RedIf reverse video mode is active, these sequences set thecurrent background color. Note that these sequences operateonly on the current display attribute, they do not modify thedefault values that sequences like CSI 50 m would revert to. |
| 100-107 | Only valid in the new (default) emulation mode. Sets thecurrent background to the color specified. These colors aredifferent to the ANSI colors, as they use the standard ISOcolor numbering scheme. Colors set with these sequences arealways bright colors (i.e. using one of these sequences enablesbold mode automatically and will program the M6845 controllerto allow for bold background colors). The color values are:100 Black 104 RedIf reverse video mode is active, these sequences set thecurrent background color. Note that these sequences operateonly on the current display attribute, they do not modify thedefault 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, thecurrent cursor position. The string returned is the current rowand column position, separated by a space and terminated with anewline. Thus, if the cursor was at row 5, column 12, this sequencewould 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, thecurrent margin position(s). Only valid in new mode.Parameter p1 indicates which marginposition should be returned, and can be one of the followingvalues (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 andterminated with a newline. The order in which the marginsare returned is top, bottom, left and right. For example,if a scrolling region is defined, and its upper left corneris at row 5 column 5, and its lower right corner is at row20 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, theparameters are the top, bottom, left and right margins respectively.If you omit the last parameter, the extreme edge of the screen isassumed to be the right margin.
If any of the parameters are out of bounds, they are clipped. If any ofthe parameters would cause an overlap (i.e. the bottom margin is higherthan 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 beactive. If all of the parameters are correct, then the cursor is movedto the top left hand corner of the newly-created region. Thenew region will now define the bounds of all scroll and cursormotion operations.
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
| SCP (Save Cursor Position) Save the current cursor position. The cursor position can be restoredlater using the RCP sequence. Alternate control sequences describedhere 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 SCPsequence was received. Alternate control sequences describedhere 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 thesequence. | CSI p1 ` | ch | hpa |
| ICH (Insert CHaracter) Insert p1 blank characters at the current cursor position. This willcause 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 theCUBsequence. | CSI p1 SPACE | LE | cub |
| Name | Sequence | Termcap | Terminfo |
|---|---|---|---|
| SCP (Save Cursor Position) Save the current cursor position. This is a synonym for theANSI SCP sequence. | ESC 7 | sc | sc |
| RCP (Restore Cursor Position) Restore the cursor to the position it occupied at the last time an SCPsequence was received. This is a synonym for theANSI 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 atthe 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 thecursor was on the top margin, this will cause the active regionto scroll. | ESC I | n/a | n/a |
| CRI (Cursor Reverse Index) Move the cursor up exactly one line. If the cursor is already at thetop 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 samesyntax as the DOS ANSI.SYS driver does. defn is the definition of thefunction key, and is in the form: K"string". K is the function keynumber 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 ofcharacters to be transmitted when the specified function key ispressed. In ``string'' the ``^'' character causes the next characterto have 32 subtracted from its ASCII value. Thus, ``^!'' results in anSOH (^A) character. | ESC Q defn | n/a | n/a |
| RIS (Reset Initial Screen) Fully reset the emulator state. This sequence is a synonym for theANSI 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 validin backwards compatibility mode. This sequence sets thetop margin to the current line, and the bottom margin extends tothe last row of the screen. This has the effect of locking the rowsabove the current line. This sequence will move the cursor to thebeginning 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 numbercomes 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. Thefrequency is in units of 840.3 nanoseconds, and the duration is inunits 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 scanlineof the cursor, and p2 is the bottom scanline of the cursor. If you setthe bottom scan line to a value less than the top scan line, the cursorwill 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 willinstead 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 bitin the M6845 CRT controller. The parameters are the exact inverse ofthe SBI sequence above. Other than that, they behave the same on theconsole. In GUI versions of scoansi, the application may distinguishbetween 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 theaction 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 typespecified by p1. Attributes are returned via the keyboard data inputstream as text decimal numbers separated by a space and terminated witha newline. The attribute values returned use the ISO color numberingscheme. For example, if the current normal attribute setting is brightyellow on a blue background, CSIN 0 M would return ``14 1\n''. p1 canbe 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, scoansiremembers its previous shape, so that if you restore it, it is restoredto its previous shape. p1 specifies how to handle the cursor, and canbe 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 futurerestore. If you move from a hidden to a very visible shape, thecursor shape is not stored. This ensures that when a restorecommand 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 forthe PC ROM character specified by p1. If 3 parameters are passed, thenthen p2 and p3 are used to set the graphic character attributeforeground and background respectively, using the ISO color numberingscheme described below. | CSIS p1 g | n/a | n/a |
| CHC (Clear and Home Cursor) Much like the Form Feed (FF) ASCII control character, this sequencewill erase the entire screen using the current fill attribute, but itwill ignore the current scrolling region if set (the entire screen isalways cleared, regardless of the scrolling region settings). Thecursor 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 p1indicates which margin to set (p1=0 for the top margin, p1=1 for thebottom, p1=2 for the left and p1=3 for the right). p2 is the row orcolumn to set the margin to. If after this control sequence has beenprocessed, 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 thescrolling region is set to the size specified. If either of the left orright margins are not at the screen boundary then the scrolling region isbound 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 theentire 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 noTAB stops set, then the TAB character will move the cursor to the rightmargin. If backwards compatibility mode is on, then the cursor movesone position beyond the margin, thus causing the cursor to wrap to theleft 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 ofscreens as set by the configurable parameterNSCRN.
WARNING: console: Kernel messages lost on non-text screen Check kernel messages logfileKernel messages were lost while the console was in graphics mode anddid not appear. Check the last few lines of/usr/adm/messagesto find the messages.
PANIC: console: Too many keyboard groups (MAXKBGRPS max)There are more video devices attached to your system than the kernel isdesigned to support.
#include <stdio.h>#include <sys/types.h>#include <sys/signal.h>#include <sys/vtkd.h>
#define SIG_RELSIGUSR1#define SIG_ACQSIGUSR2
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. */voidrel_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. */voidacq_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);}
voidgrafquit(){grafend();exit(0);}
/* * restore text mode. */voidgrafend(){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;elseprivlcmd = 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 theSCO OpenServer Handbook
``Configuring video adapters'' inConfiguring Video Adapters
``Setting up serial consoles'' in theSCO OpenServer Handbook