VGA_Text native device driver interface.
More...
Go to the source code of this file.
|
enum | vgaTextStat_t {
VGA_TEXT_STAT_DISABLED,
VGA_TEXT_STAT_INVISIBLE,
VGA_TEXT_STAT_VISIBLE
} |
|
VGA_Text native device driver interface.
- Author
- Steve Denson
- Copyright
- Copyright (C) Parallax Inc. 2014. All Rights MIT Licensed, see end of file.
- Core Usage
- A call to vgatext_open will launch 1 additional core that supplies signaling necessary for displaying text with a VGA display.
- Memory Models
- Use with CMM, LMM, XMM.
- Version
- v0.90
- Note
- Currently setting individual character foreground/background colors does not work. Setting a screen palette is OK with setColorPalette(&gpalette[VGA_TEXT_PAL_MAGENTA_BLACK]);
- Help Improve this Library
- Please submit bug reports, suggestions, and improvements to this code to edito.nosp@m.r@pa.nosp@m.ralla.nosp@m.x.co.nosp@m.m.
Definition in file vgatext.h.
Control structure
Definition at line 110 of file vgatext.h.
Class Members |
long |
colors |
|
long |
enable |
|
long |
hb |
|
long |
hd |
|
long |
hf |
|
long |
ho |
|
long |
hs |
|
long |
ht |
|
long |
hx |
|
long |
mode |
|
char * |
palette |
|
long |
pins |
|
long |
rate |
|
long |
screen |
|
long |
status |
|
long |
vb |
|
long |
vd |
|
long |
vf |
|
long |
vo |
|
long |
vs |
|
long |
vt |
|
long |
vx |
|
#define VGA_TEXT_COLORTABLE_SIZE 8*2 |
Color table size. Table holds foreground and background info, so size is 2 x table colors.
Definition at line 76 of file vgatext.h.
Last row position count
Definition at line 96 of file vgatext.h.
#define VGA_TEXT_PAL_WHITE_BLUE 0 |
VGA_Text palette color indices
Definition at line 62 of file vgatext.h.
Screen size count
Definition at line 91 of file vgatext.h.
Status enumeration
Definition at line 101 of file vgatext.h.
void vgatext_close |
( |
vgatext * |
device | ) |
|
Close VGA connection, stop and recover cog running VGA code and memory that was allocated.
- Parameters
-
*device | value that was returned by vgatext_open. |
Definition at line 37 of file vgatext.c.
int vgatext_getColors |
( |
void |
| ) |
|
Get palette color index.
- Returns
- number representing color set index See vgatext color indices.
Definition at line 441 of file vgatext.c.
int vgatext_getColumns |
( |
void |
| ) |
|
Get screen width.
- Returns
- Screen column count.
Definition at line 450 of file vgatext.c.
int vgatext_getRows |
( |
void |
| ) |
|
Get screen height.
- Returns
- Screen row count.
Definition at line 459 of file vgatext.c.
int vgatext_getX |
( |
void |
| ) |
|
get cursor's column position.
- Returns
- columns from left.
Definition at line 414 of file vgatext.c.
int vgatext_getY |
( |
void |
| ) |
|
Get cursor's row position.
- Returns
- rows from top.
Definition at line 423 of file vgatext.c.
vgatext* vgatext_open |
( |
int |
basepin | ) |
|
Open a VGA connection. This function launches VGA driver code into the next available cog.
- Parameters
-
basepin | can be 0, 8, 16, or 24, which correspond to base pins of P0, P8, or P16 or P24. The basepin should be connected to VGA V, basepin + 1 to VGA H, and so on... Here is the full connection list. |
basepin Connected to
- 7 R1
- 6 R0
- 5 G1
- 4 G0
- 3 B1
- 2 B0
- 1 H
- 0 V
- Returns
- vgatext identifier. It's the address that gets copied to a pointer variable, which is passed as an identifier to simpletext functions with text_t *dev parameters and/or vgatext functions with vgatext *vga parameters.
Definition at line 23 of file vgatext.c.
Prints a character at current cursor position or performs a screen function based on the following table:
0 = clear screen
1 = home
8 = backspace
9 = tab (8 spaces per)
10 = set X position (X follows)
11 = set Y position (Y follows)
12 = set color (color follows)
13 = return
16 = clear screen
others = printable characters
- Parameters
-
Definition at line 247 of file vgatext.c.
int vgatext_putchar |
( |
vgatext * |
vga, |
|
|
int |
c |
|
) |
| |
Print character to screen.
- Parameters
-
*vga | the device identifier |
c | is character to print |
Definition at line 306 of file vgatext.c.
void vgatext_setColorPalette |
( |
char * |
palette | ) |
|
sets the palette using a character array. This overrides the default color palette.
Each custom color palette is defined in a byte with values of r, g, and b that can range from 0 to 3, and are packed as follows:
Example: Set color palette 0 foreground to r = 1, g = 2, b = 3 and background to r = 3, b = 0, and g = 1. Also set color palette 1's foreground with color palette 0's background and vice-versa.
char custom[16];
custom[0] = (1 << 4) | (2 << 2) | 3; // Foreground 0
custom[1] = (3 << 4) | (0 << 2) | 1; // Background 0
custom[2] = (3 << 4) | (0 << 2) | 1; // Foreground 1
custom[3] = (1 << 4) | (2 << 2) | 3; // Background 1
// ...etc up to custom[15] for background 7
- Parameters
-
palette | is a char array[16]. |
Definition at line 186 of file vgatext.c.
void vgatext_setColors |
( |
int |
value | ) |
|
Set palette color index.
- Parameters
-
value | is a color set index number 0 .. 7 See vgatext color indices. |
Definition at line 432 of file vgatext.c.
void vgatext_setCoordPosition |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Set cursor position to Cartesian x, y from bottom-left.
- Parameters
-
x | is column counted from left. |
y | is row counted from bottom. |
Definition at line 375 of file vgatext.c.
void vgatext_setX |
( |
int |
x | ) |
|
Set cursor to x columns from left.
- Parameters
-
Definition at line 396 of file vgatext.c.
void vgatext_setXY |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Set position to x rows and y columns from top-left.
- Parameters
-
x | columns from left. |
y | rows from top. |
Definition at line 386 of file vgatext.c.
void vgatext_setY |
( |
int |
y | ) |
|
Set cursor to y rows from top.
- Parameters
-
Definition at line 405 of file vgatext.c.