[Home]
[Search]
[CTG]
[RTL]
[IDDE]
Last update Apr 12, 2002
| Function | Description |
|---|---|
| disp_box | Draws a box. |
| disp_close | Closes the display. |
| disp_eeol | Erases to the end of current line. |
| disp_eeop | Erases to the end of the page. |
| disp_endstand | Ends reverse video mode. |
| disp_fillbox | Fills the box. |
| disp_flush | Moves the cursor to coincide with output position. |
| disp_getattr | Gets display attributes. |
| disp_getmode | Gets the current video mode. |
| disp_hidecursor | Hides the cursor. |
| disp_move | Moves the cursor position. |
| disp_open | Initializes the display. |
| disp_peekbox | Stores a defined rectangular area. |
| disp_peekw | Reads the information at specified position defined by row/column. |
| disp_pokebox | Restores a previously defined rectangular area. |
| disp_pokew | Puts an attribute/character into a specified row/column. |
| disp_printf | Writes to the screen. |
| disp_putc | Writes a character to an output location. |
| disp_puts | Writes a string to an output location. |
| disp_reset43 | Resets the display to 80-by-25 mode. |
| disp_scroll | Scrolls the screen up. |
| disp_set43 | Sets the display to 80-by-43 EGA text mode (80-by-50 VGA). |
| disp_setattr | Sets display attributes for characters. |
| disp_setcursortype | Modifies cursor appearance. |
| disp_setmode | Sets video mode. |
| disp_showcursor | Restores previously hidden cursor. |
| disp_startstand | Prints characters in reverse video. |
| disp_usebios | Sets up to write to the screen. |
The idea is to use disp_open() to open the display, perform the I/O to the display, and then disp_close() it. All writes to the display are done with disp functions, not functions that write to stdout.
The screen cells are addressed by row and column. (0,0) addresses the upper left cell, and (disp_numrows - 1, disp_numcols - 1) addresses the lower right cell.
A simple hello world program would be:
#include <disp.h>
int main()
{
disp_open();
disp_printf("hello world!\r\n");
disp_close();
return 0;
}
Values for type are:
| Value | Description |
|---|---|
| 0 | double line border |
| 1 | single line border |
| 2 | solid line border |
| 3 | double horizontal, single vertical |
| 4 | single horizontal, double vertical |
#include <disp.h>
int main()
{
disp_open();
disp_move(0,0);
disp_eeop();
disp_close();
return 0;
}
The attributes can be a hex value, or one of the predefined values:
| Name | Description |
|---|---|
| DISP_REVERSEVIDEO | reverse video text |
| DISP_NORMAL | normal text |
| DISP_UNDERLINE | underlined text (mono only) |
| DISP_NONDISPLAY | black on black text |
The following bits can be OR'd in:
| Name | Description |
|---|---|
| DISP_INTENSITY | bold face |
| DISP_BLINK | blinking text (mono only) |
#include <disp.h>
int main()
{
int attr;
disp_open();
attr = disp_getattr(); // save original attribute
disp_setattr(0x7C); // set to red on grey
disp_printf("hello world!");
disp_setattr(attr); // restore original attribute
disp_printf("\r\n");
disp_close();
return 0;
}
The globals are read-only, and are:
| Name | Description |
|---|---|
| disp_mono | 0 if color and 1 if monochrome |
| disp_snowycga | !=0 if original IBM CGA |
| disp_mode | Current display mode. See disp_setmode(). |
| disp_inited | !=0 if disp package is open. |
| disp_ega | !=0 if IBM EGA or VGA compatible display. |
| disp_base | Segment of video display RAM (MDA=0xB000, CGA = 0xB800). |
| disp_numrows | Number of rows in the display. |
| disp_numcols | Number of columns in the display. |
| disp_cursorrow | Row of cursor position. |
| disp_cursorcol | Column of cursor position. |
#include <stdio.h>
#include <disp.h>
int main()
{ int attchar,segment,i,row,col;
disp_open();
disp_move(0,0); // move cursor to upper left corner
disp_eeop(); // clear screen
disp_printf("\r\n0123456789ABCDEF 0123456789ABCDEF\n");
i = 0;
for (row = 0; row < 16; row++)
{ for (col = 0; col < 16; col++)
{
attchar = 0x0700 + i;
disp_pokew(row + 2, col, attchar);
attchar = 0x0041 + i * 256;
disp_pokew(row + 2, col + 18, attchar);
i++;
}
}
for (i = 0; i < 16; i++)
disp_printf("\n");
disp_close();
return 0;
}
The output is:
#include <disp.h>
int main()
{
disp_open();
disp_printf("hello world!\r\n");
disp_close();
return 0;
}
The following special characters are recognized:
| Character | Action |
|---|---|
| 0x07 | rings bell |
| 0x08 | backspace |
| 0x09 | advance to next tab stop (8 column tabs) |
| 0x0A | linefeed, advance to next line. Scroll if at bottom. |
| 0x0B | vertical tab, same as linefeed. |
| 0x0C | form feed, same as linefeed. |
| 0x0D | carriage return |
| 0x7F | del; ignored |
If the cursor reaches the right edge of the display, if disp_nowrap is 0, it just stays there. If it is 1, the cursor is advanced to the beginning of the next line.
| Parameter | Description |
|---|---|
| lines | number of lines to scroll; negative means scroll down |
| ulrow | upper left row of area to scroll |
| ulcol | upper left column of area to scroll |
| lrrow | lower right row of area to scroll |
| lrcol | lower right column of area to scroll |
| attr | video attribute to use on uncovered areas |
| Mode | Start | End | type |
|---|---|---|---|
| monochrome | 11 | 12 | ((11*256)+12) |
| color | 6 | 7 | ((6*256)+7) |
Or, the following predefined cursor types can be used:
| Name | Description |
|---|---|
| DISP_CURSORBLOCK | block cursor |
| DISP_CURSORHALF | half height cursor |
| DISP_CURSORUL | underline cursor |
Common video modes are:
| Mode | Size | Display Card |
|---|---|---|
| 0 | 40 x 25 B/W text | CGA/EGA |
| 1 | 40 x 25 color text | CGA/EGA |
| 2 | 80 x 25 B/W text | CGA/EGA |
| 3 | 80 x 25 color text | CGA/EGA |
| 4 | 320 x 200 color graphics | CGA/EGA |
| 5 | 320 x 200 B/W graphics | CGA/EGA |
| 6 | 640 x 200 color graphics | CGA/EGA |
| 7 | 80 x 25 B/W text | MDA / EGA with mono display |
| 0xD | 320 x 200 16 color | EGA |
| 0xE | 640 x 200 16 color | EGA |
| 0xF | 640 x 350 4 color | EGA with mono display |
| 0x10 | 640 x 350 16 color | EGA |