2018-08-12 19:59:08 -04:00
|
|
|
|
2019-12-02 22:16:11 -06:00
|
|
|
/*
|
|
|
|
This is a demonstration of the TMS9928A's
|
|
|
|
40 x 24 monochrome text mode.
|
|
|
|
*/
|
|
|
|
|
2018-08-12 19:59:08 -04:00
|
|
|
#include <cv.h>
|
|
|
|
#include <cvu.h>
|
2017-05-02 09:09:53 -04:00
|
|
|
|
2019-08-19 10:24:22 -04:00
|
|
|
#include "common.h"
|
|
|
|
//#link "common.c"
|
2020-06-30 21:14:33 -05:00
|
|
|
//#link "fonts.s"
|
2017-05-02 09:09:53 -04:00
|
|
|
|
2017-05-25 15:49:30 -04:00
|
|
|
void setup_text_mode() {
|
2019-12-02 22:16:11 -06:00
|
|
|
// set screen mode to text
|
2017-05-02 09:09:53 -04:00
|
|
|
cv_set_screen_mode(CV_SCREENMODE_TEXT);
|
2019-12-02 22:16:11 -06:00
|
|
|
// set image table address, which defines grid of characters
|
2017-05-25 15:49:30 -04:00
|
|
|
cv_set_image_table(IMAGE);
|
2019-12-02 22:16:11 -06:00
|
|
|
// set pattern table address, which defines character graphics
|
2017-05-25 15:49:30 -04:00
|
|
|
cv_set_character_pattern_t(PATTERN);
|
2019-12-02 22:16:11 -06:00
|
|
|
// clear VRAM to all zeroes
|
2018-11-27 10:14:24 -05:00
|
|
|
cvu_vmemset(0, 0, 0x4000);
|
2019-12-02 22:16:11 -06:00
|
|
|
// copy default character set from ROM to VRAM
|
2019-08-19 10:24:22 -04:00
|
|
|
copy_default_character_set();
|
2017-05-02 09:09:53 -04:00
|
|
|
}
|
|
|
|
|
2017-05-25 15:49:30 -04:00
|
|
|
void show_text() {
|
2019-12-02 22:16:11 -06:00
|
|
|
// set background and foreground colors
|
2017-05-02 09:09:53 -04:00
|
|
|
cv_set_colors(CV_COLOR_LIGHT_GREEN, CV_COLOR_BLACK);
|
2019-12-02 22:16:11 -06:00
|
|
|
// fill image table with '.' characters
|
2017-05-25 15:49:30 -04:00
|
|
|
cvu_vmemset(IMAGE, '.', 40*24);
|
2019-12-02 22:16:11 -06:00
|
|
|
// draw message at row 0, column 1
|
|
|
|
cvu_memtovmemcpy(IMAGE + 1, "Greetings Professor Falken", 26);
|
|
|
|
// turn on display
|
2017-05-02 09:09:53 -04:00
|
|
|
cv_set_screen_active(true);
|
2017-05-25 15:49:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
setup_text_mode();
|
|
|
|
show_text();
|
2019-12-02 22:16:11 -06:00
|
|
|
while (1); // infinite loop
|
2017-05-02 09:09:53 -04:00
|
|
|
}
|