General Info | |
Interface: TextVideo Files: textvideo.h Last change: 22/06/2003 Author: Luiz Henrique Shigunov |
Description
Structures |
System Functions | |
0x00 - Clear - Clear screen region 0x01 - GetCurrentMode - Get current screen mode 0x02 - GetModeDesc - Get a mode description 0x09 - GetStatus - Get current mode status 0x03 - Scroll - Scroll screen |
0x04 - SetAttrib - Set char attributes 0x05 - SetCursorPos - Set cursor position 0x06 - SetCursorType - Set cursor type 0x07 - SetMode - Set current screen mode 0x08 - Write - Print with current attributes |
User Functions | |
0x0a - UClear - Clear screen region 0x0b - UGetCurrentMode - Get current screen mode 0x0c - UGetModeDesc - Get a mode description 0x0d - UGetStatus - Get current mode status 0x0e - UScroll - Scroll screen |
0x0f - USetAttrib - Set char attributes 0x10 - USetCursorPos - Set cursor position 0x11 - USetCursorType - Set cursor type 0x12 - USetMode - Set current screen mode 0x13 - UWrite - Print with current attributes |
This page describes the TextVideo interface which provides access to a console.
This interface is used by programs that use a console.
The first line is line 0 and the first column is column 0.
Where rows is the number of rows and cols the number of columns.
flags is the sum of:
Where row and col is the cursor position, attrib the char attributes and cursorType the cursor type.
These functions are exclusive for system modules.
void TextVideo_Clear(unsigned int row, unsigned int col, unsigned int height, unsigned int width);
This function clears screen region defined by row,col and size height lines and width columns.
The screen is cleared using space char with current attributes.
unsigned int TextVideo_GetCurrentMode(void);
This function gets current screen mode.
Returned value can be used with GetModeDesc to get mode description.
int TextVideo_GetModeDesc(unsigned int mode, TextVideo_ModeDesc *desc);
This function gets mode description.
typedef struct {
unsigned int rows;
unsigned int cols;
int flags;
} TextVideo_ModeDesc;
typedef struct {
unsigned int row;
unsigned int col;
int attrib;
int cursorType;
} TextVideo_Status;
System Functions
0x00 - Clear
Syntax
Properties
Description
Return value
0x01 - GetCurrentMode
Syntax
Properties
Description
Return value
0x02 - GetModeDesc
Syntax
Properties
Description
Return value
int TextVideo_GetStatus(TextVideo_Status *status);
This function gets current mode status.
int TextVideo_Scroll(unsigned int top, unsigned int bottom, unsigned int lines, int dir);
This function scrolls the lines inside the region defined by lines top-bottom, including.
dir is the direction and lines the number of lines to scroll.
The opened space is filled the same way as Clear does.
dir must be 0 or:
For instance, to scroll the region 0-10, 5 lines up (moving lines 5-10 to 0-4) just call Scroll(0, 10, 5, 0).
void TextVideo_SetAttrib(int attrib);
This function sets char attributes to attrib, which has this format:
Bits | Description |
---|---|
0-1 | Intensity: 0 - half-bright; 1 - normal; 2 - bold |
2 | Underline |
3 | Blink |
4 | Reverse |
5-15 | Reserved |
16-23 | Background color |
24-31 | Foreground color |
The following colors are defined:
Value | Color |
---|---|
0x00 | Black |
0x01 | Red |
0x02 | Green |
0x03 | Brown |
0x04 | Blue |
0x05 | Magenta |
0x06 | Cyan |
0x07 | White |
Not all attributes may be supported. Mode description tells what is supported.
For instance, to set normal, blink, black background and blue foreground: 0x04000009
void TextVideo_SetCursorPos(unsigned int row, unsigned int col);
This function sets cursor position to row,col.
void TextVideo_SetCursorType(int type);
This functions sets cursor type to type.
type must be:
int TextVideo_SetMode(unsigned int mode);
This function sets current mode to mode.
Upon setting a mode the screen is cleared, cursor position is set to line 0 column 0 and default settings are restored (char attributes, cursor type).
int TextVideo_Write(const char *text, int size);
This function prints text with size in the current position and with current attributes.
text can be a pointer to user memory, and so it can generate an access violation exception.
If text reachs the end of line it goes to the start of a new line and if text reachs the end of the last line, lines are moved one line up.
This function supports two control chars: 0xd (\r) - return to the start of a line and 0xa (\n) - change of line and return to the start of line.
These functions were designed for user modules.
int TextVideo_UClear(unsigned int row, unsigned int col, unsigned int height, unsigned int width);
User modules
The same as Clear.
unsigned int TextVideo_UGetCurrentMode(void);
User modules
The same as GetCurrentMode.
int TextVideo_UGetModeDesc(unsigned int mode, TextVideo_ModeDesc *desc);
User modules
The same as GetModeDesc.
The same as GetModeDesc, plus:
int TextVideo_UGetStatus(TextVideo_Status *status);
User modules
The same as GetStatus.
The same as GetStatus, plus:
int TextVideo_UScroll(unsigned int top, unsigned int bottom, unsigned int lines, int dir);
User modules
The same as Scroll.
The same as Scroll, plus:
int TextVideo_USetAttrib(int attrib);
User modules
The same as SetAttrib.
int TextVideo_USetCursorPos(unsigned int row, unsigned int col);
User modules
The same as SetCursorPos.
int TextVideo_USetCursorType(int type);
User modules
The same as SetCursorType.
int TextVideo_USetMode(unsigned int mode);
User modules
The same as SetMode.
The same as SetMode, plus:
int TextVideo_UWrite(const char *text, int size);
User modules
The same as Write.
The same as Write, plus: