--- uae/src/custom.c 2018/04/24 17:03:59 1.1.1.17 +++ uae/src/custom.c 2018/04/24 17:07:27 1.1.1.19 @@ -1452,6 +1452,12 @@ STATIC_INLINE void decide_line (int hpos * but the new color has not been entered into the table yet. */ static void record_color_change (int hpos, int regno, unsigned long value) { + if (regno == -1 && value) { + thisline_decision.ham_seen = 1; + if (hpos < 0x18) + thisline_decision.ham_at_start = 1; + } + /* Early positions don't appear on-screen. */ if (framecnt != 0 || vpos < minfirstline || hpos < 0x18 /*|| currprefs.emul_accuracy == 0*/) @@ -1899,6 +1905,8 @@ static void reset_decisions (void) thisline_decision.plfleft = -1; thisline_decision.plflinelen = -1; + thisline_decision.ham_seen = !! (bplcon0 & 0x800); + thisline_decision.ham_at_start = !! (bplcon0 & 0x800); /* decided_res shouldn't be touched before it's initialized by decide_line(). */ thisline_decision.diwfirstword = -1; @@ -1989,14 +1997,14 @@ static void calcdiw (void) #if 0 /* This happens far too often. */ if (plffirstline < minfirstline) { - fprintf(stderr, "Warning: Playfield begins before line %d!\n", minfirstline); + write_log ("Warning: Playfield begins before line %d!\n", minfirstline); plffirstline = minfirstline; } #endif #if 0 /* Turrican does this */ if (plflastline > 313) { - fprintf (stderr, "Warning: Playfield out of range!\n"); + write_log ("Warning: Playfield out of range!\n"); plflastline = 313; } #endif @@ -2355,7 +2363,7 @@ static void DMACON (int hpos, uae_u16 v) STATIC_INLINE void INTENA (uae_u16 v) { /* if (trace_intena) - fprintf (stderr, "INTENA: %04x\n", v);*/ + write_log ("INTENA: %04x\n", v);*/ setclr (&intena,v); /* There's stupid code out there that does [some INTREQ bits at level 3 are set] @@ -2407,7 +2415,8 @@ static void ADKCON (uae_u16 v) static void BEAMCON0 (uae_u16 v) { - new_beamcon0 = v & 0x20; + if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) + new_beamcon0 = v & 0x20; } static void BPLPTH (int hpos, uae_u16 v, int num) @@ -2435,6 +2444,11 @@ static void BPLCON0 (int hpos, uae_u16 v decide_line (hpos); decide_fetch (hpos); + /* HAM change? */ + if ((bplcon0 ^ v) & 0x800) { + record_color_change (hpos, -1, !! (v & 0x800)); + } + bplcon0 = v; curr_diagram = cycle_diagram_table[fetchmode][GET_RES(bplcon0)][GET_PLANES (v)]; @@ -2618,7 +2632,7 @@ static void FMODE (uae_u16 v) static void BLTADAT (uae_u16 v) { - maybe_blit (); + maybe_blit (0); blt_info.bltadat = v; } @@ -2629,7 +2643,7 @@ static void BLTADAT (uae_u16 v) */ static void BLTBDAT (uae_u16 v) { - maybe_blit (); + maybe_blit (0); if (bltcon1 & 2) blt_info.bltbhold = v << (bltcon1 >> 12); @@ -2637,39 +2651,39 @@ static void BLTBDAT (uae_u16 v) blt_info.bltbhold = v >> (bltcon1 >> 12); blt_info.bltbdat = v; } -static void BLTCDAT (uae_u16 v) { maybe_blit (); blt_info.bltcdat = v; } +static void BLTCDAT (uae_u16 v) { maybe_blit (0); blt_info.bltcdat = v; } -static void BLTAMOD (uae_u16 v) { maybe_blit (); blt_info.bltamod = (uae_s16)(v & 0xFFFE); } -static void BLTBMOD (uae_u16 v) { maybe_blit (); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); } -static void BLTCMOD (uae_u16 v) { maybe_blit (); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); } -static void BLTDMOD (uae_u16 v) { maybe_blit (); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); } +static void BLTAMOD (uae_u16 v) { maybe_blit (1); blt_info.bltamod = (uae_s16)(v & 0xFFFE); } +static void BLTBMOD (uae_u16 v) { maybe_blit (1); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); } +static void BLTCMOD (uae_u16 v) { maybe_blit (1); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); } +static void BLTDMOD (uae_u16 v) { maybe_blit (1); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); } -static void BLTCON0 (uae_u16 v) { maybe_blit (); bltcon0 = v; blinea_shift = v >> 12; } +static void BLTCON0 (uae_u16 v) { maybe_blit (0); bltcon0 = v; blinea_shift = v >> 12; } /* The next category is "Most useless hardware register". * And the winner is... */ static void BLTCON0L (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit (); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF); + maybe_blit (0); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF); } -static void BLTCON1 (uae_u16 v) { maybe_blit (); bltcon1 = v; } +static void BLTCON1 (uae_u16 v) { maybe_blit (0); bltcon1 = v; } -static void BLTAFWM (uae_u16 v) { maybe_blit (); blt_info.bltafwm = v; } -static void BLTALWM (uae_u16 v) { maybe_blit (); blt_info.bltalwm = v; } +static void BLTAFWM (uae_u16 v) { maybe_blit (0); blt_info.bltafwm = v; } +static void BLTALWM (uae_u16 v) { maybe_blit (0); blt_info.bltalwm = v; } -static void BLTAPTH (uae_u16 v) { maybe_blit (); bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); } -static void BLTAPTL (uae_u16 v) { maybe_blit (); bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); } -static void BLTBPTH (uae_u16 v) { maybe_blit (); bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTBPTL (uae_u16 v) { maybe_blit (); bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); } -static void BLTCPTH (uae_u16 v) { maybe_blit (); bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTCPTL (uae_u16 v) { maybe_blit (); bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); } -static void BLTDPTH (uae_u16 v) { maybe_blit (); bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTDPTL (uae_u16 v) { maybe_blit (); bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); } +static void BLTAPTH (uae_u16 v) { maybe_blit (0); bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); } +static void BLTAPTL (uae_u16 v) { maybe_blit (0); bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); } +static void BLTBPTH (uae_u16 v) { maybe_blit (0); bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); } +static void BLTBPTL (uae_u16 v) { maybe_blit (0); bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); } +static void BLTCPTH (uae_u16 v) { maybe_blit (0); bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); } +static void BLTCPTL (uae_u16 v) { maybe_blit (0); bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); } +static void BLTDPTH (uae_u16 v) { maybe_blit (0); bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); } +static void BLTDPTL (uae_u16 v) { maybe_blit (0); bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); } static void BLTSIZE (uae_u16 v) { - maybe_blit (); + maybe_blit (0); blt_info.vblitsize = v >> 6; blt_info.hblitsize = v & 0x3F; @@ -2684,7 +2698,7 @@ static void BLTSIZV (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit (); + maybe_blit (0); oldvblts = v & 0x7FFF; } @@ -2692,7 +2706,7 @@ static void BLTSIZH (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit (); + maybe_blit (0); blt_info.hblitsize = v & 0x7FF; blt_info.vblitsize = oldvblts; if (!blt_info.vblitsize) blt_info.vblitsize = 32768; @@ -3563,7 +3577,7 @@ static void adjust_array_sizes (void) if (p1) sprite_entries[0] = p1; if (p2) sprite_entries[1] = p2; if (p1 && p2) { - fprintf (stderr, "new max_sprite_entry=%d\n",mcc); + write_log ("new max_sprite_entry=%d\n",mcc); max_sprite_entry = mcc; } } @@ -3576,7 +3590,7 @@ static void adjust_array_sizes (void) if (p1) color_changes[0] = p1; if (p2) color_changes[1] = p2; if (p1 && p2) { - fprintf (stderr, "new max_color_change=%d\n",mcc); + write_log ("new max_color_change=%d\n",mcc); max_color_change = mcc; } } @@ -3660,8 +3674,10 @@ static void vsync_handler (void) if (bplcon0 & 4) lof ^= 0x8000; +#ifdef PICASSO96 if (picasso_on) picasso_handle_vsync (); +#endif vsync_handle_redraw (lof, lof_changed); if (quit_program > 0) @@ -4065,7 +4081,7 @@ void dumpcustom (void) if (total_skipped) write_log ("Skipped frames: %d\n", total_skipped); } - /*for (i=0; i<256; i++) if (blitcount[i]) fprintf (stderr, "minterm %x = %d\n",i,blitcount[i]); blitter debug */ + /*for (i=0; i<256; i++) if (blitcount[i]) write_log ("minterm %x = %d\n",i,blitcount[i]); blitter debug */ } int intlev (void) @@ -4128,11 +4144,11 @@ void custom_init (void) pos = here (); - org (0xF0FF70); + org (RTAREA_BASE+0xFF70); calltrap (deftrap (mousehack_helper)); dw (RTS); - org (0xF0FFA0); + org (RTAREA_BASE+0xFFA0); calltrap (deftrap (timehack_helper)); dw (RTS);