}
// HCENTER blanking (ECS Denise only)
- if (hcenter_v2 && vs_state_on && vpos < maxvpos_display_vsync) {
+ if (hcenter_v2 && vs_state_on && lof_display) {
int chpos = pos;
if (!hcenterblank_state && hcenter_v2 < chpos && hcenter_v2 >= last_recorded_diw_hpos) {
hcenterblank_state = true;
if (debug_dma) {
record_dma_event(DMA_EVENT_HBS, diw_to_hpos(cc->linepos), vpos);
}
+ thisline_changed = 1;
}
}
if (hcenterblank_state && hcenter_v2_end < chpos && hcenter_v2_end >= last_recorded_diw_hpos) {
if (debug_dma) {
record_dma_event(DMA_EVENT_HBE, diw_to_hpos(cc->linepos), vpos);
}
+ thisline_changed = 1;
}
}
}
if (minpos < hw_diwfirst) {
minpos = hw_diwfirst;
}
- maxpos = thisline_decision.plfright * 2- DDF_OFFSET;
+ maxpos = thisline_decision.plfright - DDF_OFFSET;
if (maxpos > hw_diwlast) {
maxpos = hw_diwlast;
}
hwres_t maxp1 = maxpos >> sprite_buffer_res;
if (maxp1 > hw_diwlast) {
+ maxp1 = hw_diwlast;
maxpos = hw_diwlast << sprite_buffer_res;
}
- if (maxp1 > thisline_decision.plfright * 2 - DDF_OFFSET) {
- maxpos = (thisline_decision.plfright * 2 - DDF_OFFSET) << sprite_buffer_res;
+ if (maxp1 > thisline_decision.plfright - DDF_OFFSET) {
+ maxpos = (thisline_decision.plfright - DDF_OFFSET) << sprite_buffer_res;
}
if (minp1 < hw_diwfirst) {
+ minp1 = hw_diwfirst;
minpos = hw_diwfirst << sprite_buffer_res;
}
if (minp1 < thisline_decision.plfleft - DDF_OFFSET) {
thisline_decision.bplcon4sp = bplcon4;
thisline_decision.fmode = fmode;
- // 0 = vb, 1 = vb off, 3 = vb off, previous line was bitplane + vb on
- //bool t = thisline_decision.plfleft >= 0 && (thisline_decision.vb & 1) == 0 && !vb_state && !vb_end_line;
if (!aga_mode && ecs_denise && exthblank) {
- // ECS Denise + EXTHBLANK: VBLANK blanking is different
- if (new_beamcon0 & BEAMCON0_VARCSYEN) {
- // programmed vsync
- thisline_decision.vb = vs_state_on ? 0 : VB_NOVB;
- } else if (new_beamcon0 & BEAMCON0_BLANKEN) {
+ // ECS Denise + EXTBLANK: VBLANK blanking is different
+ thisline_decision.vb = VB_NOVB;
+ if (new_beamcon0 & BEAMCON0_BLANKEN) {
// blanking working same as AGA
thisline_decision.vb = vb_start_line > 1 + vblank_extraline || vb_end_next_line ? 0 : VB_NOVB;
- } else {
- // hardwired vsync
- thisline_decision.vb = vs_state_hw ? 0 : VB_NOVB;
}
} else {
// Visible vblank end is delayed by 1 line
thisline_decision.bordersprite_seen = issprbrd(-1, bplcon0, bplcon3);
thisline_decision.xor_seen = (bplcon4 & 0xff00) != 0;
thisline_decision.nr_planes = toscr_nr_planes_agnus;
- thisline_decision.max_planes = toscr_nr_planes_agnus;
toscr_nr_planes2 = GET_PLANES(bplcon0d);
if (isocs7planes()) {
toscr_nr_planes3 = toscr_nr_planes2;
toscr_nr_changed = false;
+ thisline_decision.max_planes = toscr_nr_planes2 > toscr_nr_planes_agnus ? toscr_nr_planes2 : toscr_nr_planes_agnus;
+
hpos_hsync_extra = 0;
int hpos = current_hpos();
bool normalstart = true;
}
}
maxhpos_display *= 2;
+ if (hsstop_detect2 > hsstop_detect + 5) {
+ hsstop_detect = hsstop_detect2;
+ }
} else {
int hpos_cmp = hpos;
int vpos_cmp = vpos;
- // Copper comparison can match both odd and even cycles
- // Important when crossing scanlines.
- hpos_cmp += 1;
- if (hpos_cmp >= maxhpos) {
- hpos_cmp -= maxhpos;
- vpos_cmp++;
+ if (hpos_cmp == maxhposm1 && maxhposeven == COPPER_CYCLE_POLARITY) {
+ hpos_cmp = 0;
}
int vp = vpos_cmp & (((cop_state.ir[1] >> 8) & 0x7F) | 0x80);
}
}
- if (vp == cop_state.vcmp && hp < cop_state.hcmp) {
- return 1;
+ if (vp > cop_state.vcmp) {
+ return 0;
}
- return 0;
+ if (vp == cop_state.vcmp && hp >= cop_state.hcmp) {
+ return 0;
+ }
+
+ return 1;
}
static void update_copper(int until_hpos)
cop_state.state = COP_skip1;
break;
- // SKIP: Second idle cycle. Check comparison.
+ // SKIP: Second idle cycle. Do nothing.
// Free cycle needed, cycle not allocated.
case COP_skip1:
+
if (copper_cant_read(hpos, 0)) {
goto next;
}
+ cop_state.state = COP_skip;
+ break;
+
+ // Check comparison. SKIP finished. Request IR1.
+ case COP_skip:
+ if (copper_cant_read(hpos, CYCLE_PIPE_COPPER | 0x005)) {
+ goto next;
+ }
+
if (!coppercomp(hpos, false)) {
cop_state.ignore_next = 1;
cop_state.ignore_next = -1;
}
- cop_state.state = COP_skip;
- break;
-
- // SKIP finished. Request IR1.
- case COP_skip:
- if (copper_cant_read(hpos, CYCLE_PIPE_COPPER | 0x005)) {
- goto next;
- }
cop_state.state = COP_read1;
break;