3 console, keyboard, log \- system console
5 The TTY device driver manages two devices related to the main user
6 interface, the system screen and the keyboard. These two together are
9 The screen of a PC can be managed by a Monochrome Display Adapter, a
10 Hercules card, a Color Graphics Adapter, an Enhanced Graphics Adapter,
11 or a Video Graphics Array. To the console driver these devices are
12 seen as a block of video memory into which characters can be written to
13 be displayed, an I/O register that sets the video memory origin to the
14 character that is to be displayed on the top-left position of the
15 screen, and an I/O register that sets the position of the hardware
16 cursor. Each character within video memory is a two-byte word. The low
17 byte is the character code, and the high byte is the "attribute byte",
18 a set of bits that controls the way the character is displayed,
19 character and background colours for a colour card, or
20 intensity/underline/reverse video for monochrome.
22 These are the characteristics of the adapters in text mode:
27 Adapter Usable memory Mono/Colour
37 MDA and Hercules are the same to the console driver, because the graphics
38 mode of the Hercules is of no use to MINIX 3. EGA and VGA are also mostly
39 seen as the same in text mode. An EGA adapter is either a monochrome or a
40 colour device depending on the screen attached to it. A VGA adapter can run
41 in either monochrome or colour (grayscale) mode depending on how the Boot
42 Monitor has initialized it.
44 The driver uses the video origin to avoid copying the screen contents when
45 scrolling up or down. Instead the origin is simply moved one line. This is
46 named "hardware scrolling", as opposed to copying memory: "software
49 The video origin is also used to implement several virtual consoles inside
50 the video memory of the adapter. Each virtual console gets a segment of
51 video memory. The driver chooses which console to display by moving the
52 video origin. Note that an MDA or Hercules adapter can only support one
53 console. CGA can support up to four 80x25 consoles, and EGA and VGA can
54 have eight. It is best to configure one less console to leave some video
55 memory free so that hardware scrolling has some space to work in.
57 Character codes are used as indices into a display font that is stored in the
58 adapter. The default font is the IBM character set, which is an ASCII
59 character set in the low 128 codes, and a number of mathematical, greek,
60 silly graphics, and accented characters in the upper 128 codes. This font
61 is fixed in the MDA, Hercules and CGA adapters, but can be replaced by a
62 user selected font for the EGA and VGA adapters.
64 A number of control characters and escape sequences are implemented by the
65 driver. The result is upward compatible with the ANSI standard terminal.
70 Normal characters written to the console are displayed at the cursor
71 position and the cursor is advanced one column to the right. If an entire
72 line is filled then the cursor wraps to the first column of the next line
73 when the next character must be displayed. The screen is scrolled up if
74 needed to start a new line. Some characters have special effects when sent
75 to the console. Some even have arguments in the form of comma separated
76 decimal numbers. These numbers default to the lowest possible value when
77 omitted. The top-left character is at position (1, 1). The following
78 control characters and escape sequences are implemented by the console:
81 Sequence Name Function
84 ^@ Null Ignored (padding character)
86 ^G Bell Produce a short tone from the speaker
88 ^H Backspace Move the cursor back one column, wrapping from the
89 left edge up one line to the right edge
91 ^I Horizontal Tab Move to the next tab stop, with each tab stop at
92 columns 1, 9, 25, etc. Wrap to the next line if necessary.
94 ^J Line Feed Move one line down, scrolling the screen up if
97 ^K Vertical Tab Same as LF
99 ^L Form Feed Same as LF
101 ^M Carriage Return Move to column 1
103 ^[ Escape Start of an escape sequence
105 ^[M Reverse Index Move one line up, scrolling the screen down if
108 ^[[\fIn\fPA Cursor Up Move the cursor up \fIn\fP lines
110 ^[[\fIn\fPB Cursor Down Move the cursor down \fIn\fP lines
112 ^[[\fIn\fPC Cursor Forward Move the cursor right \fIn\fP columns
114 ^[[\fIn\fPD Cursor Backward Move the cursor left \fIn\fP columns
116 ^[[\fIm\fP;\fIn\fPH Cursor Position Move the cursor to line \fIm\fP,
119 ^[[\fIs\fPJ Erase in Display Clear characters as follows:
121 \fIs\fP = 0: From cursor to end of screen
123 \fIs\fP = 1: From start of screen to cursor
125 \fIs\fP = 2: Entire screen
127 ^[[\fIs\fPK Erase in Line Clear characters as follows:
129 \fIs\fP = 0: From cursor to end of line
131 \fIs\fP = 1: From start of line to cursor
133 \fIs\fP = 2: Entire line
135 ^[[\fIn\fPL Insert Lines Insert \fIn\fP blank lines
137 ^[[\fIn\fPM Delete Lines Delete \fIn\fP lines
139 ^[[\fIn\fP@ Insert Characters Insert \fIn\fP blank characters
141 ^[[\fIn\fPP Delete Characters Delete \fIn\fP characters
143 ^[[\fIn\fPm Character Attribute Set character attribute as follows:
145 \fIn\fP = 0: Normal (default) attribute
147 \fIn\fP = 1: Bold (high intensity fg colour)
149 \fIn\fP = 4: Underline (mono) / Cyan (colour)
151 \fIn\fP = 5: Blinking
153 \fIn\fP = 7: Reverse Video
155 \fIn\fP = 30: Black foreground colour
165 \fIn\fP = 35: Magenta
169 \fIn\fP = 37: Light Gray
171 \fIn\fP = 39: Default fg colour (lt gray)
173 \fIn\fP = 40\-47: Same for background colour
175 \fIn\fP = 49: Default bg colour (black)
177 Note: The "bold" versions of black, brown and lt gray become dark gray,
181 The console device implements the following ioctl to copy a font into
182 font memory on EGA and VGA adapters:
185 .BI "ioctl(" fd ", TIOCSFON, u8_t " font "[256][32]);"
188 Font memory consists of 256 character definitions of 32 lines per character
189 and 8 pixels per line. The first line is the topmost line of the character.
190 The leftmost pixel is lit if the most significant bit of a line is set, etc.
191 How many lines are used depends on the current video mode. The 80x25 video
192 mode used by MINIX 3 has an 8x16 character cell, 80x28 has 8x14 characters,
193 and 132x43 or 132x50 has 8x8 characters. The boot variable
195 is used by both the Boot Monitor and the console driver to set the video
196 mode, software scrolling on/off, and VGA screen blank timeout. See
199 The keyboard produces key codes for each key that is pressed. These keys
200 are transformed into character codes or sequences according to the current
201 keyboard translation table. The format of this table is described in
203 The character codes can be read from the console device unless they map to
204 special hotkeys. The hotkeys are as follows:
210 CTRL\-ALT\-DEL Send an abort signal to process 1 (init). Init then
213 CTRL\-ALT\-KP-. Likewise for keypad period
215 F1 Process table dump
219 F3 Toggle software/hardware scrolling
221 F5 Show network statistics
223 CTRL\-F7 Send a quit signal to all processes connected to the console
225 CTRL\-F8 Send an interrupt signal
227 CTRL\-F9 Send a kill signal. If CTRL\-F8 or CTRL\-F7 don't get 'em,
228 then this surely will. These keys are for disaster recovery. You would
229 normally use DEL and CTRL\-\e to send interrupt and quit signals.
232 ALT\-F1 Select virtual console 0 (/dev/console)
234 ALT\-F2 Select virtual console 1 (/dev/ttyc1)
236 ALT\-F(\fIn\fP+1) Select virtual console \fIn\fP
239 ALT\-Left Select previous virtual console
241 ALT\-Right Select next virtual console
246 The keyboard map is set with the
248 ioctl whose precise details are currently hidden in the
254 device can be used by processes to print debug messages onto the console.
255 The console is a terminal type device, so it is taken from processes when a
256 session leader exits. This does not happen with the log device.
263 Output processing turns Line Feeds into CR LF sequences. Don't let this
264 surprise you. Either turn off output processing or use one of the synonyms
267 Kees J. Bot (kjb@cs.vu.nl)
268 .\" minor editing of man page by asw 07.08.96