Movatterモバイル変換


[0]ホーム

URL:


DOC HOMESITE MAPMAN PAGESGNU INFOSEARCHPRINT BOOK
 

screen(HW)


screen --tty [01-n], color, monochrome, ega, vga display adapter and video monitor

Description

Thetty [01-n] device filesprovide a character interface to thevideo display monitor and keyboard. Each file correspondsto a separate teletype device.Although there is a maximum of 12 screens, the exact numberavailable (n) depends upon the amount of memoryin the computer. The screens are modeled after a 25-line,80-column ASCII terminal, unless specifiedotherwise.

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.

Control modes

Multiscreens can be reassigned to different adapters(in multi-adapter systems) with theseioctls :

SWAPCGA
Selects the regular color display as the output device for the multiscreen.

SWAPEGA
Selects the enhanced color display as the output device for the multiscreen.

SWAPMONO
Selects the monochrome display as the output device for the multiscreen.

SWAPVGA
Selects the video graphics array color display as theoutput device for the multiscreen.
To find out which display adapter type is currently attached to themultiscreen, you can useioctl with the following request:

CONS_CURRENT
Returns the display adapter type currently associated with the multiscreen.The return value can be one of:MONO,CGA,EGA,orVGA.

Changing the VGA color map

Theseioctls can be used to examine and change the colormap for VGA color displays. The color map is held in the videodac registers as a 192-byte array. The elements of thearray are arranged in groups of three representing the red,green, and blue intensities respectively for each of the 64 colormap entries (numbered 0 to 63). The intensity of each color isencoded by values in the range 0 (minimum) to 255 (maximum intensity).

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.


VGA_GETPALLET
Read the existing color map entries into the array pointedto byarg.

VGA_SETPALLET
Set new color map entries read from the array pointed tobyarg.

Display modes

The followingioctls can be used to change the video display mode:

SW_B80x25
Selects 80x25 black and white text display mode.(MONO, CGA, EGA, VGA)

SW_C80x25
Selects 80x25 color text display mode.(CGA, EGA, VGA)

SW_B40x25
Selects 40x25 black and white text display mode.(MONO, CGA, EGA, VGA)

SW_C40x25
Selects 40x25 color text display mode.(CGA, EGA, VGA)

SW_BG320
Selects 320x200 black and white graphics display mode.(CGA, EGA, VGA)

SW_CG320
Selects 320x200 color graphics display mode.(CGA, EGA, VGA)

SW_BG640
Selects 640x200 black and white graphics display mode.(CGA, EGA, VGA)

SW_EGAMONO80x25
Selects EGA (Enhanced Graphics Adapter) mode 7 -- emulatessupport provided by the monochrome display.(EGA, VGA)

SW_EGAMONOAPA
Selects EGA support for 640x350 graphics display mode(EGA mode F, EGA with mono monitor)

SW_ENH_MONOAPA2
Selects EGA mode F*.(EGA with mono monitor)

SW_ENHB40x25
Selects enhanced EGA support for 40x25 black and white textdisplay mode.(EGA, VGA)

SW_ENHC40x25
Selects enhanced EGA support for the 40x25 color text displaymode.(EGA, VGA)

SW_ENHB80x25
Selects enhanced EGA support for 80x25 black and white textdisplay mode.(EGA, VGA)

SW_ENHC80x25
Selects enhanced EGA support for 80x25 color text display mode.(EGA, VGA)

SW_ENHB80x43
Selects enhanced EGA support for 80x43 black and white textdisplay mode.(EGA, VGA)

SW_ENHC80x43
Selects enhanced EGA support for 80x43 color text display mode.(EGA, VGA)

SW_CG320_D
Selects EGA support for 320x200 graphics display mode(EGA mode D).(EGA, VGA)

SW_CG640_E
Selects EGA support for 640x200 graphics display mode(EGA mode E).(EGA, VGA)

SW_CG640x350
Selects EGA support for 640x350 graphics display mode(EGA mode 10).(EGA, VGA)

SW_ENH_CG640
Selects EGA mode 10*.(EGA, VGA)

SW_MCAMODE
Reinitializes the monochrome adapter.(MONO)

SW_VGA40x25
Selects VGA support for the 40x25 color text display mode(VGA mode 1+).

SW_VGA80x25
Selects VGA support for the 80x25 black and white text display mode(VGA mode 2+).

SW_VGAM80x25
Selects VGA mode 7+ -- emulatessupport provided by the monochrome display.(VGA with mono monitor)

SW_VGA11
Selects VGA support for the 640x480 graphics display mode(VGA mode 11).

SW_VGA12
Selects VGA support for the 640x480 graphics display mode(VGA mode 12).

SW_VGA13
Selects VGA support for the 320x200 graphics display mode(VGA mode 13).
Switching to an invalid display mode for a display devicewill result in an error.

Getting display modes

The followingioctl requests are provided to obtaininformation about the current display modes:

CONS_GET
Returns the current display mode setting for current displayadapter.(All)

CGA_GET
Returns the current display mode setting of the color graphics adapter.(CGA only)

EGA_GET
Returns the current display mode setting of the enhanced graphics adapter.(EGA only)

MCA_GET
Returns the current display mode setting of the monochrome adapter.(MONO only)

VGA_GET
Returns the current display mode of the video graphics adapters.(VGA only)

CONS_GETINFO
Returns structurevid_info.Size of structure (first field) must be filled in by user.
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         */};

CONS_6845INFO
Returns structurem6845_info.Size of structure (first field) must be filled in by user.
struct m6845_info{  short   size;          /* must be first field        */  ushort  screen_top;    /* offset of screen in video  */  ushort  cursor_type;   /* cursor shape               */};

CONSADP
Returns the number of the current multiscreen displayed on theadapter specified by the value of the argumentarg toioctl. Possible adapter types areMONO, CGA, PGA, EGA, andVGA (definedin/usr/include/sys/comcrt.h).If no match is found,ioctl returns -1 anderrnois set toENXIO.

GIO_ATTR
Return value ofioctl is 6845-style attribute byte in effect.

GIO_COLOR
Return value ofioctl is 0 or 2 depending on whetherthe device supports color.

GIO_SCRNMAP
Gets the 256-byte screen map table, which is the mapping ofASCII values (0-255) onto the PC video ROMfont characters (0-255).Note that control characters (ASCII values less than hex 20)have control functions and do not display ROM characters (forexample, ^J is newline).

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.


PIO_SCRNMAP
Puts the 256-byte screen map table (seeGIO_SCRNMAP).

GIO_KEYMAP
Seekeyboard(HW).

GIO_FONT8Xn
Gets font, wheren is 8, 14, and 16.Argument is a pointer to a font table.Size of 8x8 font table is 8X256 bytes, 8x14 is 14X256 bytes, etc.

PIO_FONT8Xn
Puts font, wheren is 8, 14, and 16.Argument is a pointer to a font table.Size of 8x8 font table is 8X256 bytes, 8x14 is 14X256 bytes, etc.

Memory mapping modes

Theioctl routine is used to map the display memory ofthe various devices into the user's data space.

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:


MAPCGA
Maps the color adapter's display memory into the user's data space.(CGA only)

MAPCONS
Maps the display memory of the adapter currently being usedinto the user's data space.(All)

MAPEGA
Maps the enhanced graphics adapter's display memory into theuser's data space.(EGA only)

MAPMONO
Maps the monochrome adapter's display memory into the user's data space.(MONO only)

MAPVGA
Maps the video graphics adapter's display memory into theuser's data space.(VGA only)
For example, the following code can be used to acquire apointer to the start of the user data space associated withthe color graphics adapter 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:

  1. Switch modes with anioctl.(The ``switch'' can be to the present mode.)See the``Display modes''section of this manual page.

  2. Change the start address high and lowaddresses with the in-on-port/out-on-portioctl.
The in-on-port/out-on-portioctl can alsobe used to determine the current value in the start addressregister, and then set up a pointer to theoffset in the mapped-in data space.

MAP_CLASS
Packageioctl that gives I/O privileges to an arbitrary listof ports and maps an arbitrary frame buffer into the user's addressspace identified by a string found in thestructvidclassvidclasslist[].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.)

EGA_IOPRIVL
VGA_IOPRIVL
These add the list of I/Oports found on standard EGA and VGAcards into the process' TSS I/Opermission bitmap. This allows the process to access theEGA I/O ports directly from user spacewith 386IN andOUT instructions. (Seesample code under``Examples''.)I/O instructionsexecuted in this manner are slower thanI/O instructions executed when the I/Oprivilege level is raised to 3 (see instruction timings inIntel's80386 Programmer's Reference Manual).

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.


KDDISPTYPE
This call returns display information to the user.The argument expected is the buffer addressof a structure of typekd_disparam into which displayinformation is returned to the user.Thekd_disparam structure is defined as follows:
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


KDDISPINFO
Returnsstruct kd_dispinfo, which contains adapter type and physicaladdress of frame buffer, as follows:
struct kd_dispinfo{char *vaddr;          /* memory address */paddr_t physaddr;     /* memory address */unsigned long size;   /* memory size */}

KIOCSOUND
Starts sound generation. Turns on sound. Thearg is theperiod of the bell tone in units of 840.3 nanoseconds. A value of 0 turns off the sound.This is useful for generating tones while in graphics mode.

KDGETLED
Gets keyboard LED status.The argument is a pointer to a character.The character will be filled with a Boolean combination of the followingvalues:

0x10Caps lock and Scroll lock are on
0x11Scroll lock and Num lock are on
0x04Scroll lock is on
0x02Num lock is on
0x01Caps lock is on


KDSETLED
Sets keyboard LED status. The argument is a character whose valueis the Boolean combination of the values listed under ``KDGETLED''.

KDMKTONE
(SeeKIOCSOUND.)The argument is a 32-bit value, with thelower 16 bits set to the frequency and the upper 16 bits set to theduration (in milliseconds).

KDSETMODE
Sets console in text or graphics mode.The argument is of type integer, which should contain one of thefollowing values:

KD_TEXT(sets console to text mode)
KD_GRAPHICS(sets console in graphics mode)

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


KDGETMODE
Gets current mode of console.Returns integer argument containing eitherKD_TEXT orKD_GRAPHICS as defined in theKDSETMODEioctldescription.

KDENABIO
Enable in's and out's to video adapter ports. No argument.

KDDISABIO
Disable in's and out's to video adapter ports. No argument.

KDGKBTYPE
Always returns 0.

KIOCINFO
Always returns 0x6B64.

VT_SETMODE
Sets the virtual terminal mode.The argument is a pointer to avt_modestructure.

VT_GETMODE
Determines what mode the active virtual terminal is currently in,eitherVT_AUTO orVT_PROCESS.The argument to theioctl is the address of thefollowing type of structure:
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.

VT_RELDISP
Tells the virtual terminal manager whether the display hasbeen released by the process.

0 release refused
1 release acknowledged
2 acquire acknowledged


VT_ACTIVATE
Makes the multiscreen number specifiedin the argument the active multiscreen.The video driver will cause a switch to occur in the same manneras if a hotkey sequence had been typed at the keyboard.If the specified multiscreen is not open or does not exist,the call will fail anderrno will be set toEINVAL.

Graphics adapter port I/O

You can useioctl to read or write a byte from or to thegraphics adapter port. Thearg parameter of theioctl call uses theport_io_arg data structure:
   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:


CONSIO
Inputs or outputs a byte on the current graphics adapter port as specified.(All)

MCAIO
Inputs or outputs a byte on the monochrome adapter port as specified.(MONO only)

CGAIO
Inputs or outputs a byte on the color graphics adapter port as specified.(CGA only)

EGAIO
Inputs or outputs a byte on the enhanced graphics adapter port as specified.(EGA only)

VGAIO
Inputs or outputs a byte on the video graphics arrayadapter port as specified.(VGA only)
To input a byte on any of the graphics adapter ports, loaddir 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.

Function keys

ioctl can be used to define or obtain the current definitionof a function key. Thearg parameter of theioctlcall uses thefkeyarg data structure:
   struct fkeyarg {      unsigned short keynum;      char keydef [MAXFK];      char flen;   }
You can use the followingioctl(S)request to assign function key definitions:

SETLOCKLOCK
Toggles the <Caps Lock> and <Num Lock> keys to beeither global to all the multiscreens, or local to each individualmultiscreen. To make the <Caps Lock> global (its default), setthearg parameter to 1. To make the <Caps Lock> local toeach screen, set thearg parameter to 0.

See thescancode(HW)manual page for more function keyioctls.

SCOANSI terminal emulation

The SCO OpenServer console driver supports character sequences thatform a superset of the ANSI X3.64-1979 standard.The full set of sequences described here definesthe terminal type known in thetermcap(F)andterminfo(M)databases as ``scoansi''.

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.


NOTE:It is possible to update the console driveron earlier releases of SCO OpenServer. See theSupport Services Web Pagesfor details, or contact your support representative.

SCOANSI screen attribute sequences

With the exception of special ASCII control characters,each sequence begins withthe ASCII ESC character (0x1b).The characters that follow the ESC character define the command.For many of the sequences,this takes the form ESC[ p1 ; p2 C, where ``p1'' and ``p2'' are parameters to the sequence,and ``C'' is the sequence terminator,which defines the action to be taken.The sequence ``ESC [''is known as the ``control sequence initiator'',abbreviated as CSI.SCO OpenServer specific escape sequences begin withthe sequence ``ESC [ ='', abbreviated here as CSIS.

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.

Attributes

A ``scoansi'' terminal can display characters using a variety ofattributes. Understanding how and when attributes are used is important inunderstanding the semantics of the various control sequences. At all times,``scoansi'' has a ``current attribute'' set. By default, this attribute isgray text on a black background. It is possible to modify an attribute byenabling one or more ``attribute modes''. These modes includereverse video text (that is, black text on a grey background), bold text (whitetext instead of grey) and, on certain display adapters, italic orunderlined text.

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.

Display Fonts

The ``font'' in which characters are displayed can be controlled by theSGR control sequence.Please note that the term ``font'' asused here does not imply a different shape of character as you would findin a word processor. Rather, the term ``font'' is used as defined in ANSIX3.64-1979, and defines what portion of the PC ROM BIOS character set canbe displayed. ``scoansi'' supports 4 fonts, numbered 0 through 3. Font 0is the normal font. When using it, lower ASCII characters (charactersless than 0x20) are obeyed as described in``ASCII Control Sequences''.None of the actual ROM BIOSglyphs for these lower ASCII values are displayed.

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''.

ASCII Control Sequences

The following table lists all of the ASCII control sequences which theconsole driver will obey. All other lower ASCII characters are ignored,unless a suitable font is selected, in which case the corresponding glyphis displayed.

NameSequenceTermcapTerminfo
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.
0x0an/an/a
CR (Carriage Return)
Moves the cursor to the left margin.
0x0dcrcr
BS (Backspace)
Moves the cursor backwards one position, non-destructively. Will notmove backwards beyond the left margin.
0x07n/an/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.
0x09taht
BEL (Bell)Sounds the bell. The frequency and duration of the bell can be set byan SCO OpenServer specific escape sequence. See-1for details.0x07blbel
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.
0x0cffff

ANSI screen control sequences

This set of sequences is largely defined by ANSI X3.64-1979, with someextensions. The semantics of some of these sequences differs if backwardscompatibility mode is selected. In the description of the sequences, thetext ``p1'', ``p2'' ... ``p9'' is used to describe positionalparameters. The console driver will accept a maximum of 9 parameters forany control sequence, although most sequences only use one or twoparameters.

NameSequenceTermcapTerminfo
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 AUPcuu
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 BDOcud
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 CRIcuf

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 DLEcub
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 En/an/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 Fn/an/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 Gchhpa
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 Hcmcup
CFT (Cursor Forward Tab)
Move the cursor forward to the column p1 tab stops away. See-1for semantic details.
CSI p1 Itaht
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 Jcded
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 Kceel
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 LALil
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 MDLdl
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 PDCdch
DL (Delete Lines)
An alternate form of CSI p1 M, described above.
CSI p1 RDLdl
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 SSFindn
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 TSRrin

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 Un/an/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 Vn/an/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 Xecech
CBT (Cursor Backwards Tabulation)
Moves the cursor backwards p1 tab stops. Will never move beyond the leftmargin, and never wraps.
CSI p1 Zbtcbt
HPR (Horizontal Position Relative)
A synonym for CUF, described above.
CSI p1 aRIcuf
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 brprep
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 dcvvpa
VPR (Vertical Position Relative)
A synonym for CUD, described above.
CSI p1 eDOcud
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 fn/an/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 gn/an/a
SM (Set Mode)CSI p1 hn/an/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 ln/an/a

ValueMeaning
2Lock/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.
3Set 132-column mode. This is currently ignored and will only beavailable in future versions of scoansi.
4Enable / 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.
6Forces 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.
7Disable 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.
25Enable or disable the cursor. When you re-enable the cursor, itwill return to its previous shape.
30Scrollbars on or off. Ignored on the console. Used only byscoterm and other GUI-based scoansi emulators.
44Enable 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.
48Enable or disable the cursor, as per 25 above.
1048Enable or disable the cursor, as per 25 above.

NameSequenceTermcapTerminfo
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 ipsmc0
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 kn/an/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 mvariousvarious

ValueMeaning
0Disable 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.
1Turn 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.
2Sets 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.
3Italic / 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.
4Enable underline mode on monochrome adapters.
5Enable 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.
6Disable blinking mode. If the M6845 has been programmed toallow blinking text, this will cause subsequent charactersnot to blink.
7Enable reverse video. This will start using the attributedefined as the reverse video attribute.
8Enable concealed mode. This will cause characters printed tobe invisible (i.e. they will have the same foreground andbackground values).
10Set 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.
21Disable bold mode.
23Disable italic mode on monochrome adapters.
24Disable underline mode on monochrome adapters.
25Disable blinking mode. Synonymous with 6 above.
26Enable blinking mode. Synonymous with 5 above.
27Disable reverse video mode. In backwards compatibility mode thisalso stops using the graphics character printing attribute and willrevert to using the normal attribute.
28Disable concealed mode. Characters will now be displayedaccording to the correct attribute (normal, reverse orgraphics, depending on other modes set).
30-37Set the foreground color according to the chart below:

30 Black 34 Blue
31 Red 35 Magenta
32 Green 36 Cyan
33 Brown 37 White


In 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.
39Set 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-47Set the background color according to the chart below:

40 Black 44 Blue
41 Red 45 Magenta
42 Green 46 Cyan
43 Brown 47 White


If 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.
49Set 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.
50Reset 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.
51Resets 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-97Only 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 Red
91 Blue 95 Magenta
92 Green 96 Yellow
93 Cyan 97 White


If 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-107Only 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 Red
101 Blue 105 Magenta
102 Green 106 Yellow
103 Cyan 107 White


If 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.

NameSequenceTermcapTerminfo
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 nn/an/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 on/an/a

ValueMeaning
0Return 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''.
1Return just the top margin.
2Return just the bottom margin.
3Return just the left margin.
4Return just the right margin.
The following two sequences are not available in backwards compatibilitymode (where scrolling regions are not supported):

NameSequenceTermcapTerminfo
CSR (Change Scrolling Region)CSI p1;p2 rcscsr
 CSI p1-4 rwiwind
These set the scrolling region. In the first form ofthe sequence, where only two values are specified, p1 and p2 specifythe top and bottom margins of the scrolling region. If only one argument isused, then it specifies the top margin, and the scrolling region willextend from the specified row to the end of the screen.

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.

NameSequenceTermcapTerminfo
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 sscsc

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 urcrc
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 zn/an/a
HPA2 (Horizontal Position Absolute)
This is a synonym for thesequence.
CSI p1 `chhpa
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 p1ICich
CUB (CUrsor Backwards)
This is a synonym for theCUBsequence.
CSI p1 SPACELEcub

Additional screen control sequences

This section describes a set of control sequences for which there is noANSI standard definition. Most of these extensions are used to providesome basic level of compatibility with DEC VT100 terminals, and otherprograms and drivers which emulate these terminals, such asxterm(XC)or the Linux console.A set of sequences which are unique to SCO OpenServerare also included in this section.These sequences begin with the SCO OpenServer CSI sequence,``CSI =''.In the table that follows,these sequences are prefixed as CSIS.

NameSequenceTermcapTerminfo
SCP (Save Cursor Position)
Save the current cursor position. This is a synonym for theANSI SCP sequence.
ESC 7scsc
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 8rcrc
CFI (Cursor Forward Index)
Moves the cursor down exactly one line, scrolling the active region.
ESC Dn/an/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 En/an/a
SHT (Set Horizontal TAB)
Set a tab stop at the current column, for all rows.
ESC Hsthts
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 In/an/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 Mn/an/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 defnn/an/a
RIS (Reset Initial Screen)
Fully reset the emulator state. This sequence is a synonym for theANSI RIS sequence.
ESC cn/an/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 ln/an/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 mn/an/a

Additional SCO OpenServer screen control sequences

This section describes a set of control sequences providedin SCO OpenServer that further extend the ANSI standard definition.

NameSequenceTermcapTerminfo
SBC (Set Border Color)
Set the overscan (border) to the color specified. The color numbercomes from``ISO Color Map''
CSIS p1 An/an/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 Bn/an/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 Cn/an/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 Dn/an/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 En/an/a
SNF (Set Normal Foreground color)
Sets the normal foreground color to ISO color p1.
CSIS p1 Fn/an/a
SNB (Set Normal Background color)
Sets the normal background color to ISO color p1.
CSIS p1 Gn/an/a
SRF (Set Reverse Foreground color)
Sets the reverse video foreground color to ISO color p1.
CSIS p1 Hn/an/a
SRB (Set Reverse Foreground color)
Sets the reverse video background color to ISO color p1.
CSIS p1 In/an/a
SGF (Set Reverse Foreground color)
Sets the graphic character foreground color to ISO color p1.
CSIS p1 Jn/an/a
SGB (Set Reverse Foreground color)
Sets the graphic character background color to ISO color p1.
CSIS p1 Kn/an/a
SEF (Set Emulation Feature)
Control the various emulator features. Parameter p1 indicates theaction to be taken:
CSIS p1 Ln/an/a

ValueMeaning
0New regions filled with the current attribute (default)
1New regions filled with the normal attribute
2Disable iBCS2 compliance (default)
3Enable iBCS2 compliance
4Disable ANSI SGR0 interpretation (default)
5Enable ANSI SGR0 interpretation
6Disable backwards compatibility mode (default)
7Enable backwards compatibility mode (resets margins too)
8Cursor motion bound by region (default)
9Cursor motion unbound
10Enable 8-bit keyboard meta mode (default)
11Disable 8-bit keyboard meta mode
12Disable debugging for this screen (default)
13Enable debugging for this screen (do not use)
14Disable global video loop debugging (default)
15Enable global video loop debugging (do not use)
16Enable M6845 frame buffer optimization (default)
17Disable M6845 frame buffer optimization (debugging only)
20Disable using ESC for meta (high) bit.
21Enable using ESC for meta (high) bit.
See``Scan codes''inkeyboard(HW)for details on meta- versus non-meta mode.

NameSequenceTermcapTerminfo
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 Mn/an/a

ValueMeaning
0Return the current normal attribute setting
1Return the current reverse video attribute setting
2Return the current graphic character attribute setting

NameSequenceTermcapTerminfo
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 cvariousvarious

ValueMeaning
0Hide the cursor, saving its shape for a future restore
1Restore the cursor after hiding or making it very visible
2Make 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.

NameSequenceTermcapTerminfo
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 gn/an/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 ln/an/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 mn/an/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 rn/an/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 zcttbc

ISO Color Map

Several control sequences use ISO color numbering. The table below showsthe color numbers and the colors they display:

ValueColorValueColor
0Black8Gray
1Blue9Light Blue
2Green10Light Green
3Cyan11Light Cyan
4Red12Light Red
5Magenta13Light Magenta
6Brown14Yellow
7White15Bright White

Diagnostics

The following error messages may be displayed on the console.Seemessages(M)for general information about kernel error messages,including a list of generic device driver errors.

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 logfile
Kernel 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.

Examples

The following module includes examples of getting the display mode,screen switching, I/O privilege, and memory mapping.

Sample code (part 1 of 4)

#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();}

Sample code (part 2 of 4)

/* * 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);}

Sample code (3 of 4)

/* * 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);}

Sample code (4 of 4)

/* * 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);}

Warning

Do notenable(C)ordisable(C)/dev/console because this may corrupt the/etc/inittab file;instead,enable ordisable the displayadapter (tty01),or the serial adapter (tty?a) if the consoleis configured to be on a particular serial device.

Limitations

A serial console cannot be attached to a multiport card or onethat uses special drivers; it must be on a standard COM1card.

Files


/dev/console
tty to which first shell is attached, used for system maintenance

/dev/systty
system error messages display device, linkedinitially to/dev/console

/dev/syscon
system console device, linked to the tty from whichinit(M)was last invoked

/etc/ioctl.syscon
default consoleioctl(S)settings used byinit(M)

/dev/tty[02-n]
provide character I/O between keyboard and monitor

/dev/color

/dev/monochrome

/dev/ega

/dev/vga


/etc/conf/pack.d/cn/class.h
list of existing video classes, generated bymkdev graphics


/usr/include/sys/vtkd.h

/usr/include/sys/comcrt.h
adapter types for console multiscreens

/usr/include/sys/console.h

/usr/include/sys/keyboard.h

See also

boot(HW),init(M),ioctl(S),keyboard(HW),mapchan(M),mapkey(M),multiscreen(M),scancode(HW),setcolor(C),stty(C),termcap(F),tty(M),vidi(C),

``System console bootstring'' in theSCO OpenServer Handbook

``Configuring video adapters'' inConfiguring Video Adapters

``Setting up serial consoles'' in theSCO OpenServer Handbook


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003

[8]ページ先頭

©2009-2025 Movatter.jp