]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1540b1.zip
authorToni Wilen <twilen@winuae.net>
Sun, 16 Nov 2008 15:08:27 +0000 (17:08 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:43:48 +0000 (21:43 +0200)
custom.c
disk.c
drawing.c
genlinetoscr.c
include/options.h
inputdevice.c
od-win32/direct3d.c
od-win32/win32.h
od-win32/win32gui.c
od-win32/winuae_msvc/winuae_msvc.vcproj
od-win32/winuaechangelog.txt

index b658bea51d3f9072903c1db06fb5706fe220bbb4..41fa57d2d7436204e6923b0d3de471791eb8ec17 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -846,7 +846,7 @@ static void copy_bpl_params (int pos)
        changed = 1;
 
     if (changed)
-       record_color_change2 (pos + f_fetchunit, 0x100 + 0x1000, tmp_bplcon0);
+       record_color_change2 (pos + 4, 0x100 + 0x1000, tmp_bplcon0);
 
     f_bplcon0 = tmp_bplcon0;
     f_fmode = tmp_fmode;
@@ -2077,8 +2077,7 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16
     if (dbl < 0) {
         half = -dbl;
         dbl = 0;
-       if (ecsshres () || (sprite_buffer_res < RES_SUPERHIRES && sprres == RES_SUPERHIRES))
-           mask = 1; /* need to halve horizontal size */
+       mask = 1 << half;
     }
     width = (sprite_width << sprite_buffer_res) >> sprres;
     attachment = (spr[num & ~1].armed && ((sprctl[num | 1] & 0x80) || (!(currprefs.chipset_mask & CSMASK_AGA) && (sprctl[num & ~1] & 0x80))));
@@ -2119,7 +2118,7 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16
 
     /* We have 8 bits per pixel in spixstate, two for every sprite pair.  The
        low order bit records whether the attach bit was set for this pair.  */
-    if (attachment) {
+    if (attachment && !ecsshres ()) {
        uae_u32 state = 0x01010101 << (num & ~1);
        uae_u8 *stb1 = spixstate.bytes + word_offs;
        for (i = 0; i < width; i += 8) {
diff --git a/disk.c b/disk.c
index 2acc159889635d9073481aa4e5af410268b64bf4..cb1a2ca4e9732b4b431bd3d8e23ed3af6c1ff3d3 100755 (executable)
--- a/disk.c
+++ b/disk.c
@@ -983,14 +983,26 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char
        }
        drv->useturbo = 1;
 
-    } else if (size == 720 * 1024 || size == 1440 * 1024) {
+    } else if (size == 720 * 1024 || size == 1440 * 1024 || size == 800 * 1024 || size == 1600 * 1024) {
        /* PC formatted image */
        int i;
+       
+       if (size == 720 * 1024) {
+           drv->num_secs = 9;
+           drv->ddhd = 1;
+       } else if (size == 1440 * 1024) {
+           drv->num_secs = 18;
+           drv->ddhd = 1;
+       } else if (size == 800 * 1024) {
+           drv->num_secs = 10;
+           drv->ddhd = 2;
+       } else if (size == 1600 * 1024) {
+           drv->num_secs = 20;
+           drv->ddhd = 2;
+       }
 
        drv->filetype = ADF_PCDOS;
        drv->num_tracks = 160;
-       drv->ddhd = size == 1440 * 1024 ? 2 : 1;
-       drv->num_secs = drv->ddhd == 2 ? 18 : 9;
        for (i = 0; i < drv->num_tracks; i++) {
            tid = &drv->trackdata[i];
            tid->type = TRACK_PCDOS;
@@ -1233,7 +1245,7 @@ static void decode_pcdos (drive *drv)
     int i;
     int tr = drv->cyl * 2 + side;
     uae_u16 *dstmfmbuf, *mfm2;
-    uae_u8 secbuf[700];
+    uae_u8 secbuf[1000];
     uae_u16 crc16;
     trackid *ti = drv->trackdata + tr;
     int tracklen = 12500;
@@ -1445,12 +1457,12 @@ static void drive_fill_bigbuf (drive * drv, int force)
 
     } else if (ti->type == TRACK_PCDOS) {
 
-       decode_pcdos(drv);
+       decode_pcdos (drv);
 
 
     } else if (ti->type == TRACK_AMIGADOS) {
 
-       decode_amigados(drv);
+       decode_amigados (drv);
 
     } else {
        int i;
index ae01ff79476f6e4e52ac7a827d57bcb39cf34da4..705b66cace1521a9e33afde30420ed227c18060e 100755 (executable)
--- a/drawing.c
+++ b/drawing.c
@@ -53,6 +53,7 @@
 #include "inputdevice.h"
 
 extern int sprite_buffer_res;
+int sprite_shift;
 
 int lores_factor, lores_shift;
 
@@ -109,8 +110,13 @@ struct vidbuf_description gfxvidinfo;
 /* OCS/ECS color lookup table. */
 xcolnr xcolors[4096];
 
-static uae_u8 spritepixels[MAX_PIXELS_PER_LINE * 5]; /* used when sprite resolution > lores */
-static int sprite_aga_first_x, sprite_aga_last_x;
+struct spritepixelsbuf {
+    int attach:1;
+    uae_u8 stdata;
+    uae_u16 data;
+};
+static struct spritepixelsbuf spritepixels[MAX_PIXELS_PER_LINE * 5]; /* used when sprite resolution > lores */
+static int sprite_first_x, sprite_last_x;
 
 #ifdef AGA
 /* AGA mode color lookup tables */
@@ -401,18 +407,10 @@ static void pfield_init_linetoscr (void)
     }
 #endif
 
-    if (sprite_aga_first_x < sprite_aga_last_x) {
-        uae_u8 *p = spritepixels + sprite_aga_first_x;
-       int len = sprite_aga_last_x - sprite_aga_first_x + 1;
-       int i;
-       /* clear previous sprite data storage line */
-       for (i = 0; i < (1 << (res_shift < 0 ? 0 : res_shift)); i++) {
-           memset (p, 0, len);
-           p += MAX_PIXELS_PER_LINE;
-       }
-       sprite_aga_last_x = 0;
-       sprite_aga_first_x = MAX_PIXELS_PER_LINE;
-    }
+    if (sprite_first_x < sprite_last_x)
+       memset (spritepixels + sprite_first_x, 0, sizeof (struct spritepixelsbuf) * (sprite_last_x - sprite_first_x + 1));
+    sprite_last_x = 0;
+    sprite_first_x = sizeof spritepixels;
 
     /* Now, compute some offsets.  */
     res_shift = lores_shift - bplres;
@@ -426,8 +424,6 @@ static void pfield_init_linetoscr (void)
     seen_sprites = 0;
     if (dip_for_drawing->nr_sprites == 0)
        return;
-    if (seen_sprites < 0 && sprite_buffer_res > 0)
-       memset (spritepixels, 0, sizeof spritepixels);
     seen_sprites = 1;
     /* Must clear parts of apixels.  */
     if (linetoscr_diw_start < native_ddf_left) {
@@ -447,18 +443,18 @@ void drawing_adjust_mousepos (int *xp, int *yp)
 {
 }
 
-static uae_u8 merge_2pixel8 (uae_u8 p1, uae_u8 p2)
+STATIC_INLINE uae_u8 merge_2pixel8 (uae_u8 p1, uae_u8 p2)
 {
     return p1;
 }
-static uae_u16 merge_2pixel16 (uae_u16 p1, uae_u16 p2)
+STATIC_INLINE uae_u16 merge_2pixel16 (uae_u16 p1, uae_u16 p2)
 {
     uae_u16 v = ((((p1 >> xredcolor_s) & xredcolor_m) + ((p2 >> xredcolor_s) & xredcolor_m)) / 2) << xredcolor_s;
     v |= ((((p1 >> xbluecolor_s) & xbluecolor_m) + ((p2 >> xbluecolor_s) & xbluecolor_m)) / 2) << xbluecolor_s;
     v |= ((((p1 >> xgreencolor_s) & xgreencolor_m) + ((p2 >> xgreencolor_s) & xgreencolor_m)) / 2) << xgreencolor_s;
     return v;
 }
-static uae_u32 merge_2pixel32 (uae_u32 p1, uae_u32 p2)
+STATIC_INLINE uae_u32 merge_2pixel32 (uae_u32 p1, uae_u32 p2)
 {
     uae_u32 v = ((((p1 >> 16) & 0xff) + ((p2 >> 16) & 0xff)) / 2) << 16;
     v |= ((((p1 >> 8) & 0xff) + ((p2 >> 8) & 0xff)) / 2) << 8;
@@ -583,11 +579,95 @@ STATIC_INLINE void fill_line (void)
 
 static int linetoscr_double_offset;
 
+#define SPRITE_DEBUG 0
+STATIC_INLINE uae_u8 render_sprites (int pos, int dualpf, uae_u8 apixel, int aga, int offset)
+{
+    struct spritepixelsbuf *spb = &spritepixels[(pos << sprite_shift) + offset];
+    unsigned int v = spb->data;
+    int *shift_lookup = dualpf ? (bpldualpfpri ? dblpf_ms2 : dblpf_ms1) : dblpf_ms;
+    int maskshift, plfmask;
+
+    /* The value in the shift lookup table is _half_ the shift count we
+       need.  This is because we can't shift 32 bits at once (undefined
+       behaviour in C).  */
+    maskshift = shift_lookup[apixel];
+    plfmask = (plf_sprite_mask >> maskshift) >> maskshift;
+    v &= ~plfmask;
+    if (v != 0 || SPRITE_DEBUG) {
+        unsigned int vlo, vhi, col;
+        unsigned int v1 = v & 255;
+       /* OFFS determines the sprite pair with the highest priority that has
+          any bits set.  E.g. if we have 0xFF00 in the buffer, we have sprite
+          pairs 01 and 23 cleared, and pairs 45 and 67 set, so OFFS will
+          have a value of 4.
+          2 * OFFS is the bit number in V of the sprite pair, and it also
+          happens to be the color offset for that pair. 
+       */
+       int offs;
+       if (v1 == 0)
+           offs = 4 + sprite_offs[v >> 8];
+       else
+           offs = sprite_offs[v1];
+
+       /* Shift highest priority sprite pair down to bit zero.  */
+       v >>= offs * 2;
+       v &= 15;
+#if SPRITE_DEBUG > 0
+       v ^= 8;
+#endif
+       if (spb->attach && (spb->stdata & (3 << offs))) {
+           col = v;
+           if (aga)
+               col += sbasecol[1];
+           else
+               col += 16;
+       } else {
+           /* This sequence computes the correct color value.  We have to select
+              either the lower-numbered or the higher-numbered sprite in the pair.
+              We have to select the high one if the low one has all bits zero.
+              If the lower-numbered sprite has any bits nonzero, (VLO - 1) is in
+              the range of 0..2, and with the mask and shift, VHI will be zero.
+              If the lower-numbered sprite is zero, (VLO - 1) is a mask of
+              0xFFFFFFFF, and we select the bits of the higher numbered sprite
+              in VHI.
+              This is _probably_ more efficient than doing it with branches.  */
+           vlo = v & 3;
+           vhi = (v & (vlo - 1)) >> 2;
+           col = (vlo | vhi);
+           if (aga) {
+               if (vhi > 0)
+                   col += sbasecol[1];
+               else
+                   col += sbasecol[0];
+           } else {
+               col += 16;
+           }
+           col += offs * 2;
+       }
+       
+       return col;
+    }
+
+    return 0;
+}
+
 #include "linetoscr.c"
 
 #ifdef ECS_DENISE
 /* ECS SuperHires special cases */
-static int NOINLINE linetoscr_16_sh (int spix, int dpix, int stoppos)
+
+STATIC_INLINE uae_u32 shsprite (int dpix, uae_u32 spix_val, uae_u32 v, int spr)
+{
+    uae_u8 sprcol;
+    if (!spr)
+       return v;
+    sprcol = render_sprites (dpix, 0, spix_val, 0, 0);
+    if (sprcol)
+        return colors_for_drawing.color_regs_ecs[sprcol];
+    return v;
+}
+
+static int NOINLINE linetoscr_16_sh (int spix, int dpix, int stoppos, int spr)
 {
     uae_u16 *buf = (uae_u16 *) xlinebuffer;
 
@@ -600,14 +680,16 @@ static int NOINLINE linetoscr_16_sh (int spix, int dpix, int stoppos)
        off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
        v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
        v |= v >> 2;
-       buf[dpix++] = xcolors[v];
+       buf[dpix] = shsprite (dpix, spix_val1, xcolors[v], spr);
+       dpix++;
        v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2;
        v |= v >> 2;
-       buf[dpix++] = xcolors[v];
+       buf[dpix] = shsprite (dpix, spix_val2, xcolors[v], spr);
+       dpix++;
     }
     return spix;
 }
-static int NOINLINE linetoscr_32_sh (int spix, int dpix, int stoppos)
+static int NOINLINE linetoscr_32_sh (int spix, int dpix, int stoppos, int spr)
 {
     uae_u32 *buf = (uae_u32 *) xlinebuffer;
 
@@ -620,14 +702,16 @@ static int NOINLINE linetoscr_32_sh (int spix, int dpix, int stoppos)
        off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
        v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
        v |= v >> 2;
-       buf[dpix++] = xcolors[v];
+       buf[dpix] = shsprite (dpix, spix_val1, xcolors[v], spr);
+       dpix++;
        v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2;
        v |= v >> 2;
-       buf[dpix++] = xcolors[v];
+       buf[dpix] = shsprite (dpix, spix_val2, xcolors[v], spr);
+       dpix++;
     }
     return spix;
 }
-static int NOINLINE linetoscr_32_shrink1_sh (int spix, int dpix, int stoppos)
+static int NOINLINE linetoscr_32_shrink1_sh (int spix, int dpix, int stoppos, int spr)
 {
     uae_u32 *buf = (uae_u32 *) xlinebuffer;
 
@@ -640,11 +724,12 @@ static int NOINLINE linetoscr_32_shrink1_sh (int spix, int dpix, int stoppos)
        off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
        v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
        v |= v >> 2;
-       buf[dpix++] = xcolors[v];
+       buf[dpix] = shsprite (dpix, spix_val1, xcolors[v], spr);
+       dpix++;
     }
     return spix;
 }
-static int NOINLINE linetoscr_32_shrink2_sh (int spix, int dpix, int stoppos)
+static int NOINLINE linetoscr_32_shrink1f_sh (int spix, int dpix, int stoppos, int spr)
 {
     uae_u32 *buf = (uae_u32 *) xlinebuffer;
 
@@ -661,11 +746,12 @@ static int NOINLINE linetoscr_32_shrink2_sh (int spix, int dpix, int stoppos)
        v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2;
        v |= v >> 2;
        dpix_val2 = xcolors[v];
-       buf[dpix++] = merge_2pixel32 (dpix_val1, dpix_val2);
+       buf[dpix] = shsprite (dpix, spix_val1, merge_2pixel32 (dpix_val1, dpix_val2), spr);
+       dpix++;
     }
     return spix;
 }
-static int NOINLINE linetoscr_16_shrink1_sh (int spix, int dpix, int stoppos)
+static int NOINLINE linetoscr_16_shrink1_sh (int spix, int dpix, int stoppos, int spr)
 {
     uae_u16 *buf = (uae_u16 *) xlinebuffer;
 
@@ -678,11 +764,12 @@ static int NOINLINE linetoscr_16_shrink1_sh (int spix, int dpix, int stoppos)
        off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
        v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
        v |= v >> 2;
-       buf[dpix++] = xcolors[v];
+       buf[dpix] = shsprite (dpix, spix_val1, xcolors[v], spr);
+       dpix++;
     }
     return spix;
 }
-static int NOINLINE linetoscr_16_shrink2_sh (int spix, int dpix, int stoppos)
+static int NOINLINE linetoscr_16_shrink1f_sh (int spix, int dpix, int stoppos, int spr)
 {
     uae_u16 *buf = (uae_u16 *) xlinebuffer;
 
@@ -699,7 +786,115 @@ static int NOINLINE linetoscr_16_shrink2_sh (int spix, int dpix, int stoppos)
        v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2;
        v |= v >> 2;
        dpix_val2 = xcolors[v];
-       buf[dpix++] = merge_2pixel16 (dpix_val1, dpix_val2);
+       buf[dpix] = shsprite (dpix, spix_val1, merge_2pixel16 (dpix_val1, dpix_val2), spr);
+       dpix++;
+    }
+    return spix;
+}
+
+
+
+static int NOINLINE linetoscr_32_shrink2_sh (int spix, int dpix, int stoppos, int spr)
+{
+    uae_u32 *buf = (uae_u32 *) xlinebuffer;
+
+    while (dpix < stoppos) {
+       uae_u32 spix_val1, spix_val2;
+       uae_u16 v;
+       int off;
+       spix_val1 = pixdata.apixels[spix++];
+       spix_val2 = pixdata.apixels[spix++];
+       off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
+       v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
+       v |= v >> 2;
+       buf[dpix] = shsprite (dpix, spix_val1, xcolors[v], spr);
+       spix+=2;
+       dpix++;
+    }
+    return spix;
+}
+static int NOINLINE linetoscr_32_shrink2f_sh (int spix, int dpix, int stoppos, int spr)
+{
+    uae_u32 *buf = (uae_u32 *) xlinebuffer;
+
+    while (dpix < stoppos) {
+       uae_u32 spix_val1, spix_val2, dpix_val1, dpix_val2, dpix_val3, dpix_val4;
+       uae_u16 v;
+       int off;
+       spix_val1 = pixdata.apixels[spix++];
+       spix_val2 = pixdata.apixels[spix++];
+       off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
+       v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
+       v |= v >> 2;
+       dpix_val1 = xcolors[v];
+       v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2;
+       v |= v >> 2;
+       dpix_val2 = xcolors[v];
+       dpix_val3 = merge_2pixel32 (dpix_val1, dpix_val2);
+       spix_val1 = pixdata.apixels[spix++];
+       spix_val2 = pixdata.apixels[spix++];
+       off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
+       v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
+       v |= v >> 2;
+       dpix_val1 = xcolors[v];
+       v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2;
+       v |= v >> 2;
+       dpix_val2 = xcolors[v];
+       dpix_val4 = merge_2pixel32 (dpix_val1, dpix_val2);
+       buf[dpix] = shsprite (dpix, spix_val1, merge_2pixel32 (dpix_val3, dpix_val4), spr);
+       dpix++;
+    }
+    return spix;
+}
+static int NOINLINE linetoscr_16_shrink2_sh (int spix, int dpix, int stoppos, int spr)
+{
+    uae_u16 *buf = (uae_u16 *) xlinebuffer;
+
+    while (dpix < stoppos) {
+       uae_u16 spix_val1, spix_val2;
+       uae_u16 v;
+       int off;
+       spix_val1 = pixdata.apixels[spix++];
+       spix_val2 = pixdata.apixels[spix++];
+       off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
+       v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
+       v |= v >> 2;
+       buf[dpix] = shsprite (dpix, spix_val1, xcolors[v], spr);
+       spix+=2;
+       dpix++;
+    }
+    return spix;
+}
+static int NOINLINE linetoscr_16_shrink2f_sh (int spix, int dpix, int stoppos, int spr)
+{
+    uae_u16 *buf = (uae_u16 *) xlinebuffer;
+
+    while (dpix < stoppos) {
+       uae_u16 spix_val1, spix_val2, dpix_val1, dpix_val2, dpix_val3, dpix_val4;
+       uae_u16 v;
+       int off;
+       spix_val1 = pixdata.apixels[spix++];
+       spix_val2 = pixdata.apixels[spix++];
+       off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
+       v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
+       v |= v >> 2;
+       dpix_val1 = xcolors[v];
+       v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2;
+       v |= v >> 2;
+       dpix_val2 = xcolors[v];
+       dpix_val3 = merge_2pixel32 (dpix_val1, dpix_val2);
+       spix_val1 = pixdata.apixels[spix++];
+       spix_val2 = pixdata.apixels[spix++];
+       off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16);
+       v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0;
+       v |= v >> 2;
+       dpix_val1 = xcolors[v];
+       v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2;
+       v |= v >> 2;
+       dpix_val2 = xcolors[v];
+       dpix_val4 = merge_2pixel32 (dpix_val1, dpix_val2);
+       buf[dpix] = shsprite (dpix, spix_val1, merge_2pixel16 (dpix_val3, dpix_val4), spr);
+       dpix++;
     }
     return spix;
 }
@@ -711,72 +906,86 @@ static void pfield_do_linetoscr (int start, int stop)
     if (issprites && (currprefs.chipset_mask & CSMASK_AGA)) {
        if (res_shift == 0) {
            switch (gfxvidinfo.pixbytes) {
-           case 1: src_pixel = linetoscr_8_aga_spr (src_pixel, start, stop); break;
            case 2: src_pixel = linetoscr_16_aga_spr (src_pixel, start, stop); break;
            case 4: src_pixel = linetoscr_32_aga_spr (src_pixel, start, stop); break;
            }
        } else if (res_shift == 2) {
            switch (gfxvidinfo.pixbytes) {
-           case 1: src_pixel = linetoscr_8_stretch2_aga_spr (src_pixel, start, stop); break;
            case 2: src_pixel = linetoscr_16_stretch2_aga_spr (src_pixel, start, stop); break;
            case 4: src_pixel = linetoscr_32_stretch2_aga_spr (src_pixel, start, stop); break;
            }
        } else if (res_shift == 1) {
            switch (gfxvidinfo.pixbytes) {
-           case 1: src_pixel = linetoscr_8_stretch1_aga_spr (src_pixel, start, stop); break;
            case 2: src_pixel = linetoscr_16_stretch1_aga_spr (src_pixel, start, stop); break;
            case 4: src_pixel = linetoscr_32_stretch1_aga_spr (src_pixel, start, stop); break;
            }
-       } else if (res_shift < 0) {
+       } else if (res_shift == -1) {
            if (currprefs.gfx_lores_mode) {
                switch (gfxvidinfo.pixbytes) {
-               case 1: src_pixel = linetoscr_8_shrink2_aga_spr (src_pixel, start, stop); break;
-               case 2: src_pixel = linetoscr_16_shrink2_aga_spr (src_pixel, start, stop); break;
-               case 4: src_pixel = linetoscr_32_shrink2_aga_spr (src_pixel, start, stop); break;
+               case 2: src_pixel = linetoscr_16_shrink1f_aga_spr (src_pixel, start, stop); break;
+               case 4: src_pixel = linetoscr_32_shrink1f_aga_spr (src_pixel, start, stop); break;
                }
            } else {
                switch (gfxvidinfo.pixbytes) {
-               case 1: src_pixel = linetoscr_8_shrink1_aga_spr (src_pixel, start, stop); break;
                case 2: src_pixel = linetoscr_16_shrink1_aga_spr (src_pixel, start, stop); break;
                case 4: src_pixel = linetoscr_32_shrink1_aga_spr (src_pixel, start, stop); break;
                }
            }
+       } else if (res_shift == -2) {
+           if (currprefs.gfx_lores_mode) {
+               switch (gfxvidinfo.pixbytes) {
+               case 2: src_pixel = linetoscr_16_shrink2f_aga_spr (src_pixel, start, stop); break;
+               case 4: src_pixel = linetoscr_32_shrink2f_aga_spr (src_pixel, start, stop); break;
+               }
+           } else {
+               switch (gfxvidinfo.pixbytes) {
+               case 2: src_pixel = linetoscr_16_shrink2_aga_spr (src_pixel, start, stop); break;
+               case 4: src_pixel = linetoscr_32_shrink2_aga_spr (src_pixel, start, stop); break;
+               }
+           }
        }
     } else
 #ifdef AGA
     if (currprefs.chipset_mask & CSMASK_AGA) {
        if (res_shift == 0) {
            switch (gfxvidinfo.pixbytes) {
-           case 1: src_pixel = linetoscr_8_aga (src_pixel, start, stop); break;
            case 2: src_pixel = linetoscr_16_aga (src_pixel, start, stop); break;
            case 4: src_pixel = linetoscr_32_aga (src_pixel, start, stop); break;
            }
        } else if (res_shift == 2) {
            switch (gfxvidinfo.pixbytes) {
-           case 1: src_pixel = linetoscr_8_stretch2_aga (src_pixel, start, stop); break;
            case 2: src_pixel = linetoscr_16_stretch2_aga (src_pixel, start, stop); break;
            case 4: src_pixel = linetoscr_32_stretch2_aga (src_pixel, start, stop); break;
            }
        } else if (res_shift == 1) {
            switch (gfxvidinfo.pixbytes) {
-           case 1: src_pixel = linetoscr_8_stretch1_aga (src_pixel, start, stop); break;
            case 2: src_pixel = linetoscr_16_stretch1_aga (src_pixel, start, stop); break;
            case 4: src_pixel = linetoscr_32_stretch1_aga (src_pixel, start, stop); break;
            }
-       } else if (res_shift < 0) {
+       } else if (res_shift == -1) {
            if (currprefs.gfx_lores_mode) {
                switch (gfxvidinfo.pixbytes) {
-               case 1: src_pixel = linetoscr_8_shrink2_aga (src_pixel, start, stop); break;
-               case 2: src_pixel = linetoscr_16_shrink2_aga (src_pixel, start, stop); break;
-               case 4: src_pixel = linetoscr_32_shrink2_aga (src_pixel, start, stop); break;
+               case 2: src_pixel = linetoscr_16_shrink1f_aga (src_pixel, start, stop); break;
+               case 4: src_pixel = linetoscr_32_shrink1f_aga (src_pixel, start, stop); break;
                }
            } else {
                switch (gfxvidinfo.pixbytes) {
-               case 1: src_pixel = linetoscr_8_shrink1_aga (src_pixel, start, stop); break;
                case 2: src_pixel = linetoscr_16_shrink1_aga (src_pixel, start, stop); break;
                case 4: src_pixel = linetoscr_32_shrink1_aga (src_pixel, start, stop); break;
                }
            }
+       } else if (res_shift == -2) {
+           if (currprefs.gfx_lores_mode) {
+               switch (gfxvidinfo.pixbytes) {
+               case 2: src_pixel = linetoscr_16_shrink2f_aga (src_pixel, start, stop); break;
+               case 4: src_pixel = linetoscr_32_shrink2f_aga (src_pixel, start, stop); break;
+               }
+           } else {
+               switch (gfxvidinfo.pixbytes) {
+               case 2: src_pixel = linetoscr_16_shrink2_aga (src_pixel, start, stop); break;
+               case 4: src_pixel = linetoscr_32_shrink2_aga (src_pixel, start, stop); break;
+               }
+           }
        }
     } else
 #endif
@@ -784,25 +993,71 @@ static void pfield_do_linetoscr (int start, int stop)
     if (ecsshres) {
        if (res_shift == 0) {
            switch (gfxvidinfo.pixbytes) {
-           case 2: src_pixel = linetoscr_16_sh (src_pixel, start, stop); break;
-           case 4: src_pixel = linetoscr_32_sh (src_pixel, start, stop); break;
+           case 2: src_pixel = linetoscr_16_sh (src_pixel, start, stop, issprites); break;
+           case 4: src_pixel = linetoscr_32_sh (src_pixel, start, stop, issprites); break;
            }
-       } else if (res_shift < 0) {
+       } else if (res_shift == -1) {
            if (currprefs.gfx_lores_mode) {
                switch (gfxvidinfo.pixbytes) {
-               case 2: src_pixel = linetoscr_16_shrink2_sh (src_pixel, start, stop); break;
-               case 4: src_pixel = linetoscr_32_shrink2_sh (src_pixel, start, stop); break;
+               case 2: src_pixel = linetoscr_16_shrink1f_sh (src_pixel, start, stop, issprites); break;
+               case 4: src_pixel = linetoscr_32_shrink1f_sh (src_pixel, start, stop, issprites); break;
                }
            } else {
                switch (gfxvidinfo.pixbytes) {
-               case 2: src_pixel = linetoscr_16_shrink1_sh (src_pixel, start, stop); break;
-               case 4: src_pixel = linetoscr_32_shrink1_sh (src_pixel, start, stop); break;
+               case 2: src_pixel = linetoscr_16_shrink1_sh (src_pixel, start, stop, issprites); break;
+               case 4: src_pixel = linetoscr_32_shrink1_sh (src_pixel, start, stop, issprites); break;
+               }
+           }
+       } else if (res_shift == -2) {
+           if (currprefs.gfx_lores_mode) {
+               switch (gfxvidinfo.pixbytes) {
+               case 2: src_pixel = linetoscr_16_shrink2f_sh (src_pixel, start, stop, issprites); break;
+               case 4: src_pixel = linetoscr_32_shrink2f_sh (src_pixel, start, stop, issprites); break;
+               }
+           } else {
+               switch (gfxvidinfo.pixbytes) {
+               case 2: src_pixel = linetoscr_16_shrink2_sh (src_pixel, start, stop, issprites); break;
+               case 4: src_pixel = linetoscr_32_shrink2_sh (src_pixel, start, stop, issprites); break;
                }
            }
        }
     } else
 #endif
-    if (1) {
+    if (issprites) {
+       if (res_shift == 0) {
+           switch (gfxvidinfo.pixbytes) {
+           case 1: src_pixel = linetoscr_8_spr (src_pixel, start, stop); break;
+           case 2: src_pixel = linetoscr_16_spr (src_pixel, start, stop); break;
+           case 4: src_pixel = linetoscr_32_spr (src_pixel, start, stop); break;
+           }
+       } else if (res_shift == 2) {
+           switch (gfxvidinfo.pixbytes) {
+           case 1: src_pixel = linetoscr_8_stretch2_spr (src_pixel, start, stop); break;
+           case 2: src_pixel = linetoscr_16_stretch2_spr (src_pixel, start, stop); break;
+           case 4: src_pixel = linetoscr_32_stretch2_spr (src_pixel, start, stop); break;
+           }
+       } else if (res_shift == 1) {
+           switch (gfxvidinfo.pixbytes) {
+           case 1: src_pixel = linetoscr_8_stretch1_spr (src_pixel, start, stop); break;
+           case 2: src_pixel = linetoscr_16_stretch1_spr (src_pixel, start, stop); break;
+           case 4: src_pixel = linetoscr_32_stretch1_spr (src_pixel, start, stop); break;
+           }
+       } else if (res_shift == -1) {
+           if (currprefs.gfx_lores_mode) {
+               switch (gfxvidinfo.pixbytes) {
+               case 1: src_pixel = linetoscr_8_shrink1f_spr (src_pixel, start, stop); break;
+               case 2: src_pixel = linetoscr_16_shrink1f_spr (src_pixel, start, stop); break;
+               case 4: src_pixel = linetoscr_32_shrink1f_spr (src_pixel, start, stop); break;
+               }
+           } else {
+               switch (gfxvidinfo.pixbytes) {
+               case 1: src_pixel = linetoscr_8_shrink1_spr (src_pixel, start, stop); break;
+               case 2: src_pixel = linetoscr_16_shrink1_spr (src_pixel, start, stop); break;
+               case 4: src_pixel = linetoscr_32_shrink1_spr (src_pixel, start, stop); break;
+               }
+           }
+       }
+    } else {
        if (res_shift == 0) {
            switch (gfxvidinfo.pixbytes) {
            case 1: src_pixel = linetoscr_8 (src_pixel, start, stop); break;
@@ -821,12 +1076,12 @@ static void pfield_do_linetoscr (int start, int stop)
            case 2: src_pixel = linetoscr_16_stretch1 (src_pixel, start, stop); break;
            case 4: src_pixel = linetoscr_32_stretch1 (src_pixel, start, stop); break;
            }
-       } else if (res_shift < 0) {
+       } else if (res_shift == -1) {
            if (currprefs.gfx_lores_mode) {
                switch (gfxvidinfo.pixbytes) {
-               case 1: src_pixel = linetoscr_8_shrink2 (src_pixel, start, stop); break;
-               case 2: src_pixel = linetoscr_16_shrink2 (src_pixel, start, stop); break;
-               case 4: src_pixel = linetoscr_32_shrink2 (src_pixel, start, stop); break;
+               case 1: src_pixel = linetoscr_8_shrink1f (src_pixel, start, stop); break;
+               case 2: src_pixel = linetoscr_16_shrink1f (src_pixel, start, stop); break;
+               case 4: src_pixel = linetoscr_32_shrink1f (src_pixel, start, stop); break;
                }
            } else {
                switch (gfxvidinfo.pixbytes) {
@@ -837,6 +1092,7 @@ static void pfield_do_linetoscr (int start, int stop)
            }
        }
     }
+
 }
 
 static void dummy_worker (int start, int stop)
@@ -1008,303 +1264,63 @@ static void gen_pfield_tables (void)
     }
 }
 
-#define SPRITE_DEBUG 0
-
-STATIC_INLINE void sprpixel (int *xpos, int *spr_level, int spr_level_max, uae_u8 col)
-{
-    spritepixels[(*spr_level) * MAX_PIXELS_PER_LINE + (*xpos)] = col;
-    (*spr_level)++;
-    if ((*spr_level) >= spr_level_max) {
-       *spr_level = 0;
-       (*xpos)++;
-    }
-}
-
 /* When looking at this function and the ones that inline it, bear in mind
    what an optimizing compiler will do with this code.  All callers of this
    function only pass in constant arguments (except for E).  This means
    that many of the if statements will go away completely after inlining.  */
-STATIC_INLINE void draw_sprites_2 (struct sprite_entry *e, int ham, int dualpf,
-    int posdoubling, int posskip, int sizedoubling, int sizeskip, int has_attach, int aga)
+STATIC_INLINE void draw_sprites_1 (struct sprite_entry *e, int dualpf, int has_attach)
 {
-    int *shift_lookup = dualpf ? (bpldualpfpri ? dblpf_ms2 : dblpf_ms1) : dblpf_ms;
     uae_u16 *buf = spixels + e->first_pixel;
     uae_u8 *stbuf = spixstate.bytes + e->first_pixel;
-    int pos, window_pos, spr_level, spr_level_max;
+    int spr_pos, pos;
 
     buf -= e->pos;
     stbuf -= e->pos;
 
-    window_pos = e->pos + ((DIW_DDF_OFFSET - DISPLAY_LEFT_SHIFT) << sprite_buffer_res);
-
-    spr_level = 0;
-    spr_level_max = 0;
-    if (res_shift > 0 && aga) {
-       spr_level_max = 1 << res_shift;
-       spr_level = window_pos & (spr_level_max - 1);
-    }
-
-    if (posskip)
-       window_pos >>= posskip;
-    else if (posdoubling)
-       window_pos <<= posdoubling;
-    window_pos += pixels_offset;
-
-    if (aga) {
-       if (window_pos < sprite_aga_first_x)
-           sprite_aga_first_x = window_pos;
-    }
-
-    for (pos = e->pos; pos < e->max; pos += 1 << sizeskip) {
-       int maskshift, plfmask;
-       unsigned int v = buf[pos];
-
-       /* The value in the shift lookup table is _half_ the shift count we
-          need.  This is because we can't shift 32 bits at once (undefined
-          behaviour in C).  */
-       maskshift = shift_lookup[pixdata.apixels[window_pos]];
-       plfmask = (plf_sprite_mask >> maskshift) >> maskshift;
-       v &= ~plfmask;
-       if (v != 0 || SPRITE_DEBUG) {
-           unsigned int vlo, vhi, col;
-           unsigned int v1 = v & 255;
-           /* OFFS determines the sprite pair with the highest priority that has
-              any bits set.  E.g. if we have 0xFF00 in the buffer, we have sprite
-              pairs 01 and 23 cleared, and pairs 45 and 67 set, so OFFS will
-              have a value of 4.
-              2 * OFFS is the bit number in V of the sprite pair, and it also
-              happens to be the color offset for that pair.  */
-           int offs;
-           if (v1 == 0)
-               offs = 4 + sprite_offs[v >> 8];
-           else
-               offs = sprite_offs[v1];
+    spr_pos = e->pos + ((DIW_DDF_OFFSET - DISPLAY_LEFT_SHIFT) << sprite_buffer_res);
 
-           /* Shift highest priority sprite pair down to bit zero.  */
-           v >>= offs * 2;
-           v &= 15;
-#if SPRITE_DEBUG > 0
-           v ^= 8;
-#endif
+    if (spr_pos < sprite_first_x)
+        sprite_first_x = spr_pos;
 
-           if (has_attach && (stbuf[pos] & (3 << offs))) {
-               col = v;
-               if (aga)
-                   col += sbasecol[1];
-               else
-                   col += 16;
-           } else {
-               /* This sequence computes the correct color value.  We have to select
-                  either the lower-numbered or the higher-numbered sprite in the pair.
-                  We have to select the high one if the low one has all bits zero.
-                  If the lower-numbered sprite has any bits nonzero, (VLO - 1) is in
-                  the range of 0..2, and with the mask and shift, VHI will be zero.
-                  If the lower-numbered sprite is zero, (VLO - 1) is a mask of
-                  0xFFFFFFFF, and we select the bits of the higher numbered sprite
-                  in VHI.
-                  This is _probably_ more efficient than doing it with branches.  */
-               vlo = v & 3;
-               vhi = (v & (vlo - 1)) >> 2;
-               col = (vlo | vhi);
-               if (aga) {
-                   if (vhi > 0)
-                       col += sbasecol[1];
-                   else
-                       col += sbasecol[0];
-               } else {
-                   col += 16;
-               }
-               col += offs * 2;
-           }
-
-           if (dualpf) {
-#ifdef AGA
-               if (aga) {
-
-                   sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                   if (sizedoubling)
-                       sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                   if (sizedoubling > 1) {
-                       sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                       sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                   }
-
-               } else {
-#endif
-                   col += 128;
-                   if (sizedoubling)
-                       pixdata.apixels_w[window_pos >> 1] = col | (col << 8);
-                   else
-                       pixdata.apixels[window_pos] = col;
-                   window_pos += 1 << sizedoubling;
-#ifdef AGA
-               }
-#endif
-           } else if (ham) {
-
-#ifdef AGA
-               if (aga) {
-
-                   sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                   if (sizedoubling)
-                       sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                   if (sizedoubling > 1) {
-                       sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                       sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                   }
-
-               } else {
-#endif
-                   col = color_reg_get (&colors_for_drawing, col);
-                   ham_linebuf[window_pos] = col;
-                   if (sizedoubling)
-                       ham_linebuf[window_pos + 1] = col;
-                   if (sizedoubling > 1) {
-                       ham_linebuf[window_pos + 2] = col;
-                       ham_linebuf[window_pos + 3] = col;
-                   }
-                   window_pos += 1 << sizedoubling;
-#ifdef AGA
-               }
-#endif
-           } else {
-#ifdef AGA
-               if (aga) {
-
-                   sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                   if (sizedoubling)
-                       sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                   if (sizedoubling > 1) {
-                       sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                       sprpixel (&window_pos, &spr_level, spr_level_max, col);
-                   }
-
-               } else {
-#endif
-                   if (sizedoubling > 1) {
-                       pixdata.apixels_w[window_pos >> 1] = col | (col << 8);
-                       pixdata.apixels_w[(window_pos >> 1) + 1] = col | (col << 8);
-                   } else if (sizedoubling) {
-                       pixdata.apixels_w[window_pos >> 1] = col | (col << 8);
-                   } else {
-                       pixdata.apixels[window_pos] = col;
-                   }
-                   window_pos += 1 << sizedoubling;
-#ifdef AGA
-               }
-#endif
-           }
-
-       } else {
-
-           if (aga) {
-               if (spr_level_max) {
-                   spr_level += 1 << sizedoubling;
-                   while(spr_level >= spr_level_max) {
-                       spr_level -= spr_level_max;
-                       window_pos++;
-                   }
-               } else {
-                   window_pos += 1 << sizedoubling;
-               }
-           } else {
-               window_pos += 1 << sizedoubling;
-           }
-       }
-
-    }
-    if (aga) {
-       if (window_pos > sprite_aga_last_x)
-           sprite_aga_last_x = window_pos;
+    for (pos = e->pos; pos < e->max; pos++) {
+       spritepixels[spr_pos].data = buf[pos];
+       spritepixels[spr_pos].stdata = stbuf[pos];
+       spritepixels[spr_pos].attach = has_attach;
+       spr_pos++;
     }
-}
-STATIC_INLINE void draw_sprites_1 (struct sprite_entry *e, int ham, int dualpf,
-    int doubling, int skip, int has_attach)
-{
-    draw_sprites_2 (e, ham, dualpf, doubling, skip, doubling, skip, has_attach, 0);
+
+    if (spr_pos > sprite_last_x)
+        sprite_last_x = spr_pos;
 }
 
 /* See comments above.  Do not touch if you don't know what's going on.
  * (We do _not_ want the following to be inlined themselves).  */
 /* lores bitplane, lores sprites */
-static void NOINLINE draw_sprites_normal_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 0); }
-static void NOINLINE draw_sprites_normal_dp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 0); }
-static void NOINLINE draw_sprites_ham_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 0); }
-static void NOINLINE draw_sprites_normal_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 1); }
-static void NOINLINE draw_sprites_normal_dp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 1); }
-static void NOINLINE draw_sprites_ham_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 1); }
-/* hires bitplane, lores sprites */
-static void NOINLINE draw_sprites_normal_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 0); }
-static void NOINLINE draw_sprites_normal_dp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 0); }
-static void NOINLINE draw_sprites_ham_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 0); }
-static void NOINLINE draw_sprites_normal_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 1); }
-static void NOINLINE draw_sprites_normal_dp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 1); }
-static void NOINLINE draw_sprites_ham_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 1); }
-/* shres bitplane, lores sprites (emulation restriction, real ECS SHRES uses hires), ECS DENISE only */
-static void NOINLINE draw_sprites_normal_sp_shi_nat (struct sprite_entry *e) { draw_sprites_2 (e, 0, 0, 2, 0, 1, 0, 0, 0); }
+static void NOINLINE draw_sprites_normal_sp_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0); }
+static void NOINLINE draw_sprites_normal_dp_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0); }
+static void NOINLINE draw_sprites_normal_sp_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1); }
+static void NOINLINE draw_sprites_normal_dp_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 1); }
 
 #ifdef AGA
 /* not very optimized */
 STATIC_INLINE void draw_sprites_aga (struct sprite_entry *e, int aga)
 {
-    int sizediff = sprite_buffer_res - lores_shift;
-    int posdiff = sprite_buffer_res - bplres;
-    int sizediff2 = 0, posdiff2 = 0;
-
-    if (sizediff < 0) {
-       sizediff2 = -sizediff;
-       sizediff = 0;
-    }
-    if (posdiff < 0) {
-       posdiff2 = -posdiff;
-       posdiff = 0;
-    }
-    draw_sprites_2 (e, dp_for_drawing->ham_seen, bpldualpf, posdiff2, posdiff,
-       sizediff2, sizediff, e->has_attached, aga);
+    draw_sprites_1 (e, bpldualpf, e->has_attached);
 }
 #endif
 
 STATIC_INLINE void draw_sprites_ecs (struct sprite_entry *e)
 {
-    int res = bplres;
     if (e->has_attached) {
-       if (res == 1)
-           if (dp_for_drawing->ham_seen)
-               draw_sprites_ham_sp_hi_at (e);
-           else
-               if (bpldualpf)
-                   draw_sprites_normal_dp_hi_at (e);
-               else
-                   draw_sprites_normal_sp_hi_at (e);
+       if (bpldualpf)
+           draw_sprites_normal_dp_at (e);
        else
-           if (dp_for_drawing->ham_seen)
-               draw_sprites_ham_sp_lo_at (e);
-           else
-               if (bpldualpf)
-                   draw_sprites_normal_dp_lo_at (e);
-               else
-                   draw_sprites_normal_sp_lo_at (e);
+           draw_sprites_normal_sp_at (e);
     } else {
-       if (res == 1)
-           if (dp_for_drawing->ham_seen)
-               draw_sprites_ham_sp_hi_nat (e);
-           else
-               if (bpldualpf)
-                   draw_sprites_normal_dp_hi_nat (e);
-               else
-                   draw_sprites_normal_sp_hi_nat (e);
-       else if (res == 0)
-           if (dp_for_drawing->ham_seen)
-               draw_sprites_ham_sp_lo_nat (e);
-           else
-               if (bpldualpf)
-                   draw_sprites_normal_dp_lo_nat (e);
-               else
-                   draw_sprites_normal_sp_lo_nat (e);
-#ifdef ECS_DENISE
-       else if (res == 2) /* ECS SHRES = hardware limits to non-attached */
-           draw_sprites_normal_sp_shi_nat (e);
-#endif
+       if (bpldualpf)
+           draw_sprites_normal_dp_nat (e);
+       else
+           draw_sprites_normal_sp_nat (e);
     }
 }
 
@@ -2740,11 +2756,15 @@ void reset_drawing (void)
     frame_res_cnt = FRAMES_UNTIL_RES_SWITCH;
     lightpen_y1 = lightpen_y2 = -1;
 
-    sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : RES_LORES;
-    if (sprite_buffer_res > currprefs.gfx_resolution + (doublescan > 0 ? 1 : 0))
-       sprite_buffer_res = currprefs.gfx_resolution + (doublescan > 0 ? 1 : 0);
-    if (sprite_buffer_res > RES_SUPERHIRES)
-       sprite_buffer_res = RES_SUPERHIRES;
+    sprite_shift = 0;
+    sprite_buffer_res = currprefs.gfx_resolution;
+    if (doublescan > 0 && sprite_buffer_res < RES_SUPERHIRES)
+       sprite_buffer_res++;
+    if (((currprefs.chipset_mask & CSMASK_AGA) || ecsshres) && sprite_buffer_res < RES_SUPERHIRES) {
+       sprite_buffer_res++;
+       sprite_shift = 1;
+    }
+
 }
 
 void drawing_init (void)
index 69211fba9b732bac654e959a307cbb2c3e185ff9..2d301230e95a168466b177c341f90c47d58de22d 100755 (executable)
@@ -47,10 +47,12 @@ typedef enum
     HMODE_NORMAL,
     HMODE_DOUBLE,
     HMODE_DOUBLE2X,
-    HMODE_HALVE,
-    HMODE_HALVE2
+    HMODE_HALVE1,
+    HMODE_HALVE1F,
+    HMODE_HALVE2,
+    HMODE_HALVE2F
 } HMODE_T;
-#define HMODE_MAX HMODE_HALVE2
+#define HMODE_MAX HMODE_HALVE2F
 
 static const char *get_hmode_str (HMODE_T hmode)
 {
@@ -58,10 +60,14 @@ static const char *get_hmode_str (HMODE_T hmode)
        return "_stretch1";
    else if (hmode == HMODE_DOUBLE2X)
        return "_stretch2";
-   else if (hmode == HMODE_HALVE)
+   else if (hmode == HMODE_HALVE1)
        return "_shrink1";
+   else if (hmode == HMODE_HALVE1F)
+       return "_shrink1f";
    else if (hmode == HMODE_HALVE2)
        return "_shrink2";
+   else if (hmode == HMODE_HALVE2F)
+       return "_shrink2f";
    else
        return "";
 }
@@ -118,24 +124,38 @@ static void out_linetoscr_decl (DEPTH_T bpp, HMODE_T hmode, int aga, int spr)
            get_hmode_str (hmode), aga ? "_aga" : "", spr ? "_spr" : "");
 }
 
-static void out_linetoscr_do_srcpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode)
+static void out_linetoscr_do_srcpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode, int spr)
 {
-    if (aga && cmode != CMODE_DUALPF)
+    if (aga && cmode != CMODE_DUALPF) {
+       if (spr)
+           outln (     "    sprpix_val = pixdata.apixels[spix];");
        outln (         "    spix_val = pixdata.apixels[spix] ^ xor_val;");
-    else if (cmode != CMODE_HAM)
+    } else if (cmode != CMODE_HAM) {
        outln (         "    spix_val = pixdata.apixels[spix];");
+       if (spr)
+           outln (     "    sprpix_val = spix_val;");
+    }
 }
 
-static void out_linetoscr_do_dstpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode)
+static void out_linetoscr_do_dstpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode, int spr)
 {
-    if (aga && cmode == CMODE_HAM)
+    if (aga && cmode == CMODE_HAM) {
        outln (         "    dpix_val = CONVERT_RGB (ham_linebuf[spix]);");
-    else if (cmode == CMODE_HAM)
+       if (spr)
+           outln (     "    sprpix_val = dpix_val;");
+    } else if (cmode == CMODE_HAM) {
        outln (         "    dpix_val = xcolors[ham_linebuf[spix]];");
-    else if (aga && cmode == CMODE_DUALPF) {
-       outln (         "    if (spritepixels[spix]) {");
-       outln (         "        dpix_val = colors_for_drawing.acolors[spritepixels[spix]];");
-       outln (         "    } else {");
+       if (spr)
+           outln (     "    sprpix_val = dpix_val;");
+    } else if (aga && cmode == CMODE_DUALPF) {
+       if (spr) {
+           outlnf (    "    sprcol = render_sprites (dpix, 1, sprpix_val, %d, 0);", aga);
+           outln (     "    if (sprcol) {");
+           outln (     "        dpix_val = colors_for_drawing.acolors[sprcol];");
+           outln (     "    } else {");
+       } else {
+           outln (     "        if (1) {");
+       }
        outln (         "        unsigned int val = lookup[spix_val];");
        outln (         "        if (lookup_no[spix_val] == 2)");
        outln (         "            val += dblpfofs[bpldualpf2of];");
@@ -159,25 +179,57 @@ static void out_linetoscr_do_dstpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_
        outln (         "    dpix_val = colors_for_drawing.acolors[spix_val];");
 }
 
-static void out_linetoscr_do_incspix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode)
+static void out_linetoscr_do_incspix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode, int spr)
 {
-    if (hmode == HMODE_HALVE2) {
+    if (hmode == HMODE_HALVE1F) {
+       outln (         "    {");
+       outln (         "    uae_u32 tmp_val;");
        outln (         "    spix++;");
        outln (         "    tmp_val = dpix_val;");
-       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode);
-       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode);
+       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
        outlnf (        "    dpix_val = merge_2pixel%d (dpix_val, tmp_val);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32);
        outln (         "    spix++;");
-    } else if (hmode == HMODE_HALVE)
+       outln (         "    }");
+    } else if (hmode == HMODE_HALVE2F) {
+       outln (         "    {");
+       outln (         "    uae_u32 tmp_val, tmp_val2, tmp_val3;");
+       outln (         "    spix++;");
+       outln (         "    tmp_val = dpix_val;");
+       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
+       outln (         "    spix++;");
+       outln (         "    tmp_val2 = dpix_val;");
+       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
+       outln (         "    spix++;");
+       outln (         "    tmp_val3 = dpix_val;");
+       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
+       outlnf (        "    tmp_val = merge_2pixel%d (tmp_val, tmp_val2);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32);
+       outlnf (        "    tmp_val2 = merge_2pixel%d (tmp_val3, dpix_val);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32);
+       outlnf (        "    dpix_val = merge_2pixel%d (tmp_val, tmp_val2);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32);
+       outln (         "    spix++;");
+       outln (         "    }");
+    } else if (hmode == HMODE_HALVE1) {
        outln (         "    spix += 2;");
-    else
+    } else if (hmode == HMODE_HALVE2) {
+       outln (         "    spix += 4;");
+    } else {
        outln (         "    spix++;");
+    }
 }
 
-static void out_sprite (int off)
+static void out_sprite (DEPTH_T bpp, HMODE_T hmode, CMODE_T cmode, int aga)
 {
-    outlnf ( "    if (spritepixels[sprx + MAX_PIXELS_PER_LINE * %d]) {", off);
-    outlnf ( "        buf[dpix] = colors_for_drawing.acolors[spritepixels[sprx + MAX_PIXELS_PER_LINE * %d]];", off);
+    outlnf ( "    sprcol = render_sprites (dpix, %d, sprpix_val, %d, 0);", cmode == CMODE_DUALPF ? 1 : 0, aga);
+    outlnf ( "    if (sprcol) {");
+    outlnf ( "        uae_u32 spcol = colors_for_drawing.acolors[sprcol];");
+    outlnf ( "        if (sprite_shift) {");
+    outlnf ( "            uae_u8 sprcol2 = render_sprites (dpix, %d, sprpix_val, %d, 1);", cmode == CMODE_DUALPF ? 1 : 0, aga);
+    outlnf ( "            spcol = merge_2pixel%d (spcol, colors_for_drawing.acolors[sprcol2]);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32);
+    outlnf ( "        }");
+    outlnf ( "        buf[dpix] = spcol;");
     outlnf ( "    } else {");
     outlnf ( "        buf[dpix] = out_val;");
     outlnf ( "    }");
@@ -202,12 +254,10 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CM
        outln (         "if (((long)&buf[dpix]) & 2) {");
        outln (         "    uae_u32 spix_val;");
        outln (         "    uae_u32 dpix_val;");
-       if (hmode == HMODE_HALVE2)
-           outln (     "    uae_u32 tmp_val;");
 
-       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode);
-       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode);
-       out_linetoscr_do_incspix (bpp, hmode, aga, cmode);
+       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_incspix (bpp, hmode, aga, cmode, spr);
 
        outln (         "    buf[dpix++] = dpix_val;");
        outln (         "}");
@@ -221,24 +271,22 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CM
 
     outln (            "while (dpix < stoppos) {");
     if (spr)
-       outln (         "    int sprx = spix;");
+       outln (         "    uae_u32 sprpix_val;");
     outln (            "    uae_u32 spix_val;");
     outln (            "    uae_u32 dpix_val;");
     outln (            "    uae_u32 out_val;");
-    if (hmode == HMODE_HALVE2)
-       outln (         "    uae_u32 tmp_val;");
     outln (            "");
 
-    out_linetoscr_do_srcpix (bpp, hmode, aga, cmode);
-    out_linetoscr_do_dstpix (bpp, hmode, aga, cmode);
-    out_linetoscr_do_incspix (bpp, hmode, aga, cmode);
+    out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
+    out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
+    out_linetoscr_do_incspix (bpp, hmode, aga, cmode, spr);
 
     outln (            "    out_val = dpix_val;");
 
     if (hmode != HMODE_DOUBLE && hmode != HMODE_DOUBLE2X && bpp == DEPTH_16BPP && spr == 0) {
-       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode);
-       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode);
-       out_linetoscr_do_incspix (bpp, hmode, aga, cmode);
+       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_incspix (bpp, hmode, aga, cmode, spr);
 
        if (do_bigendian)
            outln (     "    out_val = (out_val << 16) | (dpix_val & 0xFFFF);");
@@ -252,16 +300,16 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CM
            outln (     "    dpix += 2;");
        } else if (bpp == DEPTH_16BPP) {
            if (spr) {
-               out_sprite (0);
-               out_sprite (1);
+               out_sprite (bpp, hmode, cmode, aga);
+               out_sprite (bpp, hmode, cmode, aga);
            } else {
                outln ( "    *((uae_u32 *)&buf[dpix]) = out_val;");
                outln ( "    dpix += 2;");
            }
        } else {
            if (spr) {
-               out_sprite (0);
-               out_sprite (1);
+               out_sprite (bpp, hmode, cmode, aga);
+               out_sprite (bpp, hmode, cmode, aga);
            } else {
                outln ( "    buf[dpix++] = out_val;");
                outln ( "    buf[dpix++] = out_val;");
@@ -273,10 +321,10 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CM
            outln (     "    dpix += 4;");
        } else if (bpp == DEPTH_16BPP) {
            if (spr) {
-               out_sprite (0);
-               out_sprite (1);
-               out_sprite (2);
-               out_sprite (3);
+               out_sprite (bpp, hmode, cmode, aga);
+               out_sprite (bpp, hmode, cmode, aga);
+               out_sprite (bpp, hmode, cmode, aga);
+               out_sprite (bpp, hmode, cmode, aga);
            } else {
                outln ( "    *((uae_u32 *)&buf[dpix]) = out_val;");
                outln ( "    dpix += 2;");
@@ -285,10 +333,10 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CM
            }
        } else {
            if (spr) {
-               out_sprite (0);
-               out_sprite (1);
-               out_sprite (2);
-               out_sprite (3);
+               out_sprite (bpp, hmode, cmode, aga);
+               out_sprite (bpp, hmode, cmode, aga);
+               out_sprite (bpp, hmode, cmode, aga);
+               out_sprite (bpp, hmode, cmode, aga);
            } else {
                outln ( "    buf[dpix++] = out_val;");
                outln ( "    buf[dpix++] = out_val;");
@@ -299,14 +347,14 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CM
     } else {
        if (bpp == DEPTH_16BPP) {
            if (spr) {
-               out_sprite (0);
+               out_sprite (bpp, hmode, cmode, aga);
            } else {
                outln ( "    *((uae_u32 *)&buf[dpix]) = out_val;");
                outln ( "    dpix += 2;");
            }
        } else {
            if (spr) {
-               out_sprite (0);
+               out_sprite (bpp, hmode, cmode, aga);
            } else {
                outln ( "    buf[dpix++] = out_val;");
            }
@@ -320,12 +368,10 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CM
        outln (         "if (rem) {");
        outln (         "    uae_u32 spix_val;");
        outln (         "    uae_u32 dpix_val;");
-       if (hmode == HMODE_HALVE2)
-           outln (     "    uae_u32 tmp_val;");
 
-       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode);
-       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode);
-       out_linetoscr_do_incspix (bpp, hmode, aga, cmode);
+       out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
+       out_linetoscr_do_incspix (bpp, hmode, aga, cmode, spr);
 
        outln (         "    buf[dpix++] = dpix_val;");
        outln (         "}");
@@ -345,6 +391,8 @@ static void out_linetoscr (DEPTH_T bpp, HMODE_T hmode, int aga, int spr)
     outln  (   "{");
 
     outlnf (   "    %s *buf = (%s *) xlinebuffer;", get_depth_type_str (bpp), get_depth_type_str (bpp));
+    if (spr)
+       outln ( "    uae_u8 sprcol;");
     if (aga)
        outln ( "    uae_u8 xor_val = bplxor;");
     outln  (   "");
@@ -394,9 +442,9 @@ int main (int argc, char *argv[])
 
    for (bpp = DEPTH_8BPP; bpp <= DEPTH_MAX; bpp++) {
        for (aga = 0; aga <= 1 ; aga++) {
+           if (aga && bpp == DEPTH_8BPP)
+               continue;
            for (spr = 0; spr <= 1; spr++) {
-               if (spr && !aga)
-                   continue;
                for (hmode = HMODE_NORMAL; hmode <= HMODE_MAX; hmode++)
                    out_linetoscr (bpp, hmode, aga, spr);
            }
index 1142e73c022e24592c07bb52b7b4b7fd4d230f75..963387361be3307efe41850903661b2a824b0696 100755 (executable)
@@ -9,7 +9,7 @@
 
 #define UAEMAJOR 1
 #define UAEMINOR 5
-#define UAESUBREV 3
+#define UAESUBREV 4
 
 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang;
 
index d8251ce6cb675bea186f00d047a107dcfb0ec6a0..07709a36affa40ec808b14641fba873e90eb4200 100755 (executable)
@@ -1253,11 +1253,91 @@ uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra)
     }
 }
 
+static void charge_cap (int joy, int idx, int charge)
+{
+    if (charge < -1 || charge > 1)
+       charge = charge * 80;
+    pot_cap[joy][idx] += charge;
+    if (pot_cap[joy][idx] < 0)
+       pot_cap[joy][idx] = 0;
+    if (pot_cap[joy][idx] > 511)
+       pot_cap[joy][idx] = 511;
+}
+
+static void cap_check (void)
+{
+    int joy, i;
+
+    for (joy = 0; joy < 2; joy++) {
+       for (i = 0; i < 2; i++) {
+           int charge = 0;
+           uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */
+           uae_u16 pdat = 0x0100 << (joy * 4 + i * 2); /* data */
+           int isbutton = getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2);
+
+           if (cd32_pad_enabled[joy])
+               continue;
+           if (analog_port[joy][i] && pot_cap[joy][i] < joydirpot[joy][i])
+               charge = 1; // slow charge via pot variable resistor
+           if ((digital_port[joy][i] || mouse_port[joy]))
+               charge = 1; // slow charge via pull-up resistor
+           if (!(potgo_value & pdir)) { // input?
+               if (pot_dat_act[joy][i])
+                   pot_dat[joy][i]++;
+               /* first 8 lines after potgo has been started = discharge cap */
+               if (pot_dat_act[joy][i] == 1) {
+                   if (pot_dat[joy][i] < (currprefs.ntscmode ? POTDAT_DELAY_NTSC : POTDAT_DELAY_PAL)) {
+                       charge = -2; /* fast discharge delay */
+                   } else {
+                       pot_dat_act[joy][i] = 2;
+                       pot_dat[joy][i] = 0;
+                   }
+               }
+               if (analog_port[joy][i] && pot_dat_act[joy][i] == 2 && pot_cap[joy][i] >= joydirpot[joy][i])
+                   pot_dat_act[joy][i] = 0;
+               if ((digital_port[joy][i] || mouse_port[joy]) && pot_dat_act[joy][i] == 2) {
+                   if (pot_cap[joy][i] >= 10 && !isbutton)
+                       pot_dat_act[joy][i] = 0;
+               }
+           } else { // output?
+               charge = (potgo_value & pdat) ? 2 : -2; /* fast (dis)charge if output */
+               if (potgo_value & pdat)
+                   pot_dat_act[joy][i] = 0; // instant stop if output+high
+               if (isbutton)
+                   pot_dat[joy][i]++; // "free running" if output+low
+           }
+
+           if (isbutton)
+               charge = -2; // button press overrides everything
+
+           if (currprefs.cs_cdtvcd) {
+               /* CDTV P9 is not floating */
+               if (!(potgo_value & pdir) && i == 1 && charge == 0)
+                   charge = 2;
+           }
+           /* official Commodore mouse has pull-up resistors in button lines
+            * NOTE: 3rd party mice may not have pullups! */
+           if (mouse_port[joy] && charge == 0)
+               charge = 2;
+           /* emulate pullup resistor if button mapped because there too many broken
+            * programs that read second button in input-mode (and most 2+ button pads have
+            * pullups)
+            */
+           if (digital_port[joy][i] && charge == 0)
+               charge = 2;
+
+           charge_cap (joy, i, charge);
+       }
+    }
+}
+
+
 uae_u8 handle_joystick_buttons (uae_u8 dra)
 {
     uae_u8 but = 0;
     int i;
 
+    cap_check ();
     for (i = 0; i < 2; i++) {
        if (cd32_pad_enabled[i]) {
            uae_u16 p5dir = 0x0200 << (i * 4);
@@ -1283,6 +1363,7 @@ void handle_cd32_joystick_cia (uae_u8 pra, uae_u8 dra)
     static int oldstate[2];
     int i;
 
+    cap_check ();
     for (i = 0; i < 2; i++) {
        uae_u8 but = 0x40 << i;
        uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */
@@ -1305,6 +1386,7 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor)
 {
     int i;
 
+    cap_check ();
     for (i = 0; i < 2; i++) {
        uae_u16 p9dir = 0x0800 << (i * 4); /* output enable P9 */
        uae_u16 p9dat = 0x0400 << (i * 4); /* data P9 */
@@ -1312,6 +1394,7 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor)
        uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */
 
        if (cd32_pad_enabled[i]) {
+
            /* p5 is floating in input-mode */
            potgor &= ~p5dat;
            potgor |= potgo_value & p5dat;
@@ -1325,6 +1408,7 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor)
                potgor &= ~p9dat; /* shift at zero == return zero */
            if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2))))
                potgor &= ~p9dat;
+
        } else {
 
            potgor &= ~p5dat;
@@ -1340,82 +1424,13 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor)
     return potgor;
 }
 
-static int inputdelay;
 
-static void charge_cap (int joy, int idx, int charge)
-{
-    if (charge < -1 || charge > 1)
-       charge = charge * 80;
-    pot_cap[joy][idx] += charge;
-    if (pot_cap[joy][idx] < 0)
-       pot_cap[joy][idx] = 0;
-    if (pot_cap[joy][idx] > 511)
-       pot_cap[joy][idx] = 511;
-}
+static int inputdelay;
 
 void inputdevice_hsync (void)
 {
-    int joy, i;
-
-    for (joy = 0; joy < 2; joy++) {
-       for (i = 0; i < 2; i++) {
-           int charge = 0;
-           uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */
-           uae_u16 pdat = 0x0100 << (joy * 4 + i * 2); /* data */
-           int isbutton = getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2);
 
-           if (analog_port[joy][i] && pot_cap[joy][i] < joydirpot[joy][i])
-               charge = 1; // slow charge via pot variable resistor
-           if ((digital_port[joy][i] || mouse_port[joy]))
-               charge = 1; // slow charge via pull-up resistor
-           if (!(potgo_value & pdir)) { // input?
-               if (pot_dat_act[joy][i])
-                   pot_dat[joy][i]++;
-               /* first 8 lines after potgo has been started = discharge cap */
-               if (pot_dat_act[joy][i] == 1) {
-                   if (pot_dat[joy][i] < (currprefs.ntscmode ? POTDAT_DELAY_NTSC : POTDAT_DELAY_PAL)) {
-                       charge = -2; /* fast discharge delay */
-                   } else {
-                       pot_dat_act[joy][i] = 2;
-                       pot_dat[joy][i] = 0;
-                   }
-               }
-               if (analog_port[joy][i] && pot_dat_act[joy][i] == 2 && pot_cap[joy][i] >= joydirpot[joy][i])
-                   pot_dat_act[joy][i] = 0;
-               if ((digital_port[joy][i] || mouse_port[joy]) && pot_dat_act[joy][i] == 2) {
-                   if (pot_cap[joy][i] >= 10 && !isbutton)
-                       pot_dat_act[joy][i] = 0;
-               }
-           } else { // output?
-               charge = (potgo_value & pdat) ? 2 : -2; /* fast (dis)charge if output */
-               if (potgo_value & pdat)
-                   pot_dat_act[joy][i] = 0; // instant stop if output+high
-               if (isbutton)
-                   pot_dat[joy][i]++; // "free running" if output+low
-           }
-
-           if (isbutton)
-               charge = -2; // button press overrides everything
-
-           if (currprefs.cs_cdtvcd) {
-               /* CDTV P9 is not floating */
-               if (!(potgo_value & pdir) && i == 1 && charge == 0)
-                   charge = 2;
-           }
-           /* official Commodore mouse has pull-up resistors in button lines
-            * NOTE: 3rd party mice may not have pullups! */
-           if (mouse_port[joy] && charge == 0)
-               charge = 2;
-           /* emulate pullup resistor if button mapped because there too many broken
-            * programs that read second button in input-mode (and most 2+ button pads have
-            * pullups)
-            */
-           if (digital_port[joy][i] && charge == 0)
-               charge = 2;
-
-           charge_cap (joy, i, charge);
-       }
-    }
+    cap_check ();
 
 #ifdef CATWEASEL
     catweasel_hsync ();
@@ -2320,7 +2335,7 @@ static int isdigitalbutton (int ei)
     return 0;
 }
 
-static void scanevents(struct uae_prefs *p)
+static void scanevents (struct uae_prefs *p)
 {
     int i, j, k, ei;
     const struct inputevent *e;
index 3a8d5d5e7a917630e8e5a8d7fb650d4148cda28c..e114ff45d2a5063b882e2cedd2f331ac9eed2c65 100755 (executable)
@@ -319,7 +319,7 @@ int D3D_canshaders (void)
     if (yesno > 0)
        return 1;
     yesno = -1;
-    h = LoadLibrary ("d3dx9_39.dll");
+    h = LoadLibrary ("d3dx9_40.dll");
     if (h != NULL) {
        FreeLibrary (h);
        d3dx = Direct3DCreate9 (D3D_SDK_VERSION);
index 93e3d83cf5bebbfb24aceaaae1b32b62e5452aa3..42ba812c29674046b78f1b3aa33282099715a4fe 100755 (executable)
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEPUBLICBETA 0
+#define WINUAEPUBLICBETA 1
 
-#define WINUAEBETA ""
-#define WINUAEDATE MAKEBD(2008, 11, 9)
+#define WINUAEBETA "1"
+#define WINUAEDATE MAKEBD(2008, 11, 16)
 #define WINUAEEXTRA ""
 #define WINUAEREV ""
 
index 1012fa117a4c06d44554fe15a3a736f7e963b3ef..c61d9f545de861e0fa98adea354a50dccc21b1b3 100755 (executable)
@@ -4696,9 +4696,9 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
     int gfx_height = workprefs.gfx_size_win.height;
     LRESULT posn;
 
-    display_fromselect(SendDlgItemMessage (hDlg, IDC_SCREENMODE_NATIVE, CB_GETCURSEL, 0, 0),
+    display_fromselect (SendDlgItemMessage (hDlg, IDC_SCREENMODE_NATIVE, CB_GETCURSEL, 0, 0),
        &workprefs.gfx_afullscreen, &workprefs.gfx_avsync, 0);
-    display_fromselect(SendDlgItemMessage (hDlg, IDC_SCREENMODE_RTG, CB_GETCURSEL, 0, 0),
+    display_fromselect (SendDlgItemMessage (hDlg, IDC_SCREENMODE_RTG, CB_GETCURSEL, 0, 0),
        &workprefs.gfx_pfullscreen, &workprefs.gfx_pvsync, 1);
 
     workprefs.gfx_lores_mode     = IsDlgButtonChecked (hDlg, IDC_LORES_SMOOTHED);
index bad3c1dfc8d1dbdbc490e6e604a33dca8f6c46c8..3b22d9e039009cca1d6c7f86fa080107e28df5b2 100755 (executable)
@@ -92,7 +92,7 @@
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
                                GenerateManifest="false"
-                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_39.dll;openal32.dll"
+                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_40.dll;openal32.dll"
                                GenerateDebugInformation="true"
                                ProgramDatabaseFile=".\Debug/winuae.pdb"
                                SubSystem="2"
                                AdditionalLibraryDirectories=""
                                GenerateManifest="true"
                                AdditionalManifestDependencies=""
-                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_39.dll;openal32.dll"
+                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_40.dll;openal32.dll"
                                GenerateDebugInformation="true"
                                ProgramDatabaseFile=".\Release/winuae.pdb"
                                SubSystem="2"
                                AdditionalLibraryDirectories=""
                                GenerateManifest="true"
                                AdditionalManifestDependencies=""
-                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_39.dll;openal32.dll"
+                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_40.dll;openal32.dll"
                                GenerateDebugInformation="true"
                                ProgramDatabaseFile=".\FullRelease/winuae.pdb"
                                SubSystem="2"
index 836bb6ecdae0f2bc4ae6bbd14e4534ca08d5a3b2..8c62c182a68075d81e6f0373de06406b0a8b66f0 100755 (executable)
@@ -1,4 +1,19 @@
 
+Beta 1:
+
+- DXSDK updated, D3D filters again require updated DX runtime
+- some CD32 pad reading routines returned phantom buttons in JIT
+  modes if pad was not "connected"
+- another partial sprite rendering update, fixes sprite size problems
+  in screen modes that have multiple resolutions in single horizontal
+  line (for example Innovation Part 2 by Axis is 100% correct now)
+- also fixes wrong sized sprites in some lores resolution modes
+- superhires in lores mode supported (show only every 4th pixel)
+- superhires in filtered lores supported (visible pixel is average
+  color of 4 internal shres pixels. This may be slow..)
+- ECS SHRES in lores supported (both non-filtered and filtered)
+- 10 sectors per track PC floppy images (800k) supported
+
 1.5.3
 
 Beta 8: