VGA Text Display Library  v0.85
Display text on a VGA monitor
Data Structures | Macros | Typedefs | Functions
vgatext.h File Reference

Displays text on a VGA monitor. To-do: Bring in features from Steve Denson's VgaText application: https://code.google.com/p/propgcc/source/browse/demos/#demos%2FVgaText Note, this library is still preliminary; revisions are pending. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  VGA_Text
 
struct  vgaSpin
 

Macros

#define Cols   (32)
 
#define Rows   (15)
 
#define Screensize   (480)
 
#define Lastrow   (448)
 
#define Vga_count   (21)
 
#define vgaSpin_Class_Defined__
 
#define Paramcount   (21)
 
#define Colortable   (384)
 

Typedefs

typedef struct VGA_Text VGA_Text
 
typedef struct vgaSpin vgaSpin
 

Functions

int32_t vga_text_start (int32_t Basepin)
 Start the VGA text display. More...
 
int32_t vga_text_stop (void)
 Stop the VGA display and free up a cog.
 
int32_t vga_text_str (char *Stringptr)
 Display a string. More...
 
int32_t vga_text_dec (int32_t Value)
 Display a value as decimal text. More...
 
int32_t vga_text_hex (int32_t Value, int32_t Digits)
 Display a value as hexadecimal text. More...
 
int32_t vga_text_bin (int32_t Value, int32_t Digits)
 Display a value as binary text. More...
 
int32_t vga_text_out (int32_t C)
 Display a character. More...
 
int32_t vga_text_setcolors (int32_t Colorptr)
 Override color palette. More...
 
int32_t vgaSpin_Start (int32_t Vgaptr)
 
int32_t vgaSpin_Stop (void)
 

Detailed Description

Displays text on a VGA monitor. To-do: Bring in features from Steve Denson's VgaText application: https://code.google.com/p/propgcc/source/browse/demos/#demos%2FVgaText Note, this library is still preliminary; revisions are pending.

Author
Spin + ASM by Chip Gracey Converted from Spin + ASM with Eric Smith's Spin2Cpp utility Commented and function names adjusted by Andy Lindsay
Version
0.85

Function Documentation

int32_t vga_text_bin ( int32_t  Value,
int32_t  Digits 
)

Display a value as binary text.

Parameters
ValueThe value to display.
DigitsThe number of digits to display.
int32_t vga_text_dec ( int32_t  Value)

Display a value as decimal text.

Parameters
ValueThe value to display.
int32_t vga_text_hex ( int32_t  Value,
int32_t  Digits 
)

Display a value as hexadecimal text.

Parameters
ValueThe value to display.
DigitsThe number of digits to display
int32_t vga_text_out ( int32_t  C)

Display a character.

Parameters
CCharacter to print. This could be a printable character like 'a', 'b', 'Z', '&', '~', or non-printable control characters

Non-Printable Control Characters (with simpletools constants when they match.)

CLS = 0 HOME = 1 BKSPC = 8 10 (next character should be a position number) 11 (next character should be a position number) 12 set color (color pointer value follows) CR = 13

int32_t vga_text_setcolors ( int32_t  Colorptr)

Override color palette.

Parameters
ColorptrPoints to a list of up to 8 colors.

Each color is two bytes: foreground, background. Red, green and blue can each be values from 0 to 3. char foreground = (red << 4) | (green << 2) | blue Example: If you want the foreground to have a red value of 2, a green value of 1 and a blue value of 3, use char foreground = (2 << 4) | (1 << 2) | 3

int32_t vga_text_start ( int32_t  Basepin)

Start the VGA text display.

Parameters
Basepinpin connected to VGA's V (vertical sync) input. Must be P0, P8, P16, or P24. Counting upward from this pin, the connections are: H, B0, B1, G0, G1, R0, R1. Example: if the Basepin is set to 8, P8 is connected to H, P9 to V, P10 to B0, and so on, up through P15 to R1.
Returns
Nonzero if successfully launched, or zero if no cog available.
int32_t vga_text_str ( char *  Stringptr)

Display a string.

Parameters
StringptrA pointer to a text string.