int display_reset;
static evt_t line_start_cycles;
static bool initial_frame;
+static evt_t custom_color_write_cycle;
#define LOF_TOGGLES_NEEDED 3
//#define NLACE_CNT_NEEDED 50
#define COLOR_TABLE_SIZE (MAXVPOS + MAXVPOS_WRAPLINES) * 2
static struct color_entry color_tables[2][COLOR_TABLE_SIZE];
-static int next_sprite_entry = 0;
+static int next_sprite_entry = 0, last_sprite_entry = 0;
static int prev_next_sprite_entry;
static int next_sprite_forced = 1;
return;
}
+ if (next_color_change > MAX_REG_CHANGE - 30) {
+ return;
+ }
+
int pos = hpos < 0 ? -hpos : hpos_to_diwx(hpos);
// AGA has extra hires pixel delay in color changes
int attachment;
int spr_width;
+ // do nothing if buffer is full (shouldn't happen normally)
+ if (next_sprite_entry >= last_sprite_entry) {
+ return;
+ }
+
half = 0;
dbl = sprite_buffer_res - sprres;
if (dbl < 0) {
static void COLOR_WRITE(int hpos, uae_u16 v, int num)
{
bool colzero = false;
+
+ // skip color register write color change state update if color register was already written in same cycle
+ // fast CPU modes can write tens of thousands of color registers in single frame.
+ evt_t c = get_cycles() & ~(CYCLE_UNIT - 1);
+ bool samecycle = c == custom_color_write_cycle;
+ custom_color_write_cycle = c;
+
#ifdef AGA
if (aga_mode) {
int r,g,b;
}
/* Call this with the old table still intact. */
- record_color_change(hpos, colreg, cval);
+ if (!samecycle) {
+ record_color_change(hpos, colreg, cval);
+ }
remembered_color_entry = -1;
current_colors.color_regs_aga[colreg] = cval;
current_colors.acolors[colreg] = getxcolor(cval);
}
/* Call this with the old table still intact. */
- record_color_change(hpos, num, v);
+ if (!samecycle) {
+ record_color_change(hpos, num, v);
+ }
remembered_color_entry = -1;
current_colors.color_regs_ecs[num] = v;
current_colors.acolors[num] = getxcolor (v);
}
prev_next_sprite_entry = next_sprite_entry;
next_sprite_entry = 0;
+ last_sprite_entry = MAX_SPR_PIXELS - 1;
next_lineno = calculate_lineno(vpos);
last_color_change = 0;
copper_dma_change_cycle = -1;
blitter_dma_change_cycle = -1;
sprite_dma_change_cycle_on = -1;
+ custom_color_write_cycle = -1;
if (hardreset || savestate_state) {
maxhpos = ntsc ? MAXHPOS_NTSC : MAXHPOS_PAL;