mirror of
https://github.com/bradgrantham/apple2a.git
synced 2024-10-31 23:09:39 +00:00
Draw BASIC prompt.
This commit is contained in:
parent
dfaa8ab3a2
commit
f66faacda9
42
main.c
42
main.c
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user