Don't actually draw unless byte written to active page or page was swapped

- Avoids "flicker" in 80's apps that use double buffering
    - Possibly improves performance since we only take the render hit in page swap (or direct render to visible page)
This commit is contained in:
Aaron Culliney 2016-01-16 22:07:29 -08:00
parent 37e5143d73
commit 090f5f4db4
2 changed files with 38 additions and 12 deletions

View File

@ -703,25 +703,33 @@ static inline void _draw_text(uint16_t ea, uint8_t b, int page, uint32_t sw, uin
GLUE_C_WRITE(video__write_2e_text0) GLUE_C_WRITE(video__write_2e_text0)
{ {
base_textwrt[ea] = b; base_textwrt[ea] = b;
_draw_text(ea, b, 0, SS_TEXTWRT, SS_TEXT); if (!(softswitches & SS_PAGE2)) {
_draw_text(ea, b, 0, SS_TEXTWRT, SS_TEXT);
}
} }
GLUE_C_WRITE(video__write_2e_text0_mixed) GLUE_C_WRITE(video__write_2e_text0_mixed)
{ {
base_textwrt[ea] = b; base_textwrt[ea] = b;
_draw_text(ea, b, 0, SS_TEXTWRT, (SS_TEXT|SS_MIXED)); if (!(softswitches & SS_PAGE2)) {
_draw_text(ea, b, 0, SS_TEXTWRT, (SS_TEXT|SS_MIXED));
}
} }
GLUE_C_WRITE(video__write_2e_text1) GLUE_C_WRITE(video__write_2e_text1)
{ {
base_ramwrt[ea] = b; base_ramwrt[ea] = b;
_draw_text(ea, b, 1, SS_RAMWRT, SS_TEXT); if (softswitches & SS_PAGE2) {
_draw_text(ea, b, 1, SS_RAMWRT, SS_TEXT);
}
} }
GLUE_C_WRITE(video__write_2e_text1_mixed) GLUE_C_WRITE(video__write_2e_text1_mixed)
{ {
base_ramwrt[ea] = b; base_ramwrt[ea] = b;
_draw_text(ea, b, 1, SS_RAMWRT, (SS_TEXT|SS_MIXED)); if (softswitches & SS_PAGE2) {
_draw_text(ea, b, 1, SS_RAMWRT, (SS_TEXT|SS_MIXED));
}
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -991,49 +999,65 @@ static inline void _draw_hires_graphics(uint16_t ea, uint8_t b, bool is_even, ui
GLUE_C_WRITE(video__write_2e_even0) GLUE_C_WRITE(video__write_2e_even0)
{ {
base_hgrwrt[ea] = b; base_hgrwrt[ea] = b;
_draw_hires_graphics(ea, b, /*even*/true, 0, SS_TEXT); if (!(softswitches & SS_PAGE2)) {
_draw_hires_graphics(ea, b, /*even*/true, 0, SS_TEXT);
}
} }
GLUE_C_WRITE(video__write_2e_even0_mixed) GLUE_C_WRITE(video__write_2e_even0_mixed)
{ {
base_hgrwrt[ea] = b; base_hgrwrt[ea] = b;
_draw_hires_graphics(ea, b, /*even*/true, 0, (SS_TEXT|SS_MIXED)); if (!(softswitches & SS_PAGE2)) {
_draw_hires_graphics(ea, b, /*even*/true, 0, (SS_TEXT|SS_MIXED));
}
} }
GLUE_C_WRITE(video__write_2e_odd0) GLUE_C_WRITE(video__write_2e_odd0)
{ {
base_hgrwrt[ea] = b; base_hgrwrt[ea] = b;
_draw_hires_graphics(ea, b, /*even*/false, 0, SS_TEXT); if (!(softswitches & SS_PAGE2)) {
_draw_hires_graphics(ea, b, /*even*/false, 0, SS_TEXT);
}
} }
GLUE_C_WRITE(video__write_2e_odd0_mixed) GLUE_C_WRITE(video__write_2e_odd0_mixed)
{ {
base_hgrwrt[ea] = b; base_hgrwrt[ea] = b;
_draw_hires_graphics(ea, b, /*even*/false, 0, (SS_TEXT|SS_MIXED)); if (!(softswitches & SS_PAGE2)) {
_draw_hires_graphics(ea, b, /*even*/false, 0, (SS_TEXT|SS_MIXED));
}
} }
GLUE_C_WRITE(video__write_2e_even1) GLUE_C_WRITE(video__write_2e_even1)
{ {
base_ramwrt[ea] = b; base_ramwrt[ea] = b;
_draw_hires_graphics(ea, b, /*even*/true, 1, SS_TEXT); if (softswitches & SS_PAGE2) {
_draw_hires_graphics(ea, b, /*even*/true, 1, SS_TEXT);
}
} }
GLUE_C_WRITE(video__write_2e_even1_mixed) GLUE_C_WRITE(video__write_2e_even1_mixed)
{ {
base_ramwrt[ea] = b; base_ramwrt[ea] = b;
_draw_hires_graphics(ea, b, /*even*/true, 1, (SS_TEXT|SS_MIXED)); if (softswitches & SS_PAGE2) {
_draw_hires_graphics(ea, b, /*even*/true, 1, (SS_TEXT|SS_MIXED));
}
} }
GLUE_C_WRITE(video__write_2e_odd1) GLUE_C_WRITE(video__write_2e_odd1)
{ {
base_ramwrt[ea] = b; base_ramwrt[ea] = b;
_draw_hires_graphics(ea, b, /*even*/false, 1, SS_TEXT); if (softswitches & SS_PAGE2) {
_draw_hires_graphics(ea, b, /*even*/false, 1, SS_TEXT);
}
} }
GLUE_C_WRITE(video__write_2e_odd1_mixed) GLUE_C_WRITE(video__write_2e_odd1_mixed)
{ {
base_ramwrt[ea] = b; base_ramwrt[ea] = b;
_draw_hires_graphics(ea, b, /*even*/false, 1, (SS_TEXT|SS_MIXED)); if (softswitches & SS_PAGE2) {
_draw_hires_graphics(ea, b, /*even*/false, 1, (SS_TEXT|SS_MIXED));
}
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -136,6 +136,7 @@ GLUE_C_READ(iie_page2_off)
} }
video_setpage(0); video_setpage(0);
video_redraw();
return floating_bus(); return floating_bus();
} }
@ -160,6 +161,7 @@ GLUE_C_READ(iie_page2_on)
} else { } else {
softswitches |= SS_SCREEN; softswitches |= SS_SCREEN;
video_setpage(1); video_setpage(1);
video_redraw();
} }
return floating_bus(); return floating_bus();