{
int shift = 16 - nbits;
- for (int i = oddeven; i < toscr_nr_planes2; i += step) {
+ for (int i = oddeven; i < toscr_nr_planes2 && nbits; i += step) {
outword[i] <<= nbits;
outword[i] |= todisplay2[i] >> shift;
todisplay2[i] <<= nbits;
todisplay2_aga[i] <<= nbits;
}
} else {
- for (int i = oddeven; i < toscr_nr_planes2; i += step) {
+ for (int i = oddeven; i < toscr_nr_planes2 && bits; i += step) {
outword[i] <<= nbits;
outword[i] |= (todisplay2_aga[i] >> shift) & mask;
todisplay2_aga[i] <<= nbits;
}
}
-STATIC_INLINE void clear_fetchbuffer(uae_u32* ptr, int nwords)
+STATIC_INLINE void clear_fetchbuffer(uae_u32 *ptr, int nwords)
{
- if (!thisline_changed) {
- for (int i = 0; i < nwords; i++) {
- if (ptr[i]) {
- thisline_changed = 1;
- break;
- }
- }
- }
+ thisline_changed = 1;
memset(ptr, 0, nwords * 4);
}
}
}
+ if (bplcon0_planes_changed) {
+ if (!bprun && hpos == last_bpl1dat_hpos) {
+ flush_display(fm);
+ toscr_nr_planes_shifter = toscr_nr_planes_shifter_new;
+ bplcon0_planes_changed = false;
+ }
+ }
+
fetch_cycle++;
toscr_nbits += toscr_res2p;
// BPLCON0 modification immediately after BPL1DAT can affect BPL1DAT finished plane block
if (bplcon0_planes_changed) {
- if (((hpos - bpl_hstart) & fetchstart_mask) < fetchstart_mask) {
+ if (bprun) {
+ if (((hpos - bpl_hstart) & fetchstart_mask) < fetchstart_mask) {
+ flush_display(fm);
+ toscr_nr_planes_shifter = toscr_nr_planes_shifter_new;
+ bplcon0_planes_changed = false;
+ }
+ } else {
flush_display(fm);
toscr_nr_planes_shifter = toscr_nr_planes_shifter_new;
bplcon0_planes_changed = false;
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()) {
serial_rbf_clear();
}
- if (old != v) {
+ if (old != intreq) {
doint_delay();
}
return true;
if (np > toscr_nr_planes2) {
update_toscr_planes(np, fetchmode);
toscr_nr_planes2 = np;
+ thisline_decision.max_planes = np;
}
if (isocs7planes()) {
int hpos = current_hpos();
- // only BPL1DAT access can do anything visible immediately
- if (num == 0) {
- decide_line(hpos);
- decide_fetch_safe(hpos);
- flush_display(fetchmode);
- }
+ decide_line(hpos);
+ decide_fetch_safe(hpos);
+ flush_display(fetchmode);
fetched[num] = data;
if ((fmode & 3) == 3) {
if (ecs_denise || (!ecs_denise && hpos >= 0x2e)) {
beginning_of_plane_block(hpos);
bprun_pipeline_flush_delay = maxhpos;
- SET_LINE_CYCLEBASED;
}
}
}
static void BPLxDAT(int hpos, int num, uae_u16 data)
{
uae_u32 vv = (num << 16) | data;
+ if (!num) {
+ SET_LINE_CYCLEBASED;
+ }
event2_newevent_xx(-1, 1 * CYCLE_UNIT, vv, BPLxDAT_next);
}
each line that needs to be drawn. These are basically extracted out of
bit fields in the hardware registers. */
static int bplmode, bplehb, bplham, bpldualpf, bpldualpfpri;
-static int bpldualpf2of, bplplanecnt, ecsshres;
+static int bpldualpf2of, bplplanecnt, bplmaxplanecnt, ecsshres;
static int bplbypass, bplcolorburst, bplcolorburst_field;
static int bplres;
static int plf1pri, plf2pri, bplxor, bplxorsp, bpland, bpldelay_sh;
bool expanded = false;
hsync_shift_hack = 0;
+ bplmaxplanecnt = dp_for_drawing->max_planes;
if (border)
ddf_left = DISPLAY_LEFT_SHIFT;
real_bplpt[7] = DATA_POINTER(7);
#endif
- switch (bplplanecnt) {
+ switch (bplmaxplanecnt) {
default: break;
case 0: memset(data, 0, wordcount * 64); break;
case 1: pfield_doline64_n1(data, wordcount, real_bplpt); break;
real_bplpt[7] = DATA_POINTER(7);
#endif
- switch (bplplanecnt) {
+ switch (bplmaxplanecnt) {
default: break;
case 0: memset(data, 0, wordcount * 32); break;
case 1: pfield_doline32_n1(data, wordcount, real_bplpt); break;