Draw BASIC prompt.

This commit is contained in:
Lawrence Kesteloot 2018-07-31 00:05:22 -07:00
parent dfaa8ab3a2
commit f66faacda9

42
main.c
View File

@ -4,6 +4,29 @@ unsigned char title_length = 9;
volatile unsigned char *text_page1_base = (unsigned char *)0x400;
volatile unsigned char *text_page2_base = (unsigned char *)0x800;
/**
* Delay for a count of "t". 8000 is about one second.
*/
static void delay(int t) {
while (t >= 0) {
t--;
}
}
/**
* Clear the screen with non-reversed spaces.
*/
static void home() {
volatile unsigned char *p = text_page1_base;
unsigned char ch = ' ' | 0x80;
int i;
// TODO: Could write these as words, not chars.
for (i = (40 + 40 + 48)*8; i >= 0; i--) {
*p++ = ch;
}
}
int main(void)
{
int offset = (40 - title_length) / 2;
@ -12,13 +35,24 @@ int main(void)
int i;
for(i = 0; i < (40 + 40 + 65) * 8; i++) {
text_page1_base[i] = ' ' | 0x80;
}
home();
// Title.
for(i = 0; i < title_length; i++) {
loc[i] = title[i] | 0x80;
}
while(1);
// Prompt.
loc = text_page1_base + (40 + 40 + 48)*2;
*loc++ = ']' | 0x80;
// Cursor.
while(1) {
*loc = 127 | 0x80;
delay(2500);
*loc = ' ' | 0x80;
delay(2500);
}
return 0;
}