--- uae/src/drawing.c 2018/04/24 16:56:43 1.1.1.11 +++ uae/src/drawing.c 2018/04/24 16:58:25 1.1.1.12 @@ -44,8 +44,7 @@ #include "picasso96.h" #include "drawing.h" -int lores_factor, lores_shift, sprite_width, borderblank; -int fetchmode, fetchstart, fetchstart_shift, prefetch, fetchsize; +int lores_factor, lores_shift; /* The shift factor to apply when converting between Amiga coordinates and window coordinates. Zero if the resolution is the same, positive if window coordinates @@ -62,9 +61,13 @@ static int interlace_seen = 0; to contain two 16 bit words, with the appropriate mask if pf1 is in the foreground being at bit offset 0, the one used if pf2 is in front being at offset 16. */ + static int dblpf_ms1[256], dblpf_ms2[256], dblpf_ms[256]; static int dblpf_ind1[256], dblpf_ind2[256]; -static int dblpf_aga1[256], dblpf_aga2[256]; + +static int dblpf_2nd1[256], dblpf_2nd2[256]; +static int dblpf_ind1_aga[256], dblpf_ind2_aga[256]; + static int dblpfofs[] = { 0, 2, 4, 8, 16, 32, 64, 128 }; @@ -91,16 +94,17 @@ union { /* Let's try to align this thing. */ double uupzuq; long int cruxmedo; - uae_u8 apixels[1760]; - uae_u16 apixels_w[880]; - uae_u32 apixels_l[440]; + uae_u8 apixels[MAX_PIXELS_PER_LINE*2]; + uae_u16 apixels_w[MAX_PIXELS_PER_LINE*2/2]; + uae_u32 apixels_l[MAX_PIXELS_PER_LINE*2/4]; } pixdata; uae_u16 spixels[2 * MAX_SPR_PIXELS]; /* Eight bits for every pixel. */ union sps_union spixstate; -uae_u32 ham_linebuf[1760]; +static uae_u32 ham_linebuf[MAX_PIXELS_PER_LINE]; +static uae_u8 spriteagadpfpixels[MAX_PIXELS_PER_LINE]; /* AGA dualplayfield sprite */ char *xlinebuffer; @@ -147,8 +151,9 @@ static int first_block_line, last_block_ /* These are generated by the drawing code from the line_decisions array for each line that needs to be drawn. These are basically extracted out of bit fields in the hardware registers. */ -static int bplehb, bplham, bpldualpf, bpldualpfpri, bplplanecnt, bplres; +static int bplehb, bplham, bpldualpf, bpldualpfpri, bpldualpf2of, bplplanecnt, bplres, sprres; static uae_u32 plf_sprite_mask; +static int sbasecol[2]; int picasso_requested_on; int picasso_on; @@ -269,10 +274,10 @@ static void pfield_init_linetoscr (void) res_shift = lores_shift - bplres; ddf_left -= DISPLAY_LEFT_SHIFT; ddf_left <<= bplres; - pixels_offset = 880 - ddf_left; + pixels_offset = MAX_PIXELS_PER_LINE - ddf_left; unpainted = visible_left_border < playfield_start ? 0 : visible_left_border - playfield_start; - src_pixel = 880 + res_shift_from_window (playfield_start - native_ddf_left + unpainted); + src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (playfield_start - native_ddf_left + unpainted); if (dip_for_drawing->nr_sprites == 0) return; @@ -280,13 +285,13 @@ static void pfield_init_linetoscr (void) if (linetoscr_diw_start < native_ddf_left) { int size = res_shift_from_window (native_ddf_left - linetoscr_diw_start); linetoscr_diw_start = native_ddf_left; - memset (pixdata.apixels + 880 - size, 0, size); + memset (pixdata.apixels + MAX_PIXELS_PER_LINE - size, 0, size); } if (linetoscr_diw_end > native_ddf_right) { int pos = res_shift_from_window (native_ddf_right - native_ddf_left); int size = res_shift_from_window (linetoscr_diw_end - native_ddf_right); linetoscr_diw_start = native_ddf_left; - memset (pixdata.apixels + 880 + pos, 0, size); + memset (pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size); } } @@ -655,6 +660,11 @@ static void gen_pfield_tables (void) int plane1 = (i & 1) | ((i >> 1) & 2) | ((i >> 2) & 4) | ((i >> 3) & 8); int plane2 = ((i >> 1) & 1) | ((i >> 2) & 2) | ((i >> 3) & 4) | ((i >> 4) & 8); + dblpf_2nd1[i] = plane1 == 0 ? (plane2 == 0 ? 0 : 2) : 1; + dblpf_2nd2[i] = plane2 == 0 ? (plane1 == 0 ? 0 : 1) : 2; + dblpf_ind1_aga[i] = plane1 == 0 ? plane2 : plane1; + dblpf_ind2_aga[i] = plane2 == 0 ? plane1 : plane2; + dblpf_ms1[i] = plane1 == 0 ? (plane2 == 0 ? 16 : 8) : 0; dblpf_ms2[i] = plane2 == 0 ? (plane1 == 0 ? 16 : 0) : 8; dblpf_ms[i] = i == 0 ? 16 : 8; @@ -882,8 +892,7 @@ static void pfield_doline_n8 (uae_u32 *d static void pfield_doline (int lineno) { int wordcount = dp_for_drawing->plflinelen; - uae_u32 *data = pixdata.apixels_l + 220; - int dsub1, dsub2; + uae_u32 *data = pixdata.apixels_l + MAX_PIXELS_PER_LINE/4; #ifdef SMART_UPDATE #define DATA_POINTER(n) (line_data[lineno] + (n)*MAX_WORDS_PER_LINE*2) @@ -1135,6 +1144,9 @@ static void pfield_expand_dp_bplcon (voi plf_sprite_mask |= (0xFFFF << (4 * plf1pri)) & 0xFFFF; bpldualpf = (dp_for_drawing->bplcon0 & 0x400) == 0x400; bpldualpfpri = (dp_for_drawing->bplcon2 & 0x40) == 0x40; + bpldualpf2of = (dp_for_drawing->bplcon3 >> 10) & 7; + sbasecol[0] = ((dp_for_drawing->bplcon4 >> 4) & 15) << 4; + sbasecol[1] = ((dp_for_drawing->bplcon4 >> 0) & 15) << 4; } enum double_how { @@ -1584,7 +1596,6 @@ void reset_drawing (void) lores_factor = currprefs.gfx_lores ? 1 : 2; lores_shift = currprefs.gfx_lores ? 0 : 1; - sprite_width = currprefs.gfx_lores ? 16 : 32; /*memset(blitcount, 0, sizeof(blitcount)); blitter debug */ for (i = 0; i < sizeof linestate / sizeof *linestate; i++)