To cover all possible corners, I implemented double buffering and it didn't make the slightest bit of difference. The flashing occurs about twice a second and (again) on all but one line (which is the most confusing thing).
Here are the textmode functions which are called:
Code: Select all
word *screen_memory = (word *)0;
word *screen_memory1 = (word *)0x000B8000;
void textmode_install(void)
{
screen_memory = (word *)malloc(80 * 25 * sizeof(word));
}
void textmode_flush(void)
{
memcpyw(screen_memory1, screen_memory, 80 * 25);
}
void textmode_clear(void)
{
memsetw(screen_memory, (text_color << 8) | ' ', 80 * 25);
cursor_xpos = 0, cursor_ypos = 0;
textmode_updatecursor();
}
void textmode_writeline(char *line, int index)
{
bool null = FALSE;
int i;
for(i = 0; i < 80; i++) {
if(!null) {
if(line[i])
screen_memory[(80 * index) + i] = (text_color << 8) | line[i];
else
null = TRUE;
}
if(null) screen_memory[(80 * index) + i]= (text_color << 8) | ' ';
}
}
It basically scans through a linked list to find the 23 events which are going to occur next, places them in order, and displays them to the screen
Code: Select all
event_t *EventList[23];
memset(&EventList, 0, sizeof(event_t *) * 23);
event_t *EventPointer = FirstEvent;
int i;
while(EventPointer) {
for(i = 0; i < 23; i++) {
if(!EventList[i]) {
EventList[i] = EventPointer;
break;
}else if(EarlierRecord(&(EventPointer->TimeOfEvent), &(EventList[i]->TimeOfEvent))) {
memmove(&(EventList[i + 1]), &(EventList[i]), 23 - i);
EventList[i] = EventPointer;
break;
}
}
EventPointer = EventPointer->NextEvent;
}
record_t CurrentTime;
rtc_CopyTime(&CurrentTime);
char HeaderLineOne[] = "00:00:00 00/00/00 - TimetableOS by Andrew Carter";
char HeaderLineTwo[] = "Time Date ID Description";
RecordToString(&CurrentTime, HeaderLineOne);
textmode_settextcolor(COLOR_BLACK, COLOR_LTRED);
textmode_clear();
textmode_settextcolor(COLOR_BLACK, COLOR_LTBROWN);
textmode_writeline(HeaderLineOne, 0);
textmode_settextcolor(COLOR_BLACK, COLOR_RED);
textmode_writeline(HeaderLineTwo, 1); // << Line which isn't flashing
textmode_settextcolor(COLOR_BLACK, COLOR_LTRED);
static char buffer[80] = "00:00:00 00/00/00 ";
buffer[22] = ' ';
for(i = 0; EventList[i] && (i < 23); i++){
RecordToString(&(EventList[i]->TimeOfEvent), buffer);
memcpy(buffer + 18, EventList[i]->ID, 4);
memcpy(buffer + 23, EventList[i]->Description, 57);
textmode_writeline(buffer, 2 + i);
}
textmode_flush();
HALP!?!?!

