]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
ECS Denise KILLEHB update.
authorToni Wilen <twilen@winuae.net>
Sat, 2 Dec 2017 16:39:48 +0000 (18:39 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 2 Dec 2017 16:39:48 +0000 (18:39 +0200)
custom.cpp
drawing.cpp
genlinetoscr.cpp

index 3ce66920d21884c93056ea1322773070719e224f..a24a434e9c75a627d593ec9ec92dc8e72d72c1de 100644 (file)
@@ -5597,8 +5597,11 @@ static void BPLCON1 (int hpos, uae_u16 v)
 static void BPLCON2(int hpos, uae_u16 v)
 {
        if (!(currprefs.chipset_mask & CSMASK_AGA))
+               v &= ~(0x100 | 0x80); // RDRAM and SOGEN
+       if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE))
                v &= 0x7f;
-       if ((bplcon2 & 0x3fff) == (v & 0x3fff))
+       v &= ~0x8000; // unused
+       if (bplcon2 == v)
                return;
        decide_line (hpos);
        bplcon2 = v;
index 9efdf38118297c320df930c2ffefcf8b30cc2218..c358a54801dd8df49974d30deaa9440b7a6591e8 100644 (file)
@@ -55,6 +55,15 @@ happening, all ports should restrict window widths to be multiples of 16 pixels.
 #define BG_COLOR_DEBUG 0
 //#define XLINECHECK
 
+typedef enum
+{
+       CMODE_NORMAL,
+       CMODE_DUALPF,
+       CMODE_EXTRAHB,
+       CMODE_EXTRAHB_ECS_KILLEHB,
+       CMODE_HAM
+} CMODE_T;
+
 extern int sprite_buffer_res;
 static int lores_factor;
 int lores_shift;
@@ -250,7 +259,8 @@ static int first_block_line, last_block_line;
 /* 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, bpldualpf2of, bplplanecnt, ecsshres;
+static int bplmode, bplehb, bplham, bpldualpf, bpldualpfpri;
+static int bpldualpf2of, bplplanecnt, ecsshres;
 static int bplbypass, bplcolorburst, bplcolorburst_field;
 static bool issprites;
 static int bplres;
@@ -2607,6 +2617,20 @@ static void do_flush_screen (struct vidbuffer *vb, int start, int stop)
                flush_screen (vb, 0, 0); /* vsync mode */
 }
 
+static void setbplmode(void)
+{
+       if (bplham)
+               bplmode = CMODE_HAM;
+       else if (bpldualpf)
+               bplmode = CMODE_DUALPF;
+       else if (bplehb > 0)
+               bplmode = CMODE_EXTRAHB;
+       else if (bplehb < 0)
+               bplmode = CMODE_EXTRAHB_ECS_KILLEHB;
+       else
+               bplmode = CMODE_NORMAL;
+}
+
 /* We only save hardware registers during the hardware frame. Now, when
 * drawing the frame, we expand the data into a slightly more useful
 * form. */
@@ -2618,8 +2642,11 @@ static void pfield_expand_dp_bplcon (void)
        bplplanecnt = dp_for_drawing->nr_planes;
        bplham = dp_for_drawing->ham_seen;
        bplehb = dp_for_drawing->ehb_seen;
-       if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && (dp_for_drawing->bplcon2 & 0x0200))
+       if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && (dp_for_drawing->bplcon2 & 0x0200)) {
                bplehb = 0;
+               if (!(currprefs.chipset_mask & CSMASK_AGA))
+                       bplehb = -1;
+       }
        issprites = dip_for_drawing->nr_sprites > 0;
        bplcolorburst = (dp_for_drawing->bplcon0 & 0x200) != 0;
        if (!bplcolorburst)
@@ -2677,6 +2704,8 @@ static void pfield_expand_dp_bplcon (void)
        }
        if (pfield_mode_changed)
                pfield_set_linetoscr();
+       
+       setbplmode();
 }
 
 static bool isham (uae_u16 bplcon0)
@@ -2993,6 +3022,7 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in
                        hposblank = ohposblank;
                        ham_decode_pixel = src_pixel;
                        bplham = dp_for_drawing->ham_at_start;
+                       setbplmode();
                }
 
                if (dip_for_drawing->nr_sprites) {
index 5ad25657daa97a5da67926007e137c317efe0149..8dca327e96b7bd4c4183bc4accb4b6e89a9ea24a 100644 (file)
@@ -78,6 +78,7 @@ typedef enum
        CMODE_NORMAL,
        CMODE_DUALPF,
        CMODE_EXTRAHB,
+       CMODE_EXTRAHB_ECS_KILLEHB,
        CMODE_HAM
 } CMODE_T;
 #define CMODE_MAX CMODE_HAM
@@ -181,10 +182,12 @@ static void out_linetoscr_do_dstpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_
                outln (         "    } else");
                outln (         "        dpix_val = p_acolors[spix_val];");
        } else if (cmode == CMODE_EXTRAHB) {
-               outln (         "    if (spix_val <= 31)");
-               outln (         "        dpix_val = p_acolors[spix_val];");
-               outln (         "    else");
-               outln (         "        dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777];");
+               outln("    if (spix_val <= 31)");
+               outln("        dpix_val = p_acolors[spix_val];");
+               outln("    else");
+               outln("        dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777];");
+       } else if (cmode == CMODE_EXTRAHB_ECS_KILLEHB) {
+               outln("    dpix_val = p_acolors[spix_val & 31];");
        } else
                outln (         "    dpix_val = p_acolors[spix_val];");
 }
@@ -540,14 +543,36 @@ static void out_linetoscr (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, int gen
        outln  (        "");
 
        if (spr >= 0) {
-               outln  (        "    if (bplham) {");
+               outln("    switch(bplmode)");
+               outln("    {");
+               outln("    case CMODE_NORMAL:");
+               outln("    {");
+               out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_NORMAL, genlock);
+               outln("    }");
+               outln("    break;");
+               outln("    case CMODE_HAM:");
+               outln("    {");
                out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_HAM, genlock);
-               outln  (        "    } else if (bpldualpf) {");
+               outln("    }");
+               outln("    break;");
+               outln("    case CMODE_DUALPF:");
+               outln("    {");
                out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_DUALPF, genlock);
-               outln  (        "    } else if (bplehb) {");
+               outln("    }");
+               outln("    break;");
+               outln("    case CMODE_EXTRAHB:");
+               outln("    {");
                out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_EXTRAHB, genlock);
-               outln  (        "    } else {");
-               out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_NORMAL, genlock);
+               outln("    }");
+               outln("    break;");
+               if (!aga) {
+                       // ECS Denise with KILLEHB set
+                       outln("    case CMODE_EXTRAHB_ECS_KILLEHB:");
+                       outln("    {");
+                       out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_EXTRAHB_ECS_KILLEHB, genlock);
+                       outln("    }");
+                       outln("    break;");
+               }
        } else {
                outln  (        "    if (1) {");
                out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_NORMAL, genlock);