--- uae/src/custom.c 2018/04/24 16:42:15 1.1.1.4 +++ uae/src/custom.c 2018/04/24 16:43:34 1.1.1.5 @@ -204,12 +204,13 @@ static int color_src_match, color_dest_m * have to be remembered. */ static int decided_bpl1mod, decided_bpl2mod, decided_nr_planes, decided_hires; -char line_changed[2 * (maxvpos+1)]; +static char thisline_changed; + #ifdef SMART_UPDATE -#define MARK_LINE_CHANGED(l) do { line_changed[l] = 1; } while (0) +#define MARK_LINE_CHANGED do { thisline_changed = 1; } while (0) #else -#define MARK_LINE_CHANGED(l) do { } while (0) +#define MARK_LINE_CHANGED do { ; } while (0) #endif static struct decision thisline_decision; @@ -341,13 +342,11 @@ static void remember_ctable (void) color_src_match = oldctable; color_dest_match = remembered_color_entry; } - if (changed) { - line_changed[next_lineno] = 1; - } + thisline_changed |= changed; } else { /* We know the result of the comparison */ if (color_compare_result) - line_changed[next_lineno] = 1; + thisline_changed = 1; } } @@ -370,7 +369,7 @@ static void decide_diw (int hpos) * some programs change them after DDF start but before DIW start. */ thisline_decision.bplcon1 = bplcon1; if (thisline_decision.diwfirstword != line_decisions[next_lineno].diwfirstword) - MARK_LINE_CHANGED (next_lineno); + MARK_LINE_CHANGED; thisline_decision.diwlastword = -1; } if (hdiwstate == DIW_waiting_stop && thisline_decision.diwlastword == -1 @@ -379,7 +378,7 @@ static void decide_diw (int hpos) thisline_decision.diwlastword = diwlastword; hdiwstate = DIW_waiting_start; if (thisline_decision.diwlastword != line_decisions[next_lineno].diwlastword) - MARK_LINE_CHANGED (next_lineno); + MARK_LINE_CHANGED; } } @@ -414,7 +413,7 @@ static __inline__ void decide_as_playfie #endif ) #endif /* SMART_UPDATE */ - line_changed[next_lineno] = 1; + thisline_changed = 1; } /* Called when we already decided whether the line is playfield or border, @@ -513,7 +512,7 @@ static __inline__ void post_decide_line thisline_decision.bplcon0 &= 0xFFF; thisline_decision.bplcon0 |= bplcon0 & 0xF000; adjust_broken_program (hpos); - MARK_LINE_CHANGED (next_lineno); /* Play safe. */ + MARK_LINE_CHANGED; /* Play safe. */ return; } @@ -535,7 +534,7 @@ static __inline__ void post_decide_line thisline_decision.bplcon0 &= 0xFFF; thisline_decision.bplcon0 |= bplcon0 & 0xF000; - MARK_LINE_CHANGED (next_lineno); /* Play safe. */ + MARK_LINE_CHANGED; /* Play safe. */ decide_as_playfield (plfstrt, plflinelen); adjust_broken_program (hpos); } @@ -642,7 +641,7 @@ static void record_color_change (int hpo if (regno == 0 && thisline_decision.color0 == 0xFFFFFFFFul && thisline_decision.diwfirstword < 0) { thisline_decision.color0 = current_colors.color_regs[0]; if (line_decisions[next_lineno].color0 != value) - line_changed[next_lineno] = 1; + thisline_changed = 1; } /* Anything else gets recorded in the color_changes table. */ #ifdef OS_WITHOUT_MEMORY_MANAGEMENT @@ -726,11 +725,11 @@ static void decide_plane (int hpos) real_ptr = pfield_xlateptr(0, 0); #ifdef SMART_UPDATE #if 1 - if (line_changed[next_lineno]) + if (thisline_changed) memcpy (dataptr, real_ptr, bytecount); else #endif - line_changed[next_lineno] |= memcmpy (dataptr, real_ptr, bytecount); + thisline_changed |= memcmpy (dataptr, real_ptr, bytecount); #else real_bplpt[i] = real_ptr; #endif @@ -746,8 +745,8 @@ static void decide_plane (int hpos) if (real_ptr == NULL) real_ptr = pfield_xlateptr(0, 0); #ifdef SMART_UPDATE - if (!line_changed[next_lineno]) - line_changed[next_lineno] |= memcmpy (dataptr, real_ptr, bytecount); + if (!thisline_changed) + thisline_changed |= memcmpy (dataptr, real_ptr, bytecount); else memcpy (dataptr, real_ptr, bytecount); #else @@ -924,17 +923,17 @@ static void finish_decisions (void) if (hdiwstate == DIW_waiting_stop) { thisline_decision.diwlastword = max_diwlastword; if (thisline_decision.diwlastword != line_decisions[next_lineno].diwlastword) - MARK_LINE_CHANGED (next_lineno); + MARK_LINE_CHANGED; } if (line_decisions[next_lineno].which != thisline_decision.which) - line_changed[next_lineno] = 1; + thisline_changed = 1; decide_plane (hpos); dip = curr_drawinfo + next_lineno; dip_old = prev_drawinfo + next_lineno; dp = line_decisions + next_lineno; - changed = line_changed[next_lineno]; + changed = thisline_changed; if (thisline_decision.which == 1) { record_diw_line (diwfirstword, diwlastword); @@ -979,7 +978,7 @@ static void finish_decisions (void) changed = 1; if (changed) { - line_changed[next_lineno] = 1; + thisline_changed = 1; *dp = thisline_decision; } else /* The only one that may differ: */ @@ -1002,12 +1001,12 @@ static void reset_decisions (void) if (hdiwstate == DIW_waiting_stop) { thisline_decision.diwfirstword = PIXEL_XPOS (DISPLAY_LEFT_SHIFT/2); if (thisline_decision.diwfirstword != line_decisions[next_lineno].diwfirstword) - MARK_LINE_CHANGED (next_lineno); + MARK_LINE_CHANGED; } thisline_decision.ctable = -1; thisline_decision.color0 = 0xFFFFFFFFul; - line_changed[next_lineno] = 0; + thisline_changed = 0; curr_drawinfo[next_lineno].first_color_change = next_color_change; curr_drawinfo[next_lineno].first_delay_change = next_delay_change; curr_drawinfo[next_lineno].first_sprite_draw = next_sprite_draw; @@ -1649,7 +1648,7 @@ static void BLTSIZH (uae_u16 v) if (!blt_info.vblitsize) blt_info.vblitsize = 32768; if (!blt_info.hblitsize) blt_info.hblitsize = 0x800; bltstate = BLT_init; - do_blitter(); + do_blitter (); } static __inline__ void SPRxCTL_1 (uae_u16 v, int num) @@ -1738,9 +1737,9 @@ static void COLOR (int hpos, uae_u16 v, r = (v & 0xF00) >> 8; g = (v & 0xF0) >> 4; b = (v & 0xF) >> 0; - cr = color_regs[colreg] >> 16; - cg = (color_regs[colreg] >> 8) & 0xFF; - cb = color_regs[colreg] & 0xFF; + cr = current_colors.color_regs[colreg] >> 16; + cg = (current_colors.color_regs[colreg] >> 8) & 0xFF; + cb = current_colors.color_regs[colreg] & 0xFF; if (bplcon3 & 0x200) { cr &= 0xF0; cr |= r; @@ -1752,10 +1751,14 @@ static void COLOR (int hpos, uae_u16 v, cb = b + (b << 4); } cval = (cr << 16) | (cg << 8) | cb; - if (cval == color_regs[colreg]) + if (cval == current_colors.color_regs[colreg]) return; - color_regs[colreg] = cval; - pfield_may_need_update(1); + + /* Call this with the old table still intact. */ + record_color_change (hpos, colreg, v); + remembered_color_entry = -1; + current_colors.color_regs[colreg] = cval; +/* current_colors.acolors[colreg] = xcolors[v];*/ } #else { @@ -2608,7 +2611,7 @@ static void hsync_handler (void) finish_decisions (); do_modulos (current_hpos ()); - hsync_record_line_state (next_lineno, nextline_how); + hsync_record_line_state (next_lineno, nextline_how, thisline_changed); eventtab[ev_hsync].evtime += cycles - eventtab[ev_hsync].oldcycles; eventtab[ev_hsync].oldcycles = cycles; @@ -2656,7 +2659,7 @@ static void hsync_handler (void) nextline_how = nln_normal; if (currprefs.gfx_linedbl) { lineno *= 2; - nextline_how = nln_doubled; + nextline_how = currprefs.gfx_linedbl == 1 ? nln_doubled : nln_nblack; if (bplcon0 & 4) { if (!lof) { lineno++; @@ -3059,7 +3062,7 @@ void REGPARAM2 custom_wput_1 (int hpos, #endif #if AGA_CHIPSET == 1 case 0x10C: BPLCON4 (hpos, value); break; - case 0x1FC: fmode = value; break; + case 0x1FC: fmode = value; calcdiw (); break; #endif } }