mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-07-01 01:29:43 +00:00
FLASHing text is handled by CPU timing and not render loop
This commit is contained in:
parent
175df18401
commit
f8e4ba3551
|
@ -1277,6 +1277,35 @@ void video_redraw(void) {
|
||||||
video_setDirty();
|
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
|
// VBL/timing routines
|
||||||
|
|
||||||
|
|
10
src/timing.c
10
src/timing.c
|
@ -279,11 +279,11 @@ static void *cpu_thread(void *dummyptr) {
|
||||||
int debugging_cycles0 = 0;
|
int debugging_cycles0 = 0;
|
||||||
int debugging_cycles = 0;
|
int debugging_cycles = 0;
|
||||||
|
|
||||||
#if DEBUG_TIMING
|
|
||||||
unsigned long dbg_ticks = 0;
|
unsigned long dbg_ticks = 0;
|
||||||
|
#if DEBUG_TIMING
|
||||||
int speaker_neg_feedback = 0;
|
int speaker_neg_feedback = 0;
|
||||||
int speaker_pos_feedback = 0;
|
int speaker_pos_feedback = 0;
|
||||||
unsigned int dbg_cycles_executed = 0;
|
unsigned long dbg_cycles_executed = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -469,6 +469,11 @@ static void *cpu_thread(void *dummyptr) {
|
||||||
TRACE_CPU_END();
|
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
|
#if DEBUG_TIMING
|
||||||
// collect timing statistics
|
// collect timing statistics
|
||||||
if (speaker_neg_feedback > cycles_speaker_feedback)
|
if (speaker_neg_feedback > cycles_speaker_feedback)
|
||||||
|
@ -480,7 +485,6 @@ static void *cpu_thread(void *dummyptr) {
|
||||||
speaker_pos_feedback = cycles_speaker_feedback;
|
speaker_pos_feedback = cycles_speaker_feedback;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg_ticks += EXECUTION_PERIOD_NSECS;
|
|
||||||
if ((dbg_ticks % NANOSECONDS_PER_SECOND) == 0)
|
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);
|
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);
|
||||||
|
|
|
@ -117,6 +117,11 @@ void video_loadfont(int first, int qty, const uint8_t *data, int mode);
|
||||||
*/
|
*/
|
||||||
void video_redraw(void);
|
void video_redraw(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Toggles FLASHing text between NORMAL and INVERSE character sets.
|
||||||
|
*/
|
||||||
|
void video_flashText(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear the current display.
|
* Clear the current display.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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) {
|
void video_driver_sync(void) {
|
||||||
|
|
||||||
static int flash_count = 0;
|
|
||||||
// post the image and loop waiting for it to finish and
|
// post the image and loop waiting for it to finish and
|
||||||
// also process other input events
|
// also process other input events
|
||||||
post_image();
|
post_image();
|
||||||
|
@ -478,20 +450,6 @@ void video_driver_sync(void) {
|
||||||
|
|
||||||
} while (keyevent);
|
} while (keyevent);
|
||||||
#endif
|
#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);
|
static void _redo_image(void);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user