FLASHing text is handled by CPU timing and not render loop

This commit is contained in:
Aaron Culliney 2016-01-17 11:59:34 -08:00
parent 175df18401
commit f8e4ba3551
4 changed files with 41 additions and 45 deletions

View File

@ -1277,6 +1277,35 @@ void video_redraw(void) {
video_setDirty();
}
void video_flashText(void) {
static bool normal = false;
normal = !normal;
// flash only if it's text or mixed modes.
if (softswitches & (SS_TEXT|SS_MIXED)) {
if (normal) {
colormap[ COLOR_FLASHING_BLACK].red = 0;
colormap[ COLOR_FLASHING_BLACK].green = 0;
colormap[ COLOR_FLASHING_BLACK].blue = 0;
colormap[ COLOR_FLASHING_WHITE].red = 0xff;
colormap[ COLOR_FLASHING_WHITE].green = 0xff;
colormap[ COLOR_FLASHING_WHITE].blue = 0xff;
} else {
colormap[ COLOR_FLASHING_BLACK].red = 0xff;
colormap[ COLOR_FLASHING_BLACK].green = 0xff;
colormap[ COLOR_FLASHING_BLACK].blue = 0xff;
colormap[ COLOR_FLASHING_WHITE].red = 0;
colormap[ COLOR_FLASHING_WHITE].green = 0;
colormap[ COLOR_FLASHING_WHITE].blue = 0;
}
video_setDirty();
}
}
// ----------------------------------------------------------------------------
// VBL/timing routines

View File

@ -279,11 +279,11 @@ static void *cpu_thread(void *dummyptr) {
int debugging_cycles0 = 0;
int debugging_cycles = 0;
#if DEBUG_TIMING
unsigned long dbg_ticks = 0;
#if DEBUG_TIMING
int speaker_neg_feedback = 0;
int speaker_pos_feedback = 0;
unsigned int dbg_cycles_executed = 0;
unsigned long dbg_cycles_executed = 0;
#endif
do
@ -469,6 +469,11 @@ static void *cpu_thread(void *dummyptr) {
TRACE_CPU_END();
}
dbg_ticks += EXECUTION_PERIOD_NSECS;
if ((dbg_ticks % (NANOSECONDS_PER_SECOND>>1)) == 0)
{
video_flashText(); // TODO FIXME : proper FLASH timing ...
}
#if DEBUG_TIMING
// collect timing statistics
if (speaker_neg_feedback > cycles_speaker_feedback)
@ -480,7 +485,6 @@ static void *cpu_thread(void *dummyptr) {
speaker_pos_feedback = cycles_speaker_feedback;
}
dbg_ticks += EXECUTION_PERIOD_NSECS;
if ((dbg_ticks % NANOSECONDS_PER_SECOND) == 0)
{
TIMING_LOG("tick:(%ld.%ld) real:(%ld.%ld) cycles exe: %d ... speaker feedback: %d/%d", t0.tv_sec, t0.tv_nsec, ti.tv_sec, ti.tv_nsec, dbg_cycles_executed, speaker_neg_feedback, speaker_pos_feedback);

View File

@ -117,6 +117,11 @@ void video_loadfont(int first, int qty, const uint8_t *data, int mode);
*/
void video_redraw(void);
/*
* Toggles FLASHing text between NORMAL and INVERSE character sets.
*/
void video_flashText(void);
/*
* Clear the current display.
*/

View File

@ -408,36 +408,8 @@ static void post_image() {
}
}
static void c_flash_cursor(int on) {
// flash only if it's text or mixed modes.
if (softswitches & (SS_TEXT|SS_MIXED))
{
if (!on)
{
colormap[ COLOR_FLASHING_BLACK].red = 0;
colormap[ COLOR_FLASHING_BLACK].green = 0;
colormap[ COLOR_FLASHING_BLACK].blue = 0;
colormap[ COLOR_FLASHING_WHITE].red = (uint8_t)0xffff;
colormap[ COLOR_FLASHING_WHITE].green = (uint8_t)0xffff;
colormap[ COLOR_FLASHING_WHITE].blue = (uint8_t)0xffff;
}
else
{
colormap[ COLOR_FLASHING_WHITE].red = 0;
colormap[ COLOR_FLASHING_WHITE].green = 0;
colormap[ COLOR_FLASHING_WHITE].blue = 0;
colormap[ COLOR_FLASHING_BLACK].red = (uint8_t)0xffff;
colormap[ COLOR_FLASHING_BLACK].green = (uint8_t)0xffff;
colormap[ COLOR_FLASHING_BLACK].blue = (uint8_t)0xffff;
}
}
}
void video_driver_sync(void) {
static int flash_count = 0;
// post the image and loop waiting for it to finish and
// also process other input events
post_image();
@ -478,20 +450,6 @@ void video_driver_sync(void) {
} while (keyevent);
#endif
#warning HACKISH flash count needs refactoring ...
switch (++flash_count)
{
case 6:
c_flash_cursor(1);
break;
case 12:
c_flash_cursor(0);
flash_count = 0;
break;
default:
break;
}
}
static void _redo_image(void);