Crt unit
CRT - Turbo Pascal screen and keyboard handling unit.
This chapter describes the CRT unit for Free Pascal, under all of Dos,
Linux and Windows. The unit was first written for Dos by Florian Klaempfl.
The unit was ported to Linux by Mark May and enhanced by Michael Van Canneyt
and Peter Vreman. It works on the Linux console, and in xterm and rxvt windows
under X-Windows. The functionality for both is the same, except that under
Linux the use of an early implementation (versions 0.9.1 and earlier of the
compiler) the CRT unit automatically cleared the screen at program startup.
There are some caveats when using the CRT unit:
- Programs using the CRT unit will not be usable when input/output is being redirected on the command-line.
- For similar reasons they are not usable as CGI-scripts for use with a webserver.
- The use of the CRT unit and the graph unit may not always be supported.
- The CRT unit is not thread safe.
- On Linux or other Unix OSes, executing other programs that expect special terminal behaviour (using one of the special functions in the Linux unit) will not work. The terminal is set in RAW mode, which will destroy most terminal emulation settings.
- The CRT unit stems from the TP/Dos area. It is designed to work with single-byte character sets, where 1 char = 1 byte. That means that widestrings or UTF-8 encoded (ansi)strings will not work correctly.
Procedures and functions
AssignCrt | procedure | Assign file to CRT. |
ClrEol | procedure | Clear from cursor position till end of line. |
ClrScr | procedure | Clear current window. |
cursorbig | procedure | Show big cursor. |
cursoroff | procedure | Hide cursor. |
cursoron | procedure | Display cursor. |
Delay | procedure | Delay program execution. |
DelLine | procedure | Delete line at cursor position. |
GotoXY | procedure | Set cursor position on screen. |
HighVideo | procedure | Switch to highlighted text mode. |
InsLine | procedure | Insert an empty line at cursor position. |
KeyPressed | function | Check if there is a keypress in the keybuffer. |
LowVideo | procedure | Switch to low intensity colors. |
NormVideo | procedure | Return to normal (startup) modus. |
NoSound | procedure | Stop system speaker. |
ReadKey | function | Read key from keybuffer. |
Sound | procedure | Sound system speaker. |
TextBackground | procedure | Set text background. |
TextColor | procedure | Set text color. |
TextMode | procedure | Set screen mode. |
WhereX | function | Return X (horizontal) cursor position. |
WhereY | function | Return Y (vertical) cursor position. |
Window | procedure | Create new window on screen. |
Types
tcrtcoord | type | Type to denote CRT coordinates. |
Constants
Black | constant | Black color attribute. |
Blink | constant | Blink attribute. |
Blue | constant | Blue color attribute. |
Brown | constant | Brown color attribute. |
BW40 | constant | 40 columns black and white screen mode. |
BW80 | constant | 80 columns black and white screen mode. |
C40 | constant | 40 columns color screen mode. |
C80 | constant | 80 columns color screen mode. |
CO40 | constant | 40 columns color screen mode. |
CO80 | constant | 80 columns color screen mode. |
Cyan | constant | Cyan color attribute. |
DarkGray | constant | Dark gray color attribute. |
Font8x8 | constant | Internal ROM font mode. |
Green | constant | Green color attribute. |
LightBlue | constant | Light Blue color attribute. |
LightCyan | constant | Light cyan color attribute. |
LightGray | constant | Light gray color attribute. |
LightGreen | constant | Light green color attribute. |
LightMagenta | constant | Light magenta color attribute. |
LightRed | constant | Light red color attribute. |
Magenta | constant | Magenta color attribute. |
Mono | constant | Monochrome screen mode (hercules screens). |
Red | constant | Red color attribute. |
ScreenHeight | constant | Current screen height. |
ScreenWidth | constant | Current screen width. |
White | constant | White color attribute. |
Yellow | constant | Yellow color attribute. |
Variables
CheckBreak | variable | Check for CTRL-Break keystroke. Not used. |
CheckEOF | variable | Check for EOF on standard input. Not used. |
CheckSnow | variable | Check snow on CGA screens. Not used. |
DirectVideo | variable | Use direct video access. DOS only. |
LastMode | variable | Last screen mode. |
TextAttr | variable | Mask to filter text attribute. |
WindMax | variable | Lower right corner of currently defined window. |
WindMaxX | variable | X coordinate of lower right corner of the defined window. |
WindMaxY | variable | Y coordinate of lower right corner of the defined window. |
WindMin | variable | Upper left corner of currently defined window. |
WindMinX | variable | X coordinate of upper left corner of the defined window. |
WindMinY | variable | Y coordinate of upper left corner of the defined window. |
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
