VGA Text Display Library  v0.8
Display text on a VGA monitor
Macros | Functions
vgatext.c File Reference

Displays text on a VGA monitor. More...

#include <propeller.h>
#include "vgatext.h"

Macros

#define INLINE__   static
#define PostEffect__(X, Y)   (tmp__ = (X), (X) = (Y), tmp__)
#define waitcnt(n)   _waitcnt(n)
#define locknew()   _locknew()
#define lockret(i)   _lockret(i)
#define lockset(i)   _lockset(i)
#define lockclr(i)   _lockclr(i)
#define coginit(id, code, par)   _coginit((unsigned)(par)>>2, (unsigned)(code)>>2, id)
#define cognew(code, par)   coginit(0x8, (code), (par))
#define cogstop(i)   _cogstop(i)

Functions

INLINE__ int32_t Rotl__ (uint32_t a, uint32_t b)
INLINE__ int32_t Rotr__ (uint32_t a, uint32_t b)
INLINE__ int32_t Shr__ (uint32_t a, uint32_t b)
INLINE__ int32_t Between__ (int32_t x, int32_t a, int32_t b)
INLINE__ int32_t Lookup__ (int32_t x, int32_t b, int32_t a[], int32_t n)
int32_t vga_text_start (int32_t Basepin)
 Start the VGA text display.
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.
int32_t vga_text_dec (int32_t Value)
 Display a value as decimal text.
int32_t vga_text_hex (int32_t Value, int32_t Digits)
 Display a value as hexadecimal text.
int32_t vga_text_bin (int32_t Value, int32_t Digits)
 Display a value as binary text.
int32_t vga_text_out (int32_t C)
 Display a character.
int32_t vga_text_setcolors (int32_t Colorptr)
 Override color palette.

Detailed Description

Displays text on a VGA monitor.

Author
Spin + ASM by Chip Gracey Converted from Spin + ASM with Eric Smith's Spin2Cpp utility

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 sycn) 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.