Make use of the video memory dirty bit

This commit is contained in:
Aaron Culliney 2016-01-21 23:09:57 -08:00
parent 5ce91fa96d
commit 7ef70e7943
3 changed files with 130 additions and 40 deletions

View File

@ -778,28 +778,76 @@ static void (*_textpage_plotter(uint32_t currswitches, uint32_t txtflags))(uint1
return plotFn;
}
static inline drawpage_mode_t _currentMainMode(uint32_t currswitches) {
if (currswitches & SS_TEXT) {
return DRAWPAGE_TEXT;
} else {
if (currswitches & SS_HIRES) {
return DRAWPAGE_HIRES;
} else {
return DRAWPAGE_TEXT; // (LORES)
}
}
}
static inline drawpage_mode_t _currentMixedMode(uint32_t currswitches) {
if (currswitches & (SS_TEXT|SS_MIXED)) {
return DRAWPAGE_TEXT;
} else {
if (currswitches & SS_HIRES) {
return DRAWPAGE_HIRES;
} else {
return DRAWPAGE_TEXT; // (LORES)
}
}
}
GLUE_C_WRITE(video__write_2e_text0)
{
base_textwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMainMode(softswitches);
if (mode == DRAWPAGE_HIRES) {
return;
}
if (!(softswitches & SS_PAGE2)) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_text0_mixed)
{
base_textwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMixedMode(softswitches);
if (mode == DRAWPAGE_HIRES) {
return;
}
if (!(softswitches & SS_PAGE2)) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_text1)
{
base_ramwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMainMode(softswitches);
if (mode == DRAWPAGE_HIRES) {
return;
}
if (softswitches & SS_PAGE2) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_text1_mixed)
{
base_ramwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMixedMode(softswitches);
if (mode == DRAWPAGE_HIRES) {
return;
}
if (softswitches & SS_PAGE2) {
video_setDirty(A2_DIRTY_FLAG);
}
}
// ----------------------------------------------------------------------------
@ -1037,49 +1085,97 @@ static void (*_hirespage_plotter(uint32_t currswitches))(uint16_t, int, int, boo
GLUE_C_WRITE(video__write_2e_even0)
{
base_hgrwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMainMode(softswitches);
if (mode == DRAWPAGE_TEXT) {
return;
}
if (!(softswitches & SS_PAGE2)) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_even0_mixed)
{
base_hgrwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMixedMode(softswitches);
if (mode == DRAWPAGE_TEXT) {
return;
}
if (!(softswitches & SS_PAGE2)) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_odd0)
{
base_hgrwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMainMode(softswitches);
if (mode == DRAWPAGE_TEXT) {
return;
}
if (!(softswitches & SS_PAGE2)) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_odd0_mixed)
{
base_hgrwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMixedMode(softswitches);
if (mode == DRAWPAGE_TEXT) {
return;
}
if (!(softswitches & SS_PAGE2)) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_even1)
{
base_ramwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMainMode(softswitches);
if (mode == DRAWPAGE_TEXT) {
return;
}
if (softswitches & SS_PAGE2) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_even1_mixed)
{
base_ramwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMixedMode(softswitches);
if (mode == DRAWPAGE_TEXT) {
return;
}
if (softswitches & SS_PAGE2) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_odd1)
{
base_ramwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMainMode(softswitches);
if (mode == DRAWPAGE_TEXT) {
return;
}
if (softswitches & SS_PAGE2) {
video_setDirty(A2_DIRTY_FLAG);
}
}
GLUE_C_WRITE(video__write_2e_odd1_mixed)
{
base_ramwrt[ea] = b;
video_setDirty(A2_DIRTY_FLAG);
drawpage_mode_t mode = _currentMixedMode(softswitches);
if (mode == DRAWPAGE_TEXT) {
return;
}
if (softswitches & SS_PAGE2) {
video_setDirty(A2_DIRTY_FLAG);
}
}
// ----------------------------------------------------------------------------
@ -1169,30 +1265,6 @@ bool video_loadState(StateHelper_s *helper) {
// ----------------------------------------------------------------------------
static inline drawpage_mode_t _currentMainMode(uint32_t currswitches) {
if (currswitches & SS_TEXT) {
return DRAWPAGE_TEXT;
} else {
if (currswitches & SS_HIRES) {
return DRAWPAGE_HIRES;
} else {
return DRAWPAGE_TEXT; // (LORES)
}
}
}
static inline drawpage_mode_t _currentMixedMode(uint32_t currswitches) {
if (currswitches & (SS_TEXT|SS_MIXED)) {
return DRAWPAGE_TEXT;
} else {
if (currswitches & SS_HIRES) {
return DRAWPAGE_HIRES;
} else {
return DRAWPAGE_TEXT; // (LORES)
}
}
}
static inline void _currentPageAndBank(uint32_t currswitches, drawpage_mode_t mode, OUTPARM int *page, OUTPARM int *bank) {
// UTAIIe : 5-25
if (currswitches & SS_80STORE) {

View File

@ -310,8 +310,6 @@ static void glvideo_render(void) {
if (!cpu_isPaused()) {
// check if a2 video memory is dirty
unsigned long wasDirty = video_clearDirty(A2_DIRTY_FLAG);
wasDirty = 1;
#warning HACK FIXME TODO ... always setting A2 video memory dirty bit for now ...
if (wasDirty) {
fb = video_scan();
}

View File

@ -159,9 +159,10 @@ GLUE_C_READ(iie_page2_on)
}
} else {
softswitches |= SS_SCREEN;
video_setDirty(A2_DIRTY_FLAG);
}
video_setDirty(A2_DIRTY_FLAG);
return floating_bus();
}
@ -174,6 +175,7 @@ GLUE_C_READ(read_switch_graphics)
{
if (softswitches & SS_TEXT) {
softswitches &= ~SS_TEXT;
video_setDirty(A2_DIRTY_FLAG);
}
return floating_bus();
}
@ -182,6 +184,7 @@ GLUE_C_READ(read_switch_text)
{
if (!(softswitches & SS_TEXT)) {
softswitches |= SS_TEXT;
video_setDirty(A2_DIRTY_FLAG);
}
return floating_bus();
}
@ -195,6 +198,7 @@ GLUE_C_READ(read_switch_no_mixed)
{
if (softswitches & SS_MIXED) {
softswitches &= ~SS_MIXED;
video_setDirty(A2_DIRTY_FLAG);
}
return floating_bus();
}
@ -203,6 +207,7 @@ GLUE_C_READ(read_switch_mixed)
{
if (!(softswitches & SS_MIXED)) {
softswitches |= SS_MIXED;
video_setDirty(A2_DIRTY_FLAG);
}
return floating_bus();
}
@ -240,6 +245,8 @@ GLUE_C_READ(iie_hires_off)
softswitches |= SS_HGRWRT;
}
video_setDirty(A2_DIRTY_FLAG);
return floating_bus();
}
@ -263,6 +270,8 @@ GLUE_C_READ(iie_hires_on)
}
}
video_setDirty(A2_DIRTY_FLAG);
return floating_bus();
}
@ -536,9 +545,10 @@ GLUE_C_READ(iie_80store_off)
if (softswitches & SS_PAGE2) {
softswitches |= SS_SCREEN;
video_setDirty(A2_DIRTY_FLAG);
}
video_setDirty(A2_DIRTY_FLAG);
return floating_bus();
}
@ -601,6 +611,8 @@ GLUE_C_READ(iie_ramrd_main)
base_hgrrd = apple_ii_64k[0];
}
video_setDirty(A2_DIRTY_FLAG);
return floating_bus();
}
@ -624,6 +636,8 @@ GLUE_C_READ(iie_ramrd_aux)
base_hgrrd = apple_ii_64k[1];
}
video_setDirty(A2_DIRTY_FLAG);
return floating_bus();
}
@ -733,6 +747,7 @@ GLUE_C_READ(iie_80col_off)
}
softswitches &= ~SS_80COL;
video_setDirty(A2_DIRTY_FLAG);
return floating_bus();
}
@ -744,6 +759,7 @@ GLUE_C_READ(iie_80col_on)
}
softswitches |= SS_80COL;
video_setDirty(A2_DIRTY_FLAG);
return floating_bus();
}
@ -758,6 +774,7 @@ GLUE_C_READ(iie_altchar_off)
if (softswitches & SS_ALTCHAR) {
softswitches &= ~SS_ALTCHAR;
video_loadfont(0x40,0x40,ucase_glyphs,3);
video_setDirty(A2_DIRTY_FLAG);
}
return floating_bus();
}
@ -768,6 +785,7 @@ GLUE_C_READ(iie_altchar_on)
softswitches |= SS_ALTCHAR;
video_loadfont(0x40,0x20,mousetext_glyphs,1);
video_loadfont(0x60,0x20,lcase_glyphs,2);
video_setDirty(A2_DIRTY_FLAG);
}
return floating_bus();
}
@ -799,6 +817,7 @@ GLUE_C_READ(iie_dhires_on)
{
if (!(softswitches & SS_DHIRES)) {
softswitches |= SS_DHIRES;
video_setDirty(A2_DIRTY_FLAG);
}
return floating_bus();
}
@ -807,6 +826,7 @@ GLUE_C_READ(iie_dhires_off)
{
if (softswitches & SS_DHIRES) {
softswitches &= ~SS_DHIRES;
video_setDirty(A2_DIRTY_FLAG);
}
return floating_bus();
}