]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
3200b4
authorToni Wilen <twilen@winuae.net>
Wed, 22 Jul 2015 17:53:19 +0000 (20:53 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 22 Jul 2015 17:53:19 +0000 (20:53 +0300)
24 files changed:
catweasel.cpp
cfgfile.cpp
custom.cpp
devices.cpp
drawing.cpp
filesys.cpp
gencpu.cpp
hardfile.cpp
include/a2091.h
include/drawing.h
include/options.h
main.cpp
newcpu.cpp
od-win32/resources/resource.h
od-win32/resources/winuae.exe.manifest
od-win32/resources/winuae.rc
od-win32/win32.h
od-win32/win32gfx.cpp
od-win32/win32gui.cpp
od-win32/win32gui.h
od-win32/win32gui_extra.cpp
od-win32/winuae_msvc14/winuae_msvc.vcxproj
od-win32/winuae_msvc14/winuae_msvc.vcxproj.filters
od-win32/winuaechangelog.txt

index cdfc6f74f1909a103f5249c32b4f9a5db8b60794..6a2854df273860b82da0cdab1e154d3637e48921 100644 (file)
@@ -542,14 +542,15 @@ int catweasel_init(void)
        } else {
 
                for (i = 0; i < 4; i++) {
+                       int j = i;
                        if (currprefs.catweasel > 0)
-                               i = currprefs.catweasel;
+                               j = currprefs.catweasel + i;
                        if (currprefs.catweasel < 0)
-                               i = -currprefs.catweasel + 1;
-                       _stprintf (name, _T("\\\\.\\CAT%d_F0"), i);
+                               j = -currprefs.catweasel + 1 + i;
+                       _stprintf (name, _T("\\\\.\\CAT%d_F0"), j);
                        handle = CreateFile (name, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0,
                                OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
-                       if (handle != INVALID_HANDLE_VALUE || currprefs.catweasel > 0)
+                       if (handle != INVALID_HANDLE_VALUE || currprefs.catweasel)
                                break;
                }
                if (handle == INVALID_HANDLE_VALUE)
index 8a68853443a4b14c6f604c2a5f96e7984b1ff6b6..6d584f870d7cd4856395fa8b40418819dd8d463f 100644 (file)
@@ -304,6 +304,44 @@ static const TCHAR *obsolete[] = {
 
 #define UNEXPANDED _T("$(FILE_PATH)")
 
+static TCHAR *cfgfile_option_find_it(const TCHAR *s, const TCHAR *option, bool checkequals)
+{
+       TCHAR buf[MAX_DPATH];
+       if (!s)
+               return NULL;
+       _tcscpy(buf, s);
+       _tcscat(buf, _T(","));
+       TCHAR *p = buf;
+       for (;;) {
+               TCHAR *tmpp = _tcschr(p, ',');
+               TCHAR *tmpp2 = NULL;
+               if (tmpp == NULL)
+                       return NULL;
+               *tmpp++ = 0;
+               if (checkequals) {
+                       tmpp2 = _tcschr(p, '=');
+                       if (!tmpp2)
+                               return NULL;
+                       *tmpp2++ = 0;
+               }
+               if (!strcasecmp(p, option)) {
+                       if (checkequals)
+                               return tmpp2;
+                       return p;
+               }
+               p = tmpp;
+       }
+}
+
+static bool cfgfile_option_find(const TCHAR *s, const TCHAR *option)
+{
+       return cfgfile_option_find_it(s, option, false) != NULL;
+}
+
+static TCHAR *cfgfile_option_get(const TCHAR *s, const TCHAR *option)
+{
+       return cfgfile_option_find_it(s, option, true);
+}
 
 static void trimwsa (char *s)
 {
@@ -894,7 +932,7 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f)
                                        extras = _T("SASI");
                                } else if (ci->unit_feature_level == HD_LEVEL_SASI_ENHANCED) {
                                        extras = _T("SASIE");
-                               } else if (ci->unit_feature_level == HD_LEVEL_OMTI) {
+                               } else if (ci->unit_feature_level == HD_LEVEL_SASI_CHS) {
                                        extras = _T("SASI_CHS");
                                }
                        } else if (ct >= HD_CONTROLLER_TYPE_IDE_FIRST && ct <= HD_CONTROLLER_TYPE_IDE_LAST) {
@@ -998,6 +1036,104 @@ static void write_resolution (struct zfile *f, const TCHAR *ws, const TCHAR *hs,
        }
 }
 
+static int cfgfile_read_rom_settings(const struct expansionboardsettings *ebs, const TCHAR *buf)
+{
+       int settings = 0;
+       int bitcnt = 0;
+       for (int i = 0; ebs[i].name; i++) {
+               const struct expansionboardsettings *eb = &ebs[i];
+               bitcnt += eb->bitshift;
+               if (eb->multiselect) {
+                       int itemcnt = -1;
+                       int itemfound = 0;
+                       const TCHAR *p = eb->configname;
+                       while (p[0]) {
+                               if (itemcnt >= 0) {
+                                       if (cfgfile_option_find(buf, p)) {
+                                               itemfound = itemcnt;
+                                       }
+                               }
+                               itemcnt++;
+                               p += _tcslen(p) + 1;
+                       }
+                       int cnt = 1;
+                       int bits = 1;
+                       for (int i = 7; i >= 0; i--) {
+                               if (itemcnt & (1 << i)) {
+                                       cnt = 1 << i;
+                                       bits = i;
+                                       break;
+                               }
+                       }
+                       int multimask = cnt - 1;
+                       if (eb->invert)
+                               itemfound ^= 0x7fffffff;
+                       itemfound &= multimask;
+                       settings |= itemfound << bitcnt;
+                       bitcnt += bits;
+               } else {
+                       int mask = 1 << bitcnt;
+                       if (cfgfile_option_find(buf, eb->configname)) {
+                               settings |= mask;
+                       }
+                       if (eb->invert)
+                               settings ^= mask;
+                       bitcnt++;
+               }
+       }
+       return settings;
+}
+
+static void cfgfile_write_rom_settings(const struct expansionboardsettings *ebs, TCHAR *buf, int settings)
+{
+       int bitcnt = 0;
+       for (int j = 0; ebs[j].name; j++) {
+               const struct expansionboardsettings *eb = &ebs[j];
+               bitcnt += eb->bitshift;
+               if (eb->multiselect) {
+                       int itemcnt = -1;
+                       const TCHAR *p = eb->configname;
+                       while (p[0]) {
+                               itemcnt++;
+                               p += _tcslen(p) + 1;
+                       }
+                       int cnt = 1;
+                       int bits = 1;
+                       for (int i = 7; i >= 0; i--) {
+                               if (itemcnt & (1 << i)) {
+                                       cnt = 1 << i;
+                                       bits = i;
+                                       break;
+                               }
+                       }
+                       int multimask = cnt - 1;
+                       int multivalue = settings;
+                       if (eb->invert)
+                               multivalue ^= 0x7fffffff;
+                       multivalue = (multivalue >> bitcnt) & multimask;
+                       p = eb->configname;
+                       while (multivalue >= 0) {
+                               multivalue--;
+                               p += _tcslen(p) + 1;
+                       }
+                       if (buf[0])
+                               _tcscat(buf, _T(","));
+                       _tcscat(buf, p);
+                       bitcnt += bits;
+               } else {
+                       int value = settings;
+                       if (eb->invert)
+                               value ^= 0x7fffffff;
+                       if (value & (1 << bitcnt)) {
+                               if (buf[0])
+                                       _tcscat(buf, _T(","));
+                               _tcscat(buf, eb->configname);
+                       }
+                       bitcnt++;
+               }
+       }
+}
+
 static void cfgfile_write_board_rom(struct zfile *f, struct multipath *mp, struct boardromconfig *br)
 {
        TCHAR buf[256];
@@ -1048,13 +1184,7 @@ static void cfgfile_write_board_rom(struct zfile *f, struct multipath *mp, struc
                                        _tcscat(buf2, tmp);
                                }
                                if (br->roms[i].device_settings && ert->settings) {
-                                       for (int j = 0; ert->settings[j].name; j++) {
-                                               if (br->roms[i].device_settings & (1 << j)) {
-                                                       if (buf2[0])
-                                                               _tcscat(buf2, _T(","));
-                                                       _tcscat(buf2, ert->settings[j].configname);
-                                               }
-                                       }
+                                       cfgfile_write_rom_settings(ert->settings, buf2, br->roms[i].device_settings);
                                }
                                if (buf2[0])
                                        cfgfile_dwrite_str (f, buf, buf2);
@@ -1652,13 +1782,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
                cfgfile_dwrite_str(f, _T("cpuboard_type"), cbst->configname);
                if (cbs && p->cpuboard_settings) {
                        tmp[0] = 0;
-                       for (int i = 0; cbs[i].name; i++) {
-                               if (p->cpuboard_settings & (1 << i)) {
-                                       if (tmp[0])
-                                               _tcscat(tmp, _T(","));
-                                       _tcscat(tmp, cbs[i].configname);
-                               }
-                       }
+                       cfgfile_write_rom_settings(cbs, tmp, p->cpuboard_settings);
                        cfgfile_dwrite_str(f, _T("cpuboard_settings"), tmp);
                }
        } else {
@@ -2117,45 +2241,6 @@ static int getintval2 (TCHAR **p, int *result, int delim, bool last)
        return 1;
 }
 
-static TCHAR *cfgfile_option_find_it(TCHAR *s, const TCHAR *option, bool checkequals)
-{
-       TCHAR buf[MAX_DPATH];
-       if (!s)
-               return NULL;
-       _tcscpy(buf, s);
-       _tcscat(buf, _T(","));
-       TCHAR *p = buf;
-       for (;;) {
-               TCHAR *tmpp = _tcschr (p, ',');
-               TCHAR *tmpp2 = NULL;
-               if (tmpp == NULL)
-                       return NULL;
-               *tmpp++ = 0;
-               if (checkequals) {
-                       tmpp2 = _tcschr(p, '=');
-                       if (!tmpp2)
-                               return NULL;
-                       *tmpp2++ = 0;
-               }
-               if (!strcasecmp(p, option)) {
-                       if (checkequals)
-                               return tmpp2;
-                       return p;
-               }
-               p = tmpp;
-       }
-}
-
-static bool cfgfile_option_find(TCHAR *s, const TCHAR *option)
-{
-       return cfgfile_option_find_it(s, option, false) != NULL;
-}
-
-static TCHAR *cfgfile_option_get(TCHAR *s, const TCHAR *option)
-{
-       return cfgfile_option_find_it(s, option, true);
-}
-
 static int cfgfile_option_select(TCHAR *s, const TCHAR *option, const TCHAR *select)
 {
        TCHAR buf[MAX_DPATH];
@@ -3330,7 +3415,7 @@ struct uaedev_config_data *add_filesys_config (struct uae_prefs *p, int index, s
                                                cunit++;
                                                if (ctrl >= HD_CONTROLLER_TYPE_IDE_FIRST && ctrl <= HD_CONTROLLER_TYPE_IDE_LAST && cunit == 4)
                                                        return NULL;
-                                               if (ctrl >= HD_CONTROLLER_TYPE_SCSI_FIRST && ctrl <= HD_CONTROLLER_TYPE_SCSI_LAST && cunit == 7)
+                                               if (ctrl >= HD_CONTROLLER_TYPE_SCSI_FIRST && ctrl <= HD_CONTROLLER_TYPE_SCSI_LAST && cunit >= 7)
                                                        return NULL;
                                        }
                                }
@@ -3410,12 +3495,12 @@ static void get_filesys_controller (const TCHAR *hdc, int *type, int *typenum, i
        if(_tcslen (hdc) >= 4 && !_tcsncmp (hdc, _T("ide"), 3)) {
                hdcv = HD_CONTROLLER_TYPE_IDE_AUTO;
                hdunit = hdc[3] - '0';
-               if (hdunit < 0 || hdunit > 3)
+               if (hdunit < 0 || hdunit >= 4)
                        hdunit = 0;
        } else if(_tcslen (hdc) >= 5 && !_tcsncmp (hdc, _T("scsi"), 4)) {
                hdcv = HD_CONTROLLER_TYPE_SCSI_AUTO;
                hdunit = hdc[4] - '0';
-               if (hdunit < 0 || hdunit > 7)
+               if (hdunit < 0 || hdunit >= 8 + 2)
                        hdunit = 0;
        }
        if (hdcv > HD_CONTROLLER_TYPE_UAE) {
@@ -3460,8 +3545,10 @@ static void get_filesys_controller (const TCHAR *hdc, int *type, int *typenum, i
                }
        } else if (_tcslen (hdc) >= 6 && !_tcsncmp (hdc, _T("scsram"), 6)) {
                hdcv = HD_CONTROLLER_TYPE_PCMCIA_SRAM;
+               hdunit = 0;
        } else if (_tcslen (hdc) >= 5 && !_tcsncmp (hdc, _T("scide"), 6)) {
                hdcv = HD_CONTROLLER_TYPE_PCMCIA_IDE;
+               hdunit = 0;
        }
        if (idx >= MAX_DUPLICATE_EXPANSION_BOARDS)
                idx = MAX_DUPLICATE_EXPANSION_BOARDS - 1;
@@ -3751,7 +3838,7 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, int type, TCHA
                                else if (cfgfile_option_find(tmpp2, _T("SASI")))
                                        uci.unit_feature_level = HD_LEVEL_SASI;
                                else if (cfgfile_option_find(tmpp2, _T("SASI_CHS")))
-                                       uci.unit_feature_level = HD_LEVEL_OMTI;
+                                       uci.unit_feature_level = HD_LEVEL_SASI_CHS;
                                else if (cfgfile_option_find(tmpp2, _T("ATA2+S")))
                                        uci.unit_feature_level = HD_LEVEL_ATA_2S;
                                else if (cfgfile_option_find(tmpp2, _T("ATA2+")))
@@ -4037,11 +4124,7 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con
                                                brc->roms[idx].autoboot_disabled = true;
                                        }
                                        if (ert->settings) {
-                                               for (int k = 0; ert->settings[k].name; k++) {
-                                                       if (cfgfile_option_find(buf2, ert->settings[k].configname)) {
-                                                               brc->roms[idx].device_settings |= 1 << k;
-                                                       }
-                                               }
+                                               brc->roms[idx].device_settings = cfgfile_read_rom_settings(ert->settings, buf2);
                                        }
                                        if (ert->id_jumper) {
                                                TCHAR *p = cfgfile_option_get(buf2, _T("id"));
@@ -4310,7 +4393,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
                        const struct expansionboardsettings *cbs = cbst->settings;
                        for(i = 0; cbs[i].name; i++) {
                                if (cfgfile_option_find(tmpbuf, cbs[i].configname)) {
-                                       p->cpuboard_settings |= 1 << i;
+                                       p->cpuboard_settings |= 1 << (i + cbs[i].bitshift);
                                        break;
                                }
                        }
index 8d0e12c49ae438f4c7b06ab64dbe7387156e4444..2281a37b1ddd78858c05c13ff9c5a3e789bddcb5 100644 (file)
@@ -1102,10 +1102,6 @@ static void compute_toscr_delay (int bplcon1)
        toscr_delay[1] = (delay2 & delaymask) << toscr_res;
        toscr_delay[1] |= shdelay2 >> (RES_MAX - toscr_res);
 
-       // AGA subpixel scrolling in lores/hires modes
-       toscr_delay_sh[0] = (shdelay1 & 3) >> toscr_res;
-       toscr_delay_sh[1] = (shdelay2 & 3) >> toscr_res;
-
 #if SPEEDUP
        /* SPEEDUP code still needs this hack */
        int     delayoffset = fetchmode_size - (((bpl_hstart - (HARD_DDF_START_REAL + DDF_OFFSET)) & fetchstart_mask) << 1);
@@ -3389,11 +3385,12 @@ static void decide_sprites (int hpos, bool usepointx)
 
        count = 0;
        for (i = 0; i < MAX_SPRITES; i++) {
-               int sprxp = (fmode & 0x8000) ? (spr[i].xpos & ~sscanmask) : spr[i].xpos;
+               int xpos = spr[i].xpos;
+               int sprxp = (fmode & 0x8000) ? (xpos & ~sscanmask) : xpos;
                int hw_xp = sprxp >> sprite_buffer_res;
                int pointx = usepointx && (sprctl[i] & sprite_sprctlmask) ? 0 : 1;
 
-               if (spr[i].xpos < 0)
+               if (xpos < 0)
                        continue;
 
                if (!((debug_sprite_mask & magic_sprite_mask) & (1 << i)))
@@ -3402,9 +3399,6 @@ static void decide_sprites (int hpos, bool usepointx)
                if (! spr[i].armed)
                        continue;
 
-//             if (sprxp > ((maxhpos * 2) << sprite_buffer_res))
-//                     write_log(_T("*"));
-
                if (hw_xp > last_sprite_point && hw_xp <= point + pointx) {
                        add_sprite (&count, i, sprxp, posns, nrs);
                }
@@ -3416,6 +3410,14 @@ static void decide_sprites (int hpos, bool usepointx)
                        if (hw_xp > last_sprite_point && hw_xp <= point + pointx) {
                                add_sprite (&count, MAX_SPRITES + i, sprxp, posns, nrs);
                        }
+               } else if (!(fmode & 0x80) && xpos >= 2 && xpos <= 9) {
+                       // right border wrap around
+                       sprxp += (maxhpos * 2) << sprite_buffer_res;
+                       hw_xp = sprxp >> sprite_buffer_res;
+                       if (hw_xp > last_sprite_point && hw_xp <= point + pointx) {
+                               add_sprite(&count, MAX_SPRITES + i, sprxp, posns, nrs);
+                       }
+                       // (not really mutually exclusive of SSCAN2-bit but not worth the trouble)
                }
        }
 
@@ -5229,6 +5231,17 @@ static void BPLCON0 (int hpos, uae_u16 v)
                BPLCON0_Denise (hpos, v, true);
 }
 
+static void hack_bplcon2(void)
+{
+       // AGA subpixel scrolling in lores/hires modes
+       int shdelay1 = (bplcon1 >> 8) & 3;
+       int shdelay2 = (bplcon1 >> 12) & 3;
+       toscr_delay_sh[0] = (shdelay1 & 3) >> toscr_res;
+       toscr_delay_sh[1] = (shdelay2 & 3) >> toscr_res;
+       bplcon2 &= ~0xc000;
+       bplcon2 |= toscr_delay_sh[0] << 14;
+}
+
 static void BPLCON1 (int hpos, uae_u16 v)
 {
        if (!(currprefs.chipset_mask & CSMASK_AGA))
@@ -5240,17 +5253,29 @@ static void BPLCON1 (int hpos, uae_u16 v)
        decide_fetch_safe (hpos);
        bplcon1_written = true;
        bplcon1 = v;
+
+       if (currprefs.chipset_mask & CSMASK_AGA) {
+               int o0 = toscr_delay_sh[0];
+               int o1 = toscr_delay_sh[1];
+               hack_bplcon2();
+               if (toscr_delay_sh[0] != o0 || toscr_delay_sh[1] != o1) {
+                       // HACK: Use BPLCON2 unused bits to store sh shift
+                       record_register_change(hpos, 0x104, bplcon2);
+               }
+       }
 }
 
 static void BPLCON2(int hpos, uae_u16 v)
 {
        if (!(currprefs.chipset_mask & CSMASK_AGA))
                v &= 0x7f;
-       if (bplcon2 == v)
+       if ((bplcon2 & 0x3fff) == (v & 0x3fff))
                return;
        decide_line (hpos);
        bplcon2 = v;
-       record_register_change (hpos, 0x104, v);
+       if (currprefs.chipset_mask & CSMASK_AGA)
+               hack_bplcon2();
+       record_register_change (hpos, 0x104, bplcon2);
 }
 
 #ifdef ECS_DENISE
@@ -5664,10 +5689,6 @@ static void SPRxCTLPOS(int num)
 
        sprstartstop (s);
        sprxp = (sprpos[num] & 0xFF) * 2 + (sprctl[num] & 1);
-       if (!(fmode & 0x80) && sprxp >= 2 && sprxp <= 9) {
-               // right border wrap around
-               sprxp += maxhpos * 2;
-       }
        sprxp <<= sprite_buffer_res;
        /* Quite a bit salad in this register... */
        if (0) {
index e6025c5b21869736b7d49992814412162476b55f..25b29225b8635879148d710f84bc942c8b701e08 100644 (file)
@@ -56,6 +56,7 @@
 #include "driveclick.h"
 #include "pci.h"
 #include "pci_hw.h"
+#include "x86.h"
 #ifdef RETROPLATFORM
 #include "rp.h"
 #endif
@@ -88,6 +89,9 @@ void devices_reset(int hardreset)
 #ifdef WITH_PCI
        pci_reset();
 #endif
+#ifdef WITH_X86
+       x86_bridge_reset();
+#endif
 #ifdef JIT
        compemu_reset ();
 #endif
@@ -161,6 +165,9 @@ void devices_hsync(void)
 #ifdef WITH_PCI
        pci_hsync();
 #endif
+#ifdef WITH_X86
+       x86_bridge_hsync();
+#endif
 #ifdef WITH_TOCCATA
        sndboard_hsync();
 #endif
@@ -202,6 +209,9 @@ void devices_rethink(void)
 #ifdef WITH_PCI
        pci_rethink();
 #endif
+#ifdef WITH_X86
+       x86_bridge_rethink();
+#endif
 #ifdef WITH_TOCCATA
        sndboard_rethink();
 #endif
@@ -315,6 +325,9 @@ void do_leave_program (void)
 #ifdef WITH_PCI
        pci_free();
 #endif
+#ifdef WITH_X86
+       x86_bridge_free();
+#endif
 #ifdef FILESYS
        filesys_cleanup ();
 #endif
index 66270d889073431e5983f5dffeba69041c4b0286..73b100721faf1bccc71f912e17c8c1880f593a25 100644 (file)
@@ -53,18 +53,30 @@ happening, all ports should restrict window widths to be multiples of 16 pixels.
 #include "specialmonitors.h"
 
 extern int sprite_buffer_res;
-int lores_factor, lores_shift;
+static int lores_factor;
+int lores_shift;
+
+static void pfield_set_linetoscr(void);
 
 int debug_bpl_mask = 0xff, debug_bpl_mask_one;
 
+static void lores_set(int lores)
+{
+       int old = lores;
+       lores_shift = lores;
+       if (lores_shift != old)
+               pfield_set_linetoscr();
+}
+
 static void lores_reset (void)
 {
        lores_factor = currprefs.gfx_resolution ? 2 : 1;
-       lores_shift = currprefs.gfx_resolution;
+       lores_set(currprefs.gfx_resolution);
        if (doublescan > 0) {
                if (lores_shift < 2)
                        lores_shift++;
                lores_factor = 2;
+               lores_set(lores_shift);
        }
        sprite_buffer_res = currprefs.gfx_resolution;
        if (doublescan > 0 && sprite_buffer_res < RES_SUPERHIRES)
@@ -121,7 +133,8 @@ struct spritepixelsbuf {
        uae_u8 stdata;
        uae_u16 data;
 };
-static struct spritepixelsbuf spritepixels[MAX_PIXELS_PER_LINE];
+static struct spritepixelsbuf spritepixels_buffer[MAX_PIXELS_PER_LINE];
+static struct spritepixelsbuf *spritepixels;
 static int sprite_first_x, sprite_last_x;
 
 #ifdef AGA
@@ -225,7 +238,8 @@ bit fields in the hardware registers.  */
 static int bplehb, bplham, bpldualpf, bpldualpfpri, bpldualpf2of, bplplanecnt, ecsshres;
 static bool issprites;
 static int bplres;
-static int plf1pri, plf2pri, bplxor;
+static int plf1pri, plf2pri, bplxor, bpldelay_sh;
+static bool enabled_sh;
 static uae_u32 plf_sprite_mask;
 static int sbasecol[2] = { 16, 16 };
 static int hposblank;
@@ -805,6 +819,15 @@ STATIC_INLINE xcolnr getbgc (bool blank)
        return (blank || hposblank || colors_for_drawing.borderblank) ? 0 : colors_for_drawing.acolors[0];
 }
 
+
+static void set_res_shift(int shift)
+{
+       int old = res_shift;
+       res_shift = shift;
+       if (res_shift != old)
+               pfield_set_linetoscr();
+}
+
 /* Initialize the variables necessary for drawing a line.
 * This involves setting up start/stop positions and display window
 * borders.  */
@@ -838,7 +861,7 @@ static void pfield_init_linetoscr (bool border)
        if (linetoscr_diw_end < linetoscr_diw_start)
                linetoscr_diw_end = linetoscr_diw_start;
 
-       res_shift = lores_shift - bplres;
+       set_res_shift(lores_shift - bplres);
 
        playfield_start = linetoscr_diw_start;
        playfield_end = linetoscr_diw_end;
@@ -1278,7 +1301,7 @@ STATIC_INLINE uae_u32 shsprite (int dpix, uae_u32 spix_val, uae_u32 v, int spr)
        return xcolors[scol];
 }
 
-static int NOINLINE linetoscr_16_sh (int spix, int dpix, int stoppos, int spr)
+static int NOINLINE linetoscr_16_sh_func(int spix, int dpix, int stoppos, int spr)
 {
        uae_u16 *buf = (uae_u16 *) xlinebuffer;
 
@@ -1300,7 +1323,15 @@ static int NOINLINE linetoscr_16_sh (int spix, int dpix, int stoppos, int spr)
        }
        return spix;
 }
-static int NOINLINE linetoscr_32_sh (int spix, int dpix, int stoppos, int spr)
+static int linetoscr_16_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_16_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_sh_func(spix, dpix, stoppos, false);
+}
+static int NOINLINE linetoscr_32_sh_func(int spix, int dpix, int stoppos, int spr)
 {
        uae_u32 *buf = (uae_u32 *) xlinebuffer;
 
@@ -1322,7 +1353,15 @@ static int NOINLINE linetoscr_32_sh (int spix, int dpix, int stoppos, int spr)
        }
        return spix;
 }
-static int NOINLINE linetoscr_32_shrink1_sh (int spix, int dpix, int stoppos, int spr)
+static int linetoscr_32_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_32_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_sh_func(spix, dpix, stoppos, false);
+}
+static int NOINLINE linetoscr_32_shrink1_sh_func(int spix, int dpix, int stoppos, int spr)
 {
        uae_u32 *buf = (uae_u32 *) xlinebuffer;
 
@@ -1340,7 +1379,15 @@ static int NOINLINE linetoscr_32_shrink1_sh (int spix, int dpix, int stoppos, in
        }
        return spix;
 }
-static int NOINLINE linetoscr_32_shrink1f_sh (int spix, int dpix, int stoppos, int spr)
+static int linetoscr_32_shrink1_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_shrink1_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_32_shrink1_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_shrink1_sh_func(spix, dpix, stoppos, false);
+}
+static int NOINLINE linetoscr_32_shrink1f_sh_func(int spix, int dpix, int stoppos, int spr)
 {
        uae_u32 *buf = (uae_u32 *) xlinebuffer;
 
@@ -1362,7 +1409,15 @@ static int NOINLINE linetoscr_32_shrink1f_sh (int spix, int dpix, int stoppos, i
        }
        return spix;
 }
-static int NOINLINE linetoscr_16_shrink1_sh (int spix, int dpix, int stoppos, int spr)
+static int linetoscr_32_shrink1f_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_shrink1f_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_32_shrink1f_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_shrink1f_sh_func(spix, dpix, stoppos, false);
+}
+static int NOINLINE linetoscr_16_shrink1_sh_func(int spix, int dpix, int stoppos, int spr)
 {
        uae_u16 *buf = (uae_u16 *) xlinebuffer;
 
@@ -1380,7 +1435,15 @@ static int NOINLINE linetoscr_16_shrink1_sh (int spix, int dpix, int stoppos, in
        }
        return spix;
 }
-static int NOINLINE linetoscr_16_shrink1f_sh (int spix, int dpix, int stoppos, int spr)
+static int linetoscr_16_shrink1_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_shrink1_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_16_shrink1_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_shrink1_sh_func(spix, dpix, stoppos, false);
+}
+static int NOINLINE linetoscr_16_shrink1f_sh_func(int spix, int dpix, int stoppos, int spr)
 {
        uae_u16 *buf = (uae_u16 *) xlinebuffer;
 
@@ -1402,8 +1465,15 @@ static int NOINLINE linetoscr_16_shrink1f_sh (int spix, int dpix, int stoppos, i
        }
        return spix;
 }
-
-static int NOINLINE linetoscr_32_shrink2_sh (int spix, int dpix, int stoppos, int spr)
+static int linetoscr_16_shrink1f_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_shrink1f_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_16_shrink1f_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_shrink1f_sh_func(spix, dpix, stoppos, false);
+}
+static int NOINLINE linetoscr_32_shrink2_sh_func(int spix, int dpix, int stoppos, int spr)
 {
        uae_u32 *buf = (uae_u32 *) xlinebuffer;
 
@@ -1422,7 +1492,15 @@ static int NOINLINE linetoscr_32_shrink2_sh (int spix, int dpix, int stoppos, in
        }
        return spix;
 }
-static int NOINLINE linetoscr_32_shrink2f_sh (int spix, int dpix, int stoppos, int spr)
+static int linetoscr_32_shrink2_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_shrink2_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_32_shrink2_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_shrink2_sh_func(spix, dpix, stoppos, false);
+}
+static int NOINLINE linetoscr_32_shrink2f_sh_func(int spix, int dpix, int stoppos, int spr)
 {
        uae_u32 *buf = (uae_u32 *) xlinebuffer;
 
@@ -1455,7 +1533,15 @@ static int NOINLINE linetoscr_32_shrink2f_sh (int spix, int dpix, int stoppos, i
        }
        return spix;
 }
-static int NOINLINE linetoscr_16_shrink2_sh (int spix, int dpix, int stoppos, int spr)
+static int linetoscr_32_shrink2f_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_shrink2f_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_32_shrink2f_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_32_shrink2f_sh_func(spix, dpix, stoppos, false);
+}
+static int NOINLINE linetoscr_16_shrink2_sh_func(int spix, int dpix, int stoppos, int spr)
 {
        uae_u16 *buf = (uae_u16 *) xlinebuffer;
 
@@ -1474,7 +1560,15 @@ static int NOINLINE linetoscr_16_shrink2_sh (int spix, int dpix, int stoppos, in
        }
        return spix;
 }
-static int NOINLINE linetoscr_16_shrink2f_sh (int spix, int dpix, int stoppos, int spr)
+static int linetoscr_16_shrink2_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_shrink2_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_16_shrink2_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_shrink2_sh_func(spix, dpix, stoppos, false);
+}
+static int NOINLINE linetoscr_16_shrink2f_sh_func (int spix, int dpix, int stoppos, int spr)
 {
        uae_u16 *buf = (uae_u16 *) xlinebuffer;
 
@@ -1507,340 +1601,306 @@ static int NOINLINE linetoscr_16_shrink2f_sh (int spix, int dpix, int stoppos, i
        }
        return spix;
 }
+static int linetoscr_16_shrink2f_sh_spr(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_shrink2f_sh_func(spix, dpix, stoppos, true);
+}
+static int linetoscr_16_shrink2f_sh(int spix, int dpix, int stoppos)
+{
+       return linetoscr_16_shrink2f_sh_func(spix, dpix, stoppos, false);
+}
 #endif
 
-static void pfield_do_linetoscr (int start, int stop, bool blank)
+typedef int(*call_linetoscr)(int spix, int dpix, int dpix_end);
+
+static call_linetoscr pfield_do_linetoscr_normal;
+static call_linetoscr pfield_do_linetoscr_sprite;
+static call_linetoscr pfield_do_linetoscr_spriteonly;
+
+static void pfield_do_linetoscr(int start, int stop, bool blank)
+{
+       src_pixel = pfield_do_linetoscr_normal(src_pixel, start, stop);
+}
+static void pfield_do_linetoscr_spr(int start, int stop, bool blank)
+{
+       src_pixel = pfield_do_linetoscr_sprite(src_pixel, start, stop);
+}
+static int pfield_do_nothing(int a, int b, int c)
+{
+       return a;
+}
+
+/* AGA subpixel delay hack */
+static call_linetoscr pfield_do_linetoscr_shdelay_normal;
+static call_linetoscr pfield_do_linetoscr_shdelay_sprite;
+
+STATIC_INLINE int get_shdelay_add(void)
+{
+       if (bplres == RES_SUPERHIRES)
+               return 0;
+       int add = bpldelay_sh;
+       add >>= RES_MAX - currprefs.gfx_resolution;
+       return add;
+}
+static int pfield_do_linetoscr_normal_shdelay(int spix, int dpix, int dpix_end)
+{
+       int add = get_shdelay_add();
+       int add2 = add * gfxvidinfo.drawbuffer.pixbytes;
+       xlinebuffer += add2;
+       int out = pfield_do_linetoscr_shdelay_normal(spix, dpix, dpix_end);
+       xlinebuffer -= add2;
+       return out;
+}
+static int pfield_do_linetoscr_sprite_shdelay(int spix, int dpix, int dpix_end)
+{
+       int add = get_shdelay_add();
+       int add2 = add * gfxvidinfo.drawbuffer.pixbytes;
+       spritepixels -= add;
+       xlinebuffer += add2;
+       int out = pfield_do_linetoscr_shdelay_sprite(spix, dpix, dpix_end);
+       xlinebuffer -= add2;
+       spritepixels += add;
+       return out;
+}
+
+static void pfield_set_linetoscr (void)
 {
        xlinecheck(start, stop);
+       enabled_sh = false;
+       spritepixels = spritepixels_buffer;
+       pfield_do_linetoscr_spriteonly = pfield_do_nothing;
 #ifdef AGA
-       if (issprites && (currprefs.chipset_mask & CSMASK_AGA)) {
-               if (need_genlock_data) {
-                       if (res_shift == 0) {
-                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                       case 2: src_pixel = linetoscr_16_aga_spr_genlock(LTPARMS); break;
-                                       case 4: src_pixel = linetoscr_32_aga_spr_genlock(LTPARMS); break;
-                               }
-                       } else if (res_shift == 2) {
+       if (currprefs.chipset_mask & CSMASK_AGA) {
+               if (res_shift == 0) {
+                       switch (gfxvidinfo.drawbuffer.pixbytes) {
+                               case 2:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_aga_genlock : linetoscr_16_aga;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_aga_spr_genlock : linetoscr_16_aga_spr;
+                               pfield_do_linetoscr_spriteonly = linetoscr_16_aga_spronly;
+                               break;
+                               case 4:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_aga_genlock : linetoscr_32_aga;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_aga_spr_genlock : linetoscr_32_aga_spr;
+                               pfield_do_linetoscr_spriteonly = linetoscr_32_aga_spronly;
+                               break;
+                       }
+               } else if (res_shift == 2) {
+                       switch (gfxvidinfo.drawbuffer.pixbytes) {
+                               case 2:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_stretch2_aga_genlock : linetoscr_16_stretch2_aga;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_stretch2_aga_spr_genlock : linetoscr_16_stretch2_aga_spr_genlock;
+                               pfield_do_linetoscr_spriteonly = linetoscr_16_stretch2_aga_spronly;
+                               break;
+                               case 4:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_stretch2_aga_genlock : linetoscr_32_stretch2_aga;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_stretch2_aga_spr_genlock : linetoscr_32_stretch2_aga_spr;
+                               pfield_do_linetoscr_spriteonly = linetoscr_32_stretch2_aga_spronly;
+                               break;
+                       }
+               } else if (res_shift == 1) {
+                       switch (gfxvidinfo.drawbuffer.pixbytes) {
+                               case 2:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_stretch1_aga_genlock : linetoscr_16_stretch1_aga;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_stretch1_aga_spr_genlock : linetoscr_16_stretch1_aga_spr;
+                               pfield_do_linetoscr_spriteonly = linetoscr_16_stretch1_aga_spronly;
+                               break;
+                               case 4:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_stretch1_aga_genlock : linetoscr_32_stretch1_aga;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_stretch1_aga_spr_genlock : linetoscr_32_stretch1_aga_spr;
+                               pfield_do_linetoscr_spriteonly = linetoscr_32_stretch1_aga_spronly;
+                               break;
+                       }
+               } else if (res_shift == -1) {
+                       if (currprefs.gfx_lores_mode) {
                                switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                       case 2: src_pixel = linetoscr_16_stretch2_aga_spr_genlock(LTPARMS); break;
-                                       case 4: src_pixel = linetoscr_32_stretch2_aga_spr_genlock(LTPARMS); break;
+                                       case 2:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_shrink1f_aga_genlock : linetoscr_16_shrink1f_aga;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_shrink1f_aga_spr_genlock : linetoscr_16_shrink1f_aga_spr;
+                                       pfield_do_linetoscr_spriteonly = linetoscr_16_shrink1f_aga_spronly;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_shrink1f_aga_genlock : linetoscr_32_shrink1f_aga;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_shrink1f_aga_spr_genlock : linetoscr_32_shrink1f_aga_spr;
+                                       pfield_do_linetoscr_spriteonly = linetoscr_32_shrink1f_aga_spronly;
+                                       break;
                                }
-                       } else if (res_shift == 1) {
+                       } else {
                                switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                       case 2: src_pixel = linetoscr_16_stretch1_aga_spr_genlock(LTPARMS); break;
-                                       case 4: src_pixel = linetoscr_32_stretch1_aga_spr_genlock(LTPARMS); break;
-                               }
-                       } else if (res_shift == -1) {
-                               if (currprefs.gfx_lores_mode) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_shrink1f_aga_spr_genlock(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_shrink1f_aga_spr_genlock(LTPARMS); break;
-                                       }
-                               } else {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_shrink1_aga_spr_genlock(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_shrink1_aga_spr_genlock(LTPARMS); break;
-                                       }
-                               }
-                       } else if (res_shift == -2) {
-                               if (currprefs.gfx_lores_mode) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_shrink2f_aga_spr_genlock(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_shrink2f_aga_spr_genlock(LTPARMS); break;
-                                       }
-                               } else {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_shrink2_aga_spr_genlock(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_shrink2_aga_spr_genlock(LTPARMS); break;
-                                       }
+                                       case 2:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_shrink1_aga_genlock : linetoscr_16_shrink1_aga;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_shrink1_aga_spr_genlock : linetoscr_16_shrink1_aga_spr;
+                                       pfield_do_linetoscr_spriteonly = linetoscr_16_shrink1_aga_spronly;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_shrink1_aga_genlock : linetoscr_32_shrink1_aga;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_shrink1_aga_spr_genlock : linetoscr_32_shrink1_aga_spr;
+                                       pfield_do_linetoscr_spriteonly = linetoscr_32_shrink1_aga_spronly;
+                                       break;
                                }
                        }
-               } else {
-                       if (res_shift == 0) {
+               } else if (res_shift == -2) {
+                       if (currprefs.gfx_lores_mode) {
                                switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                       case 2: src_pixel = linetoscr_16_aga_spr(LTPARMS); break;
-                                       case 4: src_pixel = linetoscr_32_aga_spr(LTPARMS); break;
+                                       case 2:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_shrink2f_aga_genlock : linetoscr_16_shrink2f_aga;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_shrink2f_aga_spr_genlock : linetoscr_16_shrink2f_aga_spr;
+                                       pfield_do_linetoscr_spriteonly = linetoscr_16_shrink2f_aga_spronly;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_shrink2f_aga_genlock : linetoscr_32_shrink2f_aga;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_shrink2f_aga_spr_genlock : linetoscr_32_shrink2f_aga_spr;
+                                       pfield_do_linetoscr_spriteonly = linetoscr_32_shrink2f_aga_spronly;
+                                       break;
                                }
-                       } else if (res_shift == 2) {
+                       } else {
                                switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                       case 2: src_pixel = linetoscr_16_stretch2_aga_spr(LTPARMS); break;
-                                       case 4: src_pixel = linetoscr_32_stretch2_aga_spr(LTPARMS); break;
+                                       case 2:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_shrink2_aga_genlock : linetoscr_16_shrink2_aga;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_shrink2_aga_spr_genlock : linetoscr_16_shrink2_aga_spr;
+                                       pfield_do_linetoscr_spriteonly = linetoscr_16_shrink2_aga_spronly;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_shrink2_aga_genlock : linetoscr_32_shrink2_aga;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_shrink2_aga_spr_genlock : linetoscr_32_shrink2_aga_spr;
+                                       pfield_do_linetoscr_spriteonly = linetoscr_32_shrink2_aga_spronly;
+                                       break;
                                }
-                       } else if (res_shift == 1) {
+                       }
+               }
+               if (get_shdelay_add()) {
+                       pfield_do_linetoscr_shdelay_normal = pfield_do_linetoscr_normal;
+                       pfield_do_linetoscr_shdelay_sprite = pfield_do_linetoscr_sprite;
+                       pfield_do_linetoscr_normal = pfield_do_linetoscr_normal_shdelay;
+                       pfield_do_linetoscr_sprite = pfield_do_linetoscr_sprite_shdelay;
+                       enabled_sh = true;
+               }
+       }
+#endif
+#ifdef ECS_DENISE
+       if (!(currprefs.chipset_mask & CSMASK_AGA) && ecsshres) {
+               // TODO: genlock support
+               if (res_shift == 0) {
+                       switch (gfxvidinfo.drawbuffer.pixbytes) {
+                               case 2:
+                               pfield_do_linetoscr_normal = linetoscr_16_sh;
+                               pfield_do_linetoscr_sprite = linetoscr_16_sh_spr;
+                               break;
+                               case 4:
+                               pfield_do_linetoscr_normal = linetoscr_32_sh;
+                               pfield_do_linetoscr_sprite = linetoscr_32_sh_spr;
+                               break;
+                       }
+               } else if (res_shift == -1) {
+                       if (currprefs.gfx_lores_mode) {
                                switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                       case 2: src_pixel = linetoscr_16_stretch1_aga_spr(LTPARMS); break;
-                                       case 4: src_pixel = linetoscr_32_stretch1_aga_spr(LTPARMS); break;
-                               }
-                       } else if (res_shift == -1) {
-                               if (currprefs.gfx_lores_mode) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_shrink1f_aga_spr(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_shrink1f_aga_spr(LTPARMS); break;
-                                       }
-                               } else {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_shrink1_aga_spr(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_shrink1_aga_spr(LTPARMS); break;
-                                       }
+                                       case 2:
+                                       pfield_do_linetoscr_normal = linetoscr_16_shrink1f_sh;
+                                       pfield_do_linetoscr_sprite = linetoscr_16_shrink1f_sh_spr;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = linetoscr_32_shrink1f_sh;
+                                       pfield_do_linetoscr_sprite = linetoscr_32_shrink1f_sh_spr;
+                                       break;
                                }
-                       } else if (res_shift == -2) {
-                               if (currprefs.gfx_lores_mode) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_shrink2f_aga_spr(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_shrink2f_aga_spr(LTPARMS); break;
-                                       }
-                               } else {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_shrink2_aga_spr(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_shrink2_aga_spr(LTPARMS); break;
-                                       }
+                       } else {
+                               switch (gfxvidinfo.drawbuffer.pixbytes) {
+                                       case 2:
+                                       pfield_do_linetoscr_normal = linetoscr_16_shrink1_sh;
+                                       pfield_do_linetoscr_sprite = linetoscr_16_shrink1_sh_spr;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = linetoscr_32_shrink1_sh;
+                                       pfield_do_linetoscr_sprite = linetoscr_32_shrink1_sh_spr;
+                                       break;
                                }
                        }
-               }
-       } else {
-               if (currprefs.chipset_mask & CSMASK_AGA) {
-                       if (need_genlock_data) {
-                               if (res_shift == 0) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_aga_genlock(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_aga_genlock(LTPARMS); break;
-                                       }
-                               } else if (res_shift == 2) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_stretch2_aga_genlock(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_stretch2_aga_genlock(LTPARMS); break;
-                                       }
-                               } else if (res_shift == 1) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_stretch1_aga_genlock(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_stretch1_aga_genlock(LTPARMS); break;
-                                       }
-                               } else if (res_shift == -1) {
-                                       if (currprefs.gfx_lores_mode) {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink1f_aga_genlock(LTPARMS); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink1f_aga_genlock(LTPARMS); break;
-                                               }
-                                       } else {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink1_aga_genlock(LTPARMS); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink1_aga_genlock(LTPARMS); break;
-                                               }
-                                       }
-                               } else if (res_shift == -2) {
-                                       if (currprefs.gfx_lores_mode) {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink2f_aga_genlock(LTPARMS); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink2f_aga_genlock(LTPARMS); break;
-                                               }
-                                       } else {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink2_aga_genlock(LTPARMS); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink2_aga_genlock(LTPARMS); break;
-                                               }
-                                       }
+               } else if (res_shift == -2) {
+                       if (currprefs.gfx_lores_mode) {
+                               switch (gfxvidinfo.drawbuffer.pixbytes) {
+                                       case 2:
+                                       pfield_do_linetoscr_normal = linetoscr_16_shrink2f_sh;
+                                       pfield_do_linetoscr_sprite = linetoscr_16_shrink2f_sh_spr;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = linetoscr_32_shrink2f_sh;
+                                       pfield_do_linetoscr_sprite = linetoscr_32_shrink2f_sh_spr;
+                                       break;
                                }
                        } else {
-                               if (res_shift == 0) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_aga(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_aga(LTPARMS); break;
-                                       }
-                               } else if (res_shift == 2) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_stretch2_aga(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_stretch2_aga(LTPARMS); break;
-                                       }
-                               } else if (res_shift == 1) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_stretch1_aga(LTPARMS); break;
-                                               case 4: src_pixel = linetoscr_32_stretch1_aga(LTPARMS); break;
-                                       }
-                               } else if (res_shift == -1) {
-                                       if (currprefs.gfx_lores_mode) {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink1f_aga(LTPARMS); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink1f_aga(LTPARMS); break;
-                                               }
-                                       } else {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink1_aga(LTPARMS); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink1_aga(LTPARMS); break;
-                                               }
-                                       }
-                               } else if (res_shift == -2) {
-                                       if (currprefs.gfx_lores_mode) {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink2f_aga(LTPARMS); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink2f_aga(LTPARMS); break;
-                                               }
-                                       } else {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink2_aga(LTPARMS); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink2_aga(LTPARMS); break;
-                                               }
-                                       }
+                               switch (gfxvidinfo.drawbuffer.pixbytes) {
+                                       case 2:
+                                       pfield_do_linetoscr_normal = linetoscr_16_shrink2_sh;
+                                       pfield_do_linetoscr_sprite = linetoscr_16_shrink2_sh_spr;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = linetoscr_32_shrink2_sh;
+                                       pfield_do_linetoscr_sprite = linetoscr_32_shrink2_sh_spr;
+                                       break;
                                }
                        }
-               } else
+               }
+       }
 #endif
-#ifdef ECS_DENISE
-                       if (ecsshres) {
-                               if (res_shift == 0) {
-                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                               case 2: src_pixel = linetoscr_16_sh(LTPARMS, issprites); break;
-                                               case 4: src_pixel = linetoscr_32_sh(LTPARMS, issprites); break;
-                                       }
-                               } else if (res_shift == -1) {
-                                       if (currprefs.gfx_lores_mode) {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink1f_sh(LTPARMS, issprites); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink1f_sh(LTPARMS, issprites); break;
-                                               }
-                                       } else {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink1_sh(LTPARMS, issprites); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink1_sh(LTPARMS, issprites); break;
-                                               }
-                                       }
-                               } else if (res_shift == -2) {
-                                       if (currprefs.gfx_lores_mode) {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink2f_sh(LTPARMS, issprites); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink2f_sh(LTPARMS, issprites); break;
-                                               }
-                                       } else {
-                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                       case 2: src_pixel = linetoscr_16_shrink2_sh(LTPARMS, issprites); break;
-                                                       case 4: src_pixel = linetoscr_32_shrink2_sh(LTPARMS, issprites); break;
-                                               }
-                                       }
+       if (!(currprefs.chipset_mask & CSMASK_AGA) && !ecsshres) {
+               if (res_shift == 0) {
+                       switch (gfxvidinfo.drawbuffer.pixbytes) {
+                               case 2:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_genlock : linetoscr_16;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_spr_genlock : linetoscr_16_spr;
+                               break;
+                               case 4:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_genlock : linetoscr_32;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_spr_genlock : linetoscr_32_spr;
+                               break;
+                       }
+               } else if (res_shift == 2) {
+                       switch (gfxvidinfo.drawbuffer.pixbytes) {
+                               case 2:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_stretch2_genlock : linetoscr_16_stretch2;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_stretch2_spr_genlock : linetoscr_16_stretch2_spr;
+                               break;
+                               case 4:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_stretch2_genlock : linetoscr_32_stretch2;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_stretch2_spr_genlock : linetoscr_32_stretch2_spr;
+                               break;
+                       }
+               } else if (res_shift == 1) {
+                       switch (gfxvidinfo.drawbuffer.pixbytes) {
+                               case 2:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_stretch1_genlock : linetoscr_16_stretch1;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_stretch1_spr_genlock : linetoscr_16_stretch1_spr;
+                               break;
+                               case 4:
+                               pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_stretch1_genlock : linetoscr_32_stretch1;
+                               pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_stretch1_spr_genlock : linetoscr_32_stretch1_spr;
+                               break;
+                       }
+               } else if (res_shift == -1) {
+                               if (currprefs.gfx_lores_mode) {
+                               switch (gfxvidinfo.drawbuffer.pixbytes) {
+                                       case 2:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_shrink1f_genlock : linetoscr_16_shrink1f;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_shrink1f_spr_genlock : linetoscr_16_shrink1f_spr;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_shrink1f_genlock : linetoscr_32_shrink1f;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_shrink1f_spr_genlock : linetoscr_32_shrink1f_spr;
+                                       break;
                                }
                        } else {
-#endif
-                               if (issprites) {
-                                       if (need_genlock_data) {
-                                               if (res_shift == 0) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_spr_genlock(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_spr_genlock(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == 2) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_stretch2_spr_genlock(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_stretch2_spr_genlock(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == 1) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_stretch1_spr_genlock(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_stretch1_spr_genlock(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == -1) {
-                                                       if (currprefs.gfx_lores_mode) {
-                                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                                       case 2: src_pixel = linetoscr_16_shrink1f_spr_genlock(LTPARMS); break;
-                                                                       case 4: src_pixel = linetoscr_32_shrink1f_spr_genlock(LTPARMS); break;
-                                                               }
-                                                       } else {
-                                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                                       case 2: src_pixel = linetoscr_16_shrink1_spr_genlock(LTPARMS); break;
-                                                                       case 4: src_pixel = linetoscr_32_shrink1_spr_genlock(LTPARMS); break;
-                                                               }
-                                                       }
-                                               }
-                                       } else {
-                                               if (res_shift == 0) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_spr(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_spr(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == 2) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_stretch2_spr(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_stretch2_spr(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == 1) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_stretch1_spr(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_stretch1_spr(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == -1) {
-                                                       if (currprefs.gfx_lores_mode) {
-                                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                                       case 2: src_pixel = linetoscr_16_shrink1f_spr(LTPARMS); break;
-                                                                       case 4: src_pixel = linetoscr_32_shrink1f_spr(LTPARMS); break;
-                                                               }
-                                                       } else {
-                                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                                       case 2: src_pixel = linetoscr_16_shrink1_spr(LTPARMS); break;
-                                                                       case 4: src_pixel = linetoscr_32_shrink1_spr(LTPARMS); break;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               } else {
-                                       if (need_genlock_data) {
-                                               if (res_shift == 0) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_genlock(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_genlock(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == 2) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_stretch2_genlock(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_stretch2_genlock(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == 1) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_stretch1_genlock(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_stretch1_genlock(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == -1) {
-                                                       if (currprefs.gfx_lores_mode) {
-                                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                                       case 2: src_pixel = linetoscr_16_shrink1f_genlock(LTPARMS); break;
-                                                                       case 4: src_pixel = linetoscr_32_shrink1f_genlock(LTPARMS); break;
-                                                               }
-                                                       } else {
-                                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                                       case 2: src_pixel = linetoscr_16_shrink1_genlock(LTPARMS); break;
-                                                                       case 4: src_pixel = linetoscr_32_shrink1_genlock(LTPARMS); break;
-                                                               }
-                                                       }
-                                               }
-                                       } else {
-                                               if (res_shift == 0) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == 2) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_stretch2(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_stretch2(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == 1) {
-                                                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                               case 2: src_pixel = linetoscr_16_stretch1(LTPARMS); break;
-                                                               case 4: src_pixel = linetoscr_32_stretch1(LTPARMS); break;
-                                                       }
-                                               } else if (res_shift == -1) {
-                                                       if (currprefs.gfx_lores_mode) {
-                                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                                       case 2: src_pixel = linetoscr_16_shrink1f(LTPARMS); break;
-                                                                       case 4: src_pixel = linetoscr_32_shrink1f(LTPARMS); break;
-                                                               }
-                                                       } else {
-                                                               switch (gfxvidinfo.drawbuffer.pixbytes) {
-                                                                       case 2: src_pixel = linetoscr_16_shrink1(LTPARMS); break;
-                                                                       case 4: src_pixel = linetoscr_32_shrink1(LTPARMS); break;
-                                                               }
-                                                       }
-                                               }
-                                       }
+                               switch (gfxvidinfo.drawbuffer.pixbytes) {
+                                       case 2:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_shrink1_genlock : linetoscr_16_shrink1;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_shrink1_spr_genlock : linetoscr_16_shrink1_spr;
+                                       break;
+                                       case 4:
+                                       pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_32_shrink1_genlock : linetoscr_32_shrink1;
+                                       pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_32_shrink1_spr_genlock : linetoscr_32_shrink1_spr;
+                                       break;
                                }
                        }
                }
+       }
 }
 
 // left or right AGA border sprite
@@ -1850,47 +1910,7 @@ static void pfield_do_linetoscr_bordersprite_aga (int start, int stop, bool blan
                pfield_do_fill_line (start, stop, blank);
                return;
        }
-
-       if (res_shift == 0) {
-               switch (gfxvidinfo.drawbuffer.pixbytes) {
-               case 2: src_pixel = linetoscr_16_aga_spronly (LTPARMS); break;
-               case 4: src_pixel = linetoscr_32_aga_spronly (LTPARMS); break;
-               }
-       } else if (res_shift == 2) {
-               switch (gfxvidinfo.drawbuffer.pixbytes) {
-               case 2: src_pixel = linetoscr_16_stretch2_aga_spronly (LTPARMS); break;
-               case 4: src_pixel = linetoscr_32_stretch2_aga_spronly (LTPARMS); break;
-               }
-       } else if (res_shift == 1) {
-               switch (gfxvidinfo.drawbuffer.pixbytes) {
-               case 2: src_pixel = linetoscr_16_stretch1_aga_spronly (LTPARMS); break;
-               case 4: src_pixel = linetoscr_32_stretch1_aga_spronly (LTPARMS); break;
-               }
-       } else if (res_shift == -1) {
-               if (currprefs.gfx_lores_mode) {
-                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                       case 2: src_pixel = linetoscr_16_shrink1f_aga_spronly (LTPARMS); break;
-                       case 4: src_pixel = linetoscr_32_shrink1f_aga_spronly (LTPARMS); break;
-                       }
-               } else {
-                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                       case 2: src_pixel = linetoscr_16_shrink1_aga_spronly (LTPARMS); break;
-                       case 4: src_pixel = linetoscr_32_shrink1_aga_spronly (LTPARMS); break;
-                       }
-               }
-       } else if (res_shift == -2) {
-               if (currprefs.gfx_lores_mode) {
-                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                       case 2: src_pixel = linetoscr_16_shrink2f_aga_spronly (LTPARMS); break;
-                       case 4: src_pixel = linetoscr_32_shrink2f_aga_spronly (LTPARMS); break;
-                       }
-               } else {
-                       switch (gfxvidinfo.drawbuffer.pixbytes) {
-                       case 2: src_pixel = linetoscr_16_shrink2_aga_spronly (LTPARMS); break;
-                       case 4: src_pixel = linetoscr_32_shrink2_aga_spronly (LTPARMS); break;
-                       }
-               }
-       }
+       src_pixel = pfield_do_linetoscr_spriteonly(src_pixel, start, stop);
 }
 
 static void dummy_worker (int start, int stop, bool blank)
@@ -2475,6 +2495,8 @@ static void do_flush_screen (struct vidbuffer *vb, int start, int stop)
 * form. */
 static void pfield_expand_dp_bplcon (void)
 {
+       bool pfield_mode_changed = false;
+
        bplres = dp_for_drawing->bplres;
        bplplanecnt = dp_for_drawing->nr_planes;
        bplham = dp_for_drawing->ham_seen;
@@ -2483,7 +2505,9 @@ static void pfield_expand_dp_bplcon (void)
                bplehb = 0;
        issprites = dip_for_drawing->nr_sprites > 0;
 #ifdef ECS_DENISE
+       int oecsshres = ecsshres;
        ecsshres = bplres == RES_SUPERHIRES && (currprefs.chipset_mask & CSMASK_ECS_DENISE) && !(currprefs.chipset_mask & CSMASK_AGA);
+       pfield_mode_changed = oecsshres != ecsshres;
 #endif
 
        plf1pri = dp_for_drawing->bplcon2 & 7;
@@ -2498,6 +2522,10 @@ static void pfield_expand_dp_bplcon (void)
        sbasecol[0] = ((dp_for_drawing->bplcon4 >> 4) & 15) << 4;
        sbasecol[1] = ((dp_for_drawing->bplcon4 >> 0) & 15) << 4;
        bplxor = dp_for_drawing->bplcon4 >> 8;
+       int obpldelay_sh = bpldelay_sh;
+       bpldelay_sh = dp_for_drawing->bplcon2 >> 14;
+       if ((bpldelay_sh && !obpldelay_sh) || (!bpldelay_sh && obpldelay_sh))
+               pfield_mode_changed = true;
 #endif
        ecs_genlock_features_active = (currprefs.chipset_mask & CSMASK_ECS_DENISE) && ((dp_for_drawing->bplcon2 & 0x0c00) || colors_for_drawing.borderntrans) ? 1 : 0;
        if (ecs_genlock_features_active) {
@@ -2510,6 +2538,8 @@ static void pfield_expand_dp_bplcon (void)
                        ecs_genlock_features_colorkey = true;
                }
        }
+       if (pfield_mode_changed)
+               pfield_set_linetoscr();
 }
 
 static bool isham (uae_u16 bplcon0)
@@ -2561,7 +2591,7 @@ static void pfield_expand_dp_bplconx (int regno, int v)
 #endif
        }
        pfield_expand_dp_bplcon ();
-       res_shift = lores_shift - bplres;
+       set_res_shift(lores_shift - bplres);
 }
 
 static int drawing_color_matches;
@@ -2817,10 +2847,10 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in
 
 #ifdef AGA
                if (dip_for_drawing->nr_sprites && colors_for_drawing.bordersprite && !colors_for_drawing.borderblank && dp_for_drawing->bordersprite_seen)
-                       do_color_changes (pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr, lineno);
+                       do_color_changes (pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr_spr, lineno);
                else
 #endif
-                       do_color_changes (pfield_do_fill_line, pfield_do_linetoscr, lineno);
+                       do_color_changes (pfield_do_fill_line, dip_for_drawing->nr_sprites ? pfield_do_linetoscr_spr : pfield_do_linetoscr, lineno);
 
                if (dh == dh_emerg)
                        memcpy (row_map[gfx_ypos], xlinebuffer + linetoscr_x_adjust_pixbytes, gfxvidinfo.drawbuffer.pixbytes * gfxvidinfo.drawbuffer.inwidth);
@@ -3165,10 +3195,10 @@ static void init_drawing_frame (void)
 
        if (can_use_lores > AUTO_LORES_FRAMES && 0) {
                lores_factor = 1;
-               lores_shift = 0;
+               lores_set(0);
        } else {
                can_use_lores++;
-               lores_reset ();
+               lores_reset();
        }
 
        init_hardware_for_drawing_frame ();
@@ -3530,9 +3560,11 @@ static void finish_drawing_frame (void)
                                compute_framesync();
                        }
                        specialmonitoron = true;
+                       pfield_set_linetoscr();
                        do_flush_screen (vb, 0, vb->outheight);
                        didflush = true;
                } else {
+                       pfield_set_linetoscr();
                        need_genlock_data = false;
                        if (specialmonitoron || gfxvidinfo.drawbuffer.tempbufferinuse) {
                                gfxvidinfo.drawbuffer.tempbufferinuse = false;
@@ -3543,6 +3575,7 @@ static void finish_drawing_frame (void)
        }
 
        if (currprefs.genlock_image && !currprefs.monitoremu && gfxvidinfo.tempbuffer.bufmem_allocated && currprefs.genlock) {
+               pfield_set_linetoscr();
                setspecialmonitorpos(&gfxvidinfo.tempbuffer);
                if (init_genlock_data != specialmonitor_need_genlock()) {
                        need_genlock_data = init_genlock_data = specialmonitor_need_genlock();
@@ -3880,6 +3913,7 @@ void reset_drawing (void)
        memset (&spixstate, 0, sizeof spixstate);
 
        init_drawing_frame ();
+       pfield_set_linetoscr();
 
        notice_screen_contents_lost ();
        frame_res_cnt = currprefs.gfx_autoresolution_delay;
index facc69a546202ea333711fa82e914ffe8c01b882..34a1c05c7b53ac119b93298198101937b528aab6 100644 (file)
@@ -3649,8 +3649,7 @@ static void action_make_link (Unit *unit, dpacket packet)
                        }
                        return;
                }
-               // real Amiga softlinks would accept invalid paths too,
-               // we won't.
+               // real Amiga softlinks would accept invalid paths too, we won't.
                PUT_PCK_RES1 (packet, DOS_FALSE);
                PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND);
        }
@@ -3686,6 +3685,7 @@ static void action_read_link (Unit *unit, dpacket packet)
        if (!a->softlink)
                err = ERROR_OBJECT_WRONG_TYPE;
        if (err != 0) {
+               xfree(extrapath);
                PUT_PCK_RES1 (packet, DOS_FALSE);
                PUT_PCK_RES2 (packet, err);
                return;
@@ -3693,6 +3693,7 @@ static void action_read_link (Unit *unit, dpacket packet)
        _tcscpy (tmp, a->nname);
        write_log (_T("Resolving softlink '%s'\n"), tmp);
        if (!my_resolvesoftlink (tmp, sizeof tmp / sizeof (TCHAR))) {
+               xfree(extrapath);
                PUT_PCK_RES1 (packet, DOS_FALSE);
                //  not sure what to return
                PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND);
@@ -3719,6 +3720,7 @@ static void action_read_link (Unit *unit, dpacket packet)
                }
        }
        if (!matched_aino) {
+               xfree(extrapath);
                write_log (_T("Path not found in any mounted drive\n"));
                PUT_PCK_RES1 (packet, DOS_FALSE);
                PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND);
index d1d2d9091e974fdbb991f04c765f1a18157356a9..29da629620c123b2a2ce123f62b65c3bbabf2074 100644 (file)
@@ -3682,7 +3682,6 @@ static void gen_opcode (unsigned int opcode)
                sync_m68k_pc ();
                printf ("\tException (src + 32);\n");
                did_prefetch = 1;
-               branch_inst = 2;
                clear_m68k_offset();
                break;
        case i_MVR2USP:
index 93b42ad69f2f1ca153a72b5e963cf9c575ceebe2..43c93cbec0b4b71bf3914f6315a6ca97909844bf 100644 (file)
@@ -1153,7 +1153,7 @@ static const uae_u8 sasi_commands2[] =
 
 static uae_u64 get_scsi_6_offset(struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u8 *cmdbuf)
 {
-       bool omti = hfd->ci.unit_feature_level == HD_LEVEL_OMTI;
+       bool omti = hfd->ci.unit_feature_level == HD_LEVEL_SASI_CHS;
        uae_u64 offset;
        if (omti) {
                int cyl, cylsec, head, tracksec;
@@ -1189,7 +1189,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
        uae_u8 cmd = cmdbuf[0];
        bool sasi = hfd->ci.unit_feature_level >= HD_LEVEL_SASI && hfd->ci.unit_feature_level <= HD_LEVEL_SASI_ENHANCED;
        bool sasie = hfd->ci.unit_feature_level == HD_LEVEL_SASI_ENHANCED;
-       bool omti = hfd->ci.unit_feature_level == HD_LEVEL_OMTI;
+       bool omti = hfd->ci.unit_feature_level == HD_LEVEL_SASI_CHS;
 
        if (log_scsiemu) {
                write_log (_T("SCSIEMU HD %d: %02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X CMDLEN=%d DATA=%p\n"), hfd->unitnum,
@@ -1259,6 +1259,15 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
                        goto scsi_done;
                        case 0x0c: /* INITIALIZE DRIVE CHARACTERISTICS */
                        scsi_len = 8;
+                       write_log(_T("INITIALIZE DRIVE CHARACTERISTICS: "));
+                       write_log(_T("Heads: %d Cyls: %d Secs: %d\n"),
+                               (scsi_data[1] >> 4) | ((scsi_data[0] & 0xc0) << 4),
+                               ((scsi_data[1] & 15) << 8) | (scsi_data[2]),
+                               scsi_data[5]);
+                       for (int i = 0; i < 8; i++) {
+                               write_log(_T("%02X "), scsi_data[i]);
+                       }
+                       write_log(_T("\n"));
                        goto scsi_done;
                        case 0x12: /* INQUIRY */
                        {
index 17866854bb70d3c31eeda719a3b1fa32e26c60d8..084019742670167e0500c9a1c1ce60107b8a31af 100644 (file)
@@ -49,6 +49,8 @@ struct commodore_dmac
 
        uae_u8 c8727_pcss;
        uae_u8 c8727_ctl;
+       uae_u8 c8727_wrcbp;
+       uae_u16 c8727_st506_cb;
 };
 struct gvp_dmac
 {
@@ -85,8 +87,9 @@ struct wd_state {
        smp_comm_pipe requests;
        volatile int scsi_thread_running;
 
-       // unit 7 = XT
-       struct scsi_data *scsis[8];
+       // unit 8,9 = ST-506 (A2090)
+       // unit 8 = XT (A2091)
+       struct scsi_data *scsis[8 + 2];
 
        bool cdtv;
 
index ea7c0b7cc24cac8adb8bfc9737b076e0ab49b424..3b85af12d127d272fcbb9d0f07c0b35bd4f8f747 100644 (file)
@@ -43,7 +43,7 @@ before it appears on-screen. (TW: display emulation now does this automatically)
 #define min_diwlastword (0)
 #define max_diwlastword (PIXEL_XPOS(0x1d4 >> 1))
 
-extern int lores_factor, lores_shift, interlace_seen;
+extern int lores_shift, interlace_seen;
 extern bool aga_mode, direct_rgb;
 extern int visible_left_border, visible_right_border;
 
index 29404e2d5237def19414618a17cf69523c6942fd..5a2ed8cb4e7fa9cac6877801e523337f79f86248 100644 (file)
@@ -138,7 +138,7 @@ struct wh {
 #define HD_LEVEL_SCSI_2 1
 #define HD_LEVEL_SASI 2
 #define HD_LEVEL_SASI_ENHANCED 2
-#define HD_LEVEL_OMTI 3
+#define HD_LEVEL_SASI_CHS 3
 
 #define HD_LEVEL_ATA_1 0
 #define HD_LEVEL_ATA_2 1
index 54428ba4f56f50f85ddfb52656617eb0b0327473..2d78ee5c4ad294642cf5421645b61eabb1af481e 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -199,6 +199,10 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs)
                                error_log(_T("CD32 MPEG module overlay support require at least null filter enabled."));
                                prefs->gf[i].gfx_filter = 1;
                        }
+                       if (prefs->gf[i].gfx_filter == 0 && (prefs->genlock && prefs->genlock_image)) {
+                               error_log(_T("Genlock emulation require at least null filter enabled."));
+                               prefs->gf[i].gfx_filter = 1;
+                       }
                }
        }
 }
index ab0e6b72a9800445b5f66daee30cf835732afbbe..513e6a23c72ef1bb4a55a06b2148b3f3d1a70b80 100644 (file)
@@ -6708,6 +6708,7 @@ static void pipeline_020(uae_u16 w, uaecptr pc)
                write_log(_T("Opcode %04x has no size PC=%08x!\n"), w, pc);
        }
 #endif
+       // illegal instructions, TRAP, TRAPV, A-line, F-line don't stop prefetches
        int branch = cpudatatbl[w].branch;
        if (regs.pipeline_pos > 0 && branch) {
                // Short branches (Bcc.s) still do one more prefetch.
index 74387de51f5da3fef421411b9be94b731274ae1f..5acf5cb0f4ebfd771f8d8c812995ae215895f0d7 100644 (file)
 #define IDC_ROMFILE2                    1394
 #define IDC_SCSIROMSELECTCAT            1394
 #define IDC_ROMCHOOSER2                 1395
+#define IDC_EXPANSIONBOARDITEMSELECTOR  1395
 #define IDC_FLASHCHOOSER                1396
+#define IDC_EXPANSIONBOARDSELECTOR      1396
 #define IDC_FLASHFILE                   1397
+#define IDC_ACCELERATORBOARDITEMSELECTOR 1397
 #define IDC_CARTFILE                    1398
+#define IDC_ACCELERATORBOARDSELECTOR    1398
 #define IDC_CARTCHOOSER                 1399
 #define IDC_SAVE                        1400
 #define IDC_CPUBOARDROMSUBSELECT        1400
 #define IDC_AVIOUTPUT_VIDEO             1613
 #define IDC_INPUTAUTOFIRE               1613
 #define IDC_PORT_MOUSETRICK             1613
+#define IDC_EXPANSIONBOARDCHECKBOX      1613
 #define IDC_AVIOUTPUT_AUDIO             1614
 #define IDC_INPUTCOPYFROM               1614
 #define IDC_SANA2                       1614
 #define IDC_NE2000                      1616
 #define IDC_AVIOUTPUT_BORDER_TRIM       1617
 #define IDC_FILTERVZ                    1617
+#define IDC_ACCELERATORBOARDCHECKBOX    1617
 #define IDC_AVIOUTPUT_AUDIO_STATIC      1618
 #define IDC_FILTERHO                    1618
 #define IDC_AVIOUTPUT_VIDEO_STATIC      1619
 #define IDC_CPUBOARDMEM                 1843
 #define IDC_Z3MAPPING                   1844
 #define IDC_CPUBOARD_SUBTYPE            1845
-#define IDC_EXPANSION_SETTING1          1846
-#define IDC_EXPANSION_SETTING2          1847
-#define IDC_EXPANSION_SETTING3          1848
-#define IDC_CPUBOARD_SETTING1           1849
-#define IDC_CPUBOARD_SETTING2           1850
-#define IDC_CPUBOARD_SETTING3           1851
 #define ID__FLOPPYDRIVES                40004
 #define ID_FLOPPYDRIVES_DF0             40005
 #define ID_ST_CONFIGURATION             40010
index a978602a65858615f0f479945905b4d5ffc25998..5796ce521280a7535f4d0a77e35e91cefb65a3ed 100644 (file)
@@ -23,6 +23,7 @@
 
 <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
   <application>
+       <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
     <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
     <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
     <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
index 8e525c871640eab193442f5dd84e22c6fa14a86b..55b9496e700178a36e363212a9e65c1759e642ff 100644 (file)
@@ -594,12 +594,12 @@ BEGIN
     EDITTEXT        IDC_RESERVED,347,111,40,15,ES_NUMBER
     RTEXT           "Block size:",IDC_BLOCKSIZE_TEXT,299,132,45,10
     EDITTEXT        IDC_BLOCKSIZE,347,130,40,15,ES_NUMBER
-    PUSHBUTTON      "Enable RDB mode",IDC_HDF_RDB,214,109,75,14
+    PUSHBUTTON      "RDB mode",IDC_HDF_RDB,135,109,75,14
     LTEXT           "HD Controller:",IDC_STATIC,10,113,54,10,SS_CENTERIMAGE
-    COMBOBOX        IDC_HDF_CONTROLLER,6,131,138,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
-    COMBOBOX        IDC_HDF_CONTROLLER_UNIT,149,131,25,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
-    COMBOBOX        IDC_HDF_CONTROLLER_TYPE,180,131,29,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
-    COMBOBOX        IDC_HDF_FEATURE_LEVEL,214,131,75,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_HDF_CONTROLLER,6,131,152,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_HDF_CONTROLLER_UNIT,163,131,63,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_HDF_CONTROLLER_TYPE,231,131,58,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_HDF_FEATURE_LEVEL,214,109,75,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     EDITTEXT        IDC_HDFINFO,5,150,385,12,ES_CENTER | ES_READONLY
     EDITTEXT        IDC_HDFINFO2,5,166,385,12,ES_CENTER | ES_READONLY
     GROUPBOX        "New hard disk image file",IDC_STATIC,2,190,392,62
@@ -1213,8 +1213,6 @@ BEGIN
     EDITTEXT        IDC_CPUBOARDRAM,343,146,40,12,ES_CENTER | ES_READONLY
     COMBOBOX        IDC_CPUBOARD_TYPE,13,117,117,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     COMBOBOX        IDC_CPUBOARD_SUBTYPE,13,136,117,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-    CONTROL         "-",IDC_CPUBOARD_SETTING1,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,14,172,97,10
-    CONTROL         "-",IDC_CPUBOARD_SETTING2,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,121,172,100,10
     GROUPBOX        "Expansion Board Settings",IDC_STATIC,1,6,394,88
     COMBOBOX        IDC_SCSIROMSELECTNUM,175,42,22,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
     COMBOBOX        IDC_SCSIROMSELECT,12,42,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
@@ -1223,12 +1221,10 @@ BEGIN
     COMBOBOX        IDC_SCSIROMID,356,24,29,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
     COMBOBOX        IDC_SCSIROMFILE,202,42,171,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
     PUSHBUTTON      "...",IDC_SCSIROMCHOOSER,376,42,10,15
-    COMBOBOX        IDC_SCSIROMSUBSELECT,12,60,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_SCSIROMSUBSELECT,12,59,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
     LTEXT           "Accelerator board ROM file:",IDC_STATIC,203,104,170,15,SS_CENTERIMAGE
-    COMBOBOX        IDC_CPUBOARDROMFILE,200,119,171,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
-    PUSHBUTTON      "...",IDC_CPUBOARDROMCHOOSER,374,119,10,15
-    CONTROL         "-",IDC_EXPANSION_SETTING1,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,14,79,92,10
-    CONTROL         "-",IDC_EXPANSION_SETTING3,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,233,79,77,10
+    COMBOBOX        IDC_CPUBOARDROMFILE,202,119,169,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "...",IDC_CPUBOARDROMCHOOSER,376,119,10,15
     GROUPBOX        "Accelerator Board Settings",IDC_STATIC,1,96,394,97
     GROUPBOX        "Miscellaneous Expansions",IDC_STATIC,1,199,172,113
     CONTROL         "Catweasel Z2 emulation [] Catweasel MK2 Zorro II card emulation. Physical Windows compatible Catweasel card and drivers required.",IDC_CATWEASEL,
@@ -1248,12 +1244,16 @@ BEGIN
     CONTROL         "Include host SCSI devices",IDC_CS_SCSIMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,296,147,11
     CONTROL         "Realtek 8029 PCI [] Realtek 8029 PCI NIC emulation",IDC_NE2000,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,257,187,11
-    CONTROL         "-",IDC_CPUBOARD_SETTING3,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,233,172,100,10
-    CONTROL         "-",IDC_EXPANSION_SETTING2,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,121,79,101,10
     CONTROL         "Enabled",IDC_SCSIROMSELECTED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,43,99,12
     COMBOBOX        IDC_SCSIROMSELECTCAT,12,23,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
     CONTROL         "ES1370 PCI sound card",IDC_CS_ES1370,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,283,151,11
     CONTROL         "FM801 PCI sound card",IDC_CS_FM801,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,296,151,11
+    COMBOBOX        IDC_EXPANSIONBOARDITEMSELECTOR,12,76,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "",IDC_EXPANSIONBOARDCHECKBOX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,76,99,12
+    COMBOBOX        IDC_EXPANSIONBOARDSELECTOR,202,76,171,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_ACCELERATORBOARDITEMSELECTOR,12,168,157,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "",IDC_ACCELERATORBOARDCHECKBOX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,169,99,12
+    COMBOBOX        IDC_ACCELERATORBOARDSELECTOR,202,169,171,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
 END
 
 
index 74b9cd7322991263b57e4ca64578e65cb15c24de..661d573ef7a61195d706c267da183142d7b1e8d6 100644 (file)
 #define LANG_DLL_FULL_VERSION_MATCH 1
 
 #if WINUAEPUBLICBETA
-#define WINUAEBETA _T("3")
+#define WINUAEBETA _T("4")
 #else
 #define WINUAEBETA _T("")
 #endif
 
-#define WINUAEDATE MAKEBD(2015, 7, 13)
+#define WINUAEDATE MAKEBD(2015, 7, 22)
 
 //#define WINUAEEXTRA _T("AmiKit Preview")
 //#define WINUAEEXTRA _T("Amiga Forever Edition")
index 7913be292a72e7aa2a7b21dfdce06c3fa73b0f33..d25788463cffb7ae0570189ba475ee31be69f8d6 100644 (file)
@@ -53,6 +53,7 @@
 #include "sampler.h"
 #include "gfxboard.h"
 #include "cpuboard.h"
+#include "x86.h"
 #ifdef RETROPLATFORM
 #include "rp.h"
 #endif
@@ -2542,6 +2543,7 @@ void gfx_set_picasso_state (int on)
 {
        struct winuae_currentmode wc;
        struct apmode *newmode, *oldmode;
+       struct gfx_filterdata *newf, *oldf;
        int mode;
 
        if (screen_is_picasso == on)
@@ -2553,9 +2555,24 @@ void gfx_set_picasso_state (int on)
        newmode = &currprefs.gfx_apmode[on ? 1 : 0];
        oldmode = &currprefs.gfx_apmode[on ? 0 : 1];
 
+       newf = &currprefs.gf[on ? 1 : 0];
+       oldf = &currprefs.gf[on ? 0 : 1];
+
        updatemodes ();
        update_gfxparams ();
        clearscreen ();
+
+       // if filter changes, need to reset
+       mode = 0;
+       if (newf->gfx_filter != oldf->gfx_filter)
+               mode = -1;
+       for (int i = 0; i <= 2 * MAX_FILTERSHADERS; i++) {
+               if (_tcscmp(newf->gfx_filtershader[i], oldf->gfx_filtershader[i]))
+                       mode = -1;
+               if (_tcscmp(newf->gfx_filtermask[i], oldf->gfx_filtermask[i]))
+                       mode = -1;
+       }
+       // if screen parameter changes, need to reopen window
        if (newmode->gfx_fullscreen != oldmode->gfx_fullscreen ||
                (newmode->gfx_fullscreen && (
                        newmode->gfx_backbuffers != oldmode->gfx_backbuffers ||
@@ -2565,8 +2582,13 @@ void gfx_set_picasso_state (int on)
                        newmode->gfx_vflip != oldmode->gfx_vflip ||
                        newmode->gfx_vsync != oldmode->gfx_vsync))) {
                mode = 1;
-       } else {
-               mode = modeswitchneeded (&wc);
+       }
+       if (mode <= 0) {
+               int m = modeswitchneeded (&wc);
+               if (m > 0)
+                       mode = m;
+               if (m < 0 && !mode)
+                       mode = m;
                if (!mode)
                        goto end;
        }
@@ -2746,7 +2768,9 @@ static void createstatuswindow (void)
        fps_width = (int)(64 * scaleX);
        idle_width = (int)(64 * scaleX);
        if (is_ppc_cpu(&currprefs))
-               idle_width = 136;
+               idle_width += (int)(68 * scaleX);
+       if (is_x86_cpu(&currprefs))
+               idle_width += (int)(68 * scaleX);
        snd_width = (int)(72 * scaleX);
        joy_width = (int)(24 * scaleX);
        GetClientRect (hMainWnd, &rc);
index 066e1300cdd6685e27e1d3092bca4272b71e05db..0a5e574023c9b54a3982cc534f527aac4e24cf2e 100644 (file)
@@ -78,6 +78,7 @@
 #include "driveclick.h"
 #include "scsi.h"
 #include "cpuboard.h"
+#include "x86.h"
 #include "sana2.h"
 #ifdef PROWIZARD
 #include "moduleripper.h"
@@ -4364,7 +4365,7 @@ void InitializeListView (HWND hDlg)
                        else if (mi.size >= 1024 * 1024 * 1024)
                                _stprintf (size_str, _T("%.1fG"), ((double)(uae_u32)(mi.size / (1024 * 1024))) / 1024.0);
                        else if (mi.size < 10 * 1024 * 1024)
-                               _stprintf (size_str, _T("%dK"), mi.size / 1024);
+                               _stprintf (size_str, _T("%lldK"), mi.size / 1024);
                        else
                                _stprintf (size_str, _T("%.1fM"), ((double)(uae_u32)(mi.size / (1024))) / 1024.0);
 
@@ -4395,8 +4396,10 @@ void InitializeListView (HWND hDlg)
                                        _T("A4000T:%s"),
                                        _T("CDTV:%s"),
                                };
-                               if (ci->controller_unit == 7 && ert && !_tcscmp(ert->name, _T("a2091")))
+                               if (ci->controller_unit == 8 && ert && !_tcscmp(ert->name, _T("a2091")))
                                        _tcscpy(sid, _T("XT"));
+                               else if (ci->controller_unit == 8 && ert && !_tcscmp(ert->name, _T("a2090a")))
+                                       _tcscpy(sid, _T("ST-506"));
                                else
                                        _stprintf(sid, _T("%d"), ci->controller_unit);
                                _stprintf (blocksize_str, _T("%d"), ci->blocksize);
@@ -7657,8 +7660,6 @@ static INT_PTR CALLBACK ChipsetDlgProc2 (HWND hDlg, UINT msg, WPARAM wParam, LPA
        return FALSE;
 }
 
-static const int cpuboard_settings_id[] = { IDC_CPUBOARD_SETTING1, IDC_CPUBOARD_SETTING2, IDC_CPUBOARD_SETTING3, -1 };
-
 static void enable_for_memorydlg (HWND hDlg)
 {
        int fast = true;
@@ -7764,9 +7765,10 @@ static void setcpuboardmemsize(HWND hDlg)
        SetDlgItemText (hDlg, IDC_CPUBOARDRAM, memsize_names[msi_cpuboard[mem_size]]);
        SendDlgItemMessage (hDlg, IDC_CPUBOARD_TYPE, CB_SETCURSEL, workprefs.cpuboard_type, 0);
        SendDlgItemMessage (hDlg, IDC_CPUBOARD_SUBTYPE, CB_SETCURSEL, workprefs.cpuboard_subtype, 0);
-       for (int i = 0; cpuboard_settings_id[i] >= 0; i++) {
-               setchecked(hDlg, cpuboard_settings_id[i], (workprefs.cpuboard_settings & (1 << i)) != 0);
-       }
+
+//     for (int i = 0; cpuboard_settings_id[i] >= 0; i++) {
+//             setchecked(hDlg, cpuboard_settings_id[i], (workprefs.cpuboard_settings & (1 << i)) != 0);
+//     }
 }
 
 static int manybits (int v, int mask)
@@ -8073,6 +8075,160 @@ static void getromfile(HWND hDlg, DWORD d, TCHAR *path, int size)
        }
 }
 
+struct expansionrom_gui
+{
+       const struct expansionboardsettings *expansionrom_gui_ebs;
+       int expansionrom_gui_item;
+       DWORD expansionrom_gui_itemselector;
+       DWORD expansionrom_gui_selector;
+       DWORD expansionrom_gui_checkbox;
+       int expansionrom_gui_settingsbits;
+       int expansionrom_gui_settingsshift;
+       int expansionrom_gui_settings;
+};
+static struct expansionrom_gui expansion_gui_item;
+static struct expansionrom_gui accelerator_gui_item;
+
+static void reset_expansionrom_gui(HWND hDlg, struct expansionrom_gui *eg, DWORD itemselector, DWORD selector, DWORD checkbox)
+{
+       eg->expansionrom_gui_settings = NULL;
+       eg->expansionrom_gui_item = 0;
+       eg->expansionrom_gui_ebs = NULL;
+       hide(hDlg, itemselector, 1);
+       hide(hDlg, selector, 1);
+       hide(hDlg, checkbox, 1);
+}
+
+static void create_expansionrom_gui(HWND hDlg, struct expansionrom_gui *eg, const struct expansionboardsettings *ebs, int settings, DWORD itemselector, DWORD selector, DWORD checkbox)
+{
+       bool reset = false;
+       static int recursive;
+       const struct expansionboardsettings *eb;
+       if (eg->expansionrom_gui_ebs != ebs) {
+               eg->expansionrom_gui_item = 0;
+               reset = true;
+       }
+       eg->expansionrom_gui_ebs = ebs;
+       eg->expansionrom_gui_itemselector = itemselector;
+       eg->expansionrom_gui_selector = selector;
+       eg->expansionrom_gui_checkbox = checkbox;
+       eg->expansionrom_gui_settings = settings;
+
+       if (!ebs) {
+               reset_expansionrom_gui(hDlg, eg, itemselector, selector, checkbox);
+               return;
+       }
+       if (recursive > 0)
+               return;
+       recursive++;
+
+       int item = eg->expansionrom_gui_item;
+       hide(hDlg, itemselector, 0);
+       int bitcnt = 0;
+       for (int i = 0; i < item; i++) {
+               const struct expansionboardsettings *eb = &ebs[i];
+               if (eb->multiselect) {
+                       const TCHAR *p = eb->configname;
+                       int itemcnt = -1;
+                       while (p[0]) {
+                               itemcnt++;
+                               p += _tcslen(p) + 1;
+                       }
+                       int bits = 1;
+                       for (int i = 7; i >= 0; i--) {
+                               if (itemcnt & (1 << i)) {
+                                       bits = i;
+                                       break;
+                               }
+                       }
+                       bitcnt += bits;
+               } else {
+                       bitcnt++;
+               }
+               bitcnt += eb->bitshift;
+       }
+       if (reset) {
+               SendDlgItemMessage(hDlg, itemselector, CB_RESETCONTENT, 0, 0);
+               for (int i = 0; ebs[i].name; i++) {
+                       const struct expansionboardsettings *eb = &ebs[i];
+                       SendDlgItemMessage(hDlg, itemselector, CB_ADDSTRING, 0, (LPARAM)eb->name);
+               }
+               SendDlgItemMessage(hDlg, itemselector, CB_SETCURSEL, item, 0);
+       }
+       eb = &ebs[item];
+       bitcnt += eb->bitshift;
+       if (eb->multiselect) {
+               SendDlgItemMessage(hDlg, selector, CB_RESETCONTENT, 0, 0);
+               int itemcnt = -1;
+               const TCHAR *p = eb->name;
+               while (p[0]) {
+                       if (itemcnt >= 0) {
+                               SendDlgItemMessage(hDlg, selector, CB_ADDSTRING, 0, (LPARAM)p);
+                       }
+                       itemcnt++;
+                       p += _tcslen(p) + 1;
+               }
+               int bits = 1;
+               for (int i = 7; i >= 0; i--) {
+                       if (itemcnt & (1 << i)) {
+                               bits = i;
+                               break;
+                       }
+               }
+               int value = settings;
+               if (eb->invert)
+                       value ^= 0x7fffffff;
+               value >>= bitcnt;
+               value &= (1 << bits) - 1;
+               SendDlgItemMessage(hDlg, selector, CB_SETCURSEL, value, 0);
+               hide(hDlg, selector, 0);
+               hide(hDlg, checkbox, 1);
+               eg->expansionrom_gui_settingsbits = bits;
+       } else {
+               hide(hDlg, selector, 1);
+               hide(hDlg, checkbox, 0);
+               setchecked(hDlg, checkbox, ((settings >> bitcnt) ^ (eb->invert ? 1 : 0)) & 1);
+               eg->expansionrom_gui_settingsbits = 1;
+       }
+       eg->expansionrom_gui_settingsshift = bitcnt;
+       recursive--;
+}
+
+static void get_expansionrom_gui(HWND hDlg, struct expansionrom_gui *eg)
+{
+       if (!eg->expansionrom_gui_ebs)
+               return;
+
+       int val;
+       int settings = eg->expansionrom_gui_settings;
+
+       val = SendDlgItemMessage(hDlg, eg->expansionrom_gui_itemselector, CB_GETCURSEL, 0, 0);
+       if (val != CB_ERR && val != eg->expansionrom_gui_item) {
+               eg->expansionrom_gui_item = val;
+               create_expansionrom_gui(hDlg, eg, eg->expansionrom_gui_ebs, eg->expansionrom_gui_settings, eg->expansionrom_gui_itemselector, eg->expansionrom_gui_selector, eg->expansionrom_gui_checkbox);
+               return;
+       }
+       const struct expansionboardsettings *eb = &eg->expansionrom_gui_ebs[eg->expansionrom_gui_item];
+       if (eb->multiselect) {
+               val = SendDlgItemMessage(hDlg, eg->expansionrom_gui_selector, CB_GETCURSEL, 0, 0);
+               if (val != CB_ERR) {
+                       int mask = (1 << eg->expansionrom_gui_settingsbits) - 1;
+                       settings &= ~(mask << eg->expansionrom_gui_settingsshift);
+                       settings |= val << eg->expansionrom_gui_settingsshift;
+                       if (eb->invert)
+                               settings ^= mask << eg->expansionrom_gui_settingsshift;
+               }
+       } else {
+               settings &= ~(1 << eg->expansionrom_gui_settingsshift);
+               if (ischecked(hDlg, eg->expansionrom_gui_checkbox)) {
+                       settings |= 1 << eg->expansionrom_gui_settingsshift;
+               }
+               if (eb->invert)
+                       settings ^= 1 << eg->expansionrom_gui_settingsshift;
+       }
+       eg->expansionrom_gui_settings = settings;
+}
+
 
 static struct netdriverdata *ndd[MAX_TOTAL_NET_DEVICES + 1];
 
@@ -8097,7 +8253,7 @@ static void expansion_net (HWND hDlg)
                                _stprintf(mac, _T("xx:xx:xx:%02X:%02X:%02X"),
                                        ndd[i]->mac[3], ndd[i]->mac[4], ndd[i]->mac[5]);
                        } else {
-                               _stprintf (mac, _T("2X:%02X:%02X:%02X:%02X:%02X"),
+                               _stprintf (mac, _T("%02X:%02X:%02X:%02X:%02X:%02X"),
                                        ndd[i]->mac[0], ndd[i]->mac[1], ndd[i]->mac[2], ndd[i]->mac[3], ndd[i]->mac[4], ndd[i]->mac[5]);
                        }
                        _stprintf (tmp, _T("%s %s"), mac, ndd[i]->desc);
@@ -8114,7 +8270,7 @@ static void expansion_net (HWND hDlg)
                SendDlgItemMessage (hDlg, IDC_NETDEVICE, CB_SETCURSEL, 0, 0);
 }
 
-static const int scsiromselectedmask[] = { EXPANSIONTYPE_SCSI, EXPANSIONTYPE_IDE, EXPANSIONTYPE_SASI, EXPANSIONTYPE_CUSTOM, EXPANSIONTYPE_PCI_BRIDGE };
+static const int scsiromselectedmask[] = { EXPANSIONTYPE_SCSI, EXPANSIONTYPE_IDE, EXPANSIONTYPE_SASI, EXPANSIONTYPE_CUSTOM, EXPANSIONTYPE_PCI_BRIDGE, EXPANSIONTYPE_X86_BRIDGE };
 static void init_expansion2(HWND hDlg)
 {
        static int first = -1;
@@ -8199,8 +8355,6 @@ static void init_expansion2(HWND hDlg)
 }
 
 
-static const int expansion_settings_id[] = { IDC_EXPANSION_SETTING1, IDC_EXPANSION_SETTING2, IDC_EXPANSION_SETTING3, 1 };
-
 static void values_to_expansion2dlg_sub(HWND hDlg)
 {
        SendDlgItemMessage(hDlg, IDC_CPUBOARDROMSUBSELECT, CB_RESETCONTENT, 0, 0);
@@ -8257,8 +8411,12 @@ static void values_from_expansion2dlg(HWND hDlg)
                if (v != CB_ERR)
                        brc->roms[index].device_id = v;
 
+
                const struct expansionboardsettings *cbs = ert->settings;
                if (cbs) {
+                       brc->roms[index].device_settings = expansion_gui_item.expansionrom_gui_settings;
+               }
+#if 0
                        for (int i = 0; cbs[i].name; i++) {
                                int id = expansion_settings_id[i];
                                if (id < 0)
@@ -8268,7 +8426,7 @@ static void values_from_expansion2dlg(HWND hDlg)
                                        brc->roms[index].device_settings |= 1 << i;
                        }
                }
-
+#endif
                v = SendDlgItemMessage(hDlg, IDC_SCSIROMSUBSELECT, CB_GETCURSEL, 0, 0L);
                if (v != CB_ERR)
                        brc->roms[index].subtype = v;
@@ -8284,13 +8442,12 @@ static void values_from_expansion2dlg(HWND hDlg)
                values_to_expansion2dlg_sub(hDlg);
        }
 
-
+       workprefs.cpuboard_settings = accelerator_gui_item.expansionrom_gui_settings;
        getromfile(hDlg, IDC_CPUBOARDROMFILE, tmp, sizeof(brc->roms[index].romfile) / sizeof(TCHAR));
        if (tmp[0]) {
                brc = get_device_rom_new(&workprefs, ROMTYPE_CPUBOARD, 0, &index);
                getromfile(hDlg, IDC_CPUBOARDROMFILE, brc->roms[index].romfile, sizeof(brc->roms[index].romfile) / sizeof(TCHAR));
-       }
-       else {
+       } else {
                clear_device_rom(&workprefs, ROMTYPE_CPUBOARD, 0);
        }
 }
@@ -8356,8 +8513,7 @@ static void values_to_expansion2_expansion_settings(HWND hDlg)
        if (brc) {
                if (brc->roms[index].romfile[0])
                        ew(hDlg, IDC_SCSIROMFILEAUTOBOOT, ert->autoboot_jumper);
-       }
-       else {
+       } else {
                if (brc)
                        brc->roms[index].autoboot_disabled = false;
                ew(hDlg, IDC_SCSIROMFILEAUTOBOOT, FALSE);
@@ -8366,6 +8522,10 @@ static void values_to_expansion2_expansion_settings(HWND hDlg)
        ew(hDlg, IDC_SCSIROMID, ert->id_jumper);
 
        const struct expansionboardsettings *cbs = ert->settings;
+
+       create_expansionrom_gui(hDlg, &expansion_gui_item, cbs, brc ? brc->roms[index].device_settings : 0, IDC_EXPANSIONBOARDITEMSELECTOR, IDC_EXPANSIONBOARDSELECTOR, IDC_EXPANSIONBOARDCHECKBOX);
+
+#if 0
        for (int i = 0; expansion_settings_id[i] >= 0; i++) {
                hide(hDlg, expansion_settings_id[i], !(cbs && cbs[i].name));
        }
@@ -8385,8 +8545,10 @@ static void values_to_expansion2_expansion_settings(HWND hDlg)
                hide(hDlg, id, true);
                i++;
        }
+#endif
 }
 
+
 static void enable_for_expansion2dlg (HWND hDlg)
 {
        int z3 = true;
@@ -8416,6 +8578,8 @@ static void enable_for_expansion2dlg (HWND hDlg)
        ew(hDlg, IDC_CPUBOARDMEM, workprefs.cpuboard_type > 0);
        ew(hDlg, IDC_CPUBOARDRAM, workprefs.cpuboard_type > 0);
        ew(hDlg, IDC_CPUBOARD_SUBTYPE, workprefs.cpuboard_type);
+
+#if 0
        const struct expansionboardsettings *cbs = cpuboards[workprefs.cpuboard_type].subtypes[workprefs.cpuboard_subtype].settings;
        int i = 0;
        if (cbs) {
@@ -8430,6 +8594,7 @@ static void enable_for_expansion2dlg (HWND hDlg)
                hide(hDlg, cpuboard_settings_id[i], 1);
                i++;
        }
+#endif
 }
 
 static void values_to_expansion2dlg (HWND hDlg)
@@ -8466,7 +8631,7 @@ static void values_to_expansion2dlg (HWND hDlg)
                const struct cpuboardsubtype *cst = &cpuboards[workprefs.cpuboard_type].subtypes[workprefs.cpuboard_subtype];
                brc = get_device_rom(&workprefs, ROMTYPE_CPUBOARD, 0, &index);
                addromfiles(fkey, hDlg, IDC_CPUBOARDROMFILE, brc ? brc->roms[index].romfile : NULL,
-                                       cst->romtype, cst->romtype_extra);
+                       cst->romtype, cst->romtype_extra);
        } else {
                SendDlgItemMessage(hDlg, IDC_CPUBOARDROMFILE, CB_RESETCONTENT, 0, 0);
        }
@@ -8485,7 +8650,12 @@ static void updatecpuboardsubtypes(HWND hDlg)
        for (int i = 0; cpuboards[workprefs.cpuboard_type].subtypes[i].name; i++) {
                SendDlgItemMessage(hDlg, IDC_CPUBOARD_SUBTYPE, CB_ADDSTRING, 0, (LPARAM) cpuboards[workprefs.cpuboard_type].subtypes[i].name);
        }
+
+
        const struct expansionboardsettings *cbs = cpuboards[workprefs.cpuboard_type].subtypes[workprefs.cpuboard_subtype].settings;
+       create_expansionrom_gui(hDlg, &accelerator_gui_item, cbs, workprefs.cpuboard_settings, IDC_ACCELERATORBOARDITEMSELECTOR, IDC_ACCELERATORBOARDSELECTOR, IDC_ACCELERATORBOARDCHECKBOX);
+
+#if 0
        int i = 0;
        if (cbs) {
                for (i = 0; cbs[i].name; i++) {
@@ -8500,6 +8670,7 @@ static void updatecpuboardsubtypes(HWND hDlg)
                SetWindowText(GetDlgItem(hDlg, id), _T("-"));
                i++;
        }
+#endif
 }
 
 static void expansion2filebuttons(HWND hDlg, WPARAM wParam, TCHAR *path)
@@ -8561,7 +8732,10 @@ static INT_PTR CALLBACK Expansion2DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LP
                        SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTCAT, CB_ADDSTRING, 0, (LPARAM)_T("IDE Controllers"));
                        SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTCAT, CB_ADDSTRING, 0, (LPARAM)_T("SASI Controllers"));
                        SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTCAT, CB_ADDSTRING, 0, (LPARAM)_T("Custom Controllers"));
-                       SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTCAT, CB_ADDSTRING, 0, (LPARAM)_T("PCI Bridges"));
+                       SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTCAT, CB_ADDSTRING, 0, (LPARAM)_T("PCI Bridgeboards"));
+                       SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTCAT, CB_ADDSTRING, 0, (LPARAM)_T("x86 Bridgeboards"));
+                       reset_expansionrom_gui(hDlg, &expansion_gui_item, IDC_EXPANSIONBOARDITEMSELECTOR, IDC_EXPANSIONBOARDSELECTOR, IDC_EXPANSIONBOARDCHECKBOX);
+                       reset_expansionrom_gui(hDlg, &accelerator_gui_item, IDC_ACCELERATORBOARDITEMSELECTOR, IDC_ACCELERATORBOARDSELECTOR, IDC_ACCELERATORBOARDCHECKBOX);
                        hide(hDlg, IDC_SCSIROMSELECTED, 1);
                        expansion_net(hDlg);
                        init_expansion2(hDlg);
@@ -8584,9 +8758,12 @@ static INT_PTR CALLBACK Expansion2DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LP
                        recursive++;
                        switch (LOWORD(wParam))
                        {
-                               case IDC_EXPANSION_SETTING1:
-                               case IDC_EXPANSION_SETTING2:
-                               case IDC_EXPANSION_SETTING3:
+                               case IDC_EXPANSIONBOARDCHECKBOX:
+                               get_expansionrom_gui(hDlg, &expansion_gui_item);
+                               values_from_expansion2dlg(hDlg);
+                               break;
+                               case IDC_ACCELERATORBOARDCHECKBOX:
+                               get_expansionrom_gui(hDlg, &accelerator_gui_item);
                                values_from_expansion2dlg(hDlg);
                                break;
                                case IDC_SCSIROMFILEAUTOBOOT:
@@ -8655,6 +8832,16 @@ static INT_PTR CALLBACK Expansion2DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LP
                        if (HIWORD(wParam) == CBN_SELENDOK || HIWORD(wParam) == CBN_KILLFOCUS || HIWORD(wParam) == CBN_EDITCHANGE) {
                                switch (LOWORD(wParam))
                                {
+                                       case IDC_EXPANSIONBOARDITEMSELECTOR:
+                                       case IDC_EXPANSIONBOARDSELECTOR:
+                                       get_expansionrom_gui(hDlg, &expansion_gui_item);
+                                       values_from_expansion2dlg(hDlg);
+                                       break;
+                                       case IDC_ACCELERATORBOARDITEMSELECTOR:
+                                       case IDC_ACCELERATORBOARDSELECTOR:
+                                       get_expansionrom_gui(hDlg, &accelerator_gui_item);
+                                       values_from_expansion2dlg(hDlg);
+                                       break;
                                        case IDC_SCSIROMFILE:
                                        case IDC_SCSIROMID:
                                        case IDC_CPUBOARDROMFILE:
@@ -8744,11 +8931,13 @@ static INT_PTR CALLBACK Expansion2DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LP
                                        break;
                                }
                        }
+#if 0
                        for (int i = 0; cpuboard_settings_id[i] >= 0; i++) {
                                workprefs.cpuboard_settings &= ~(1 << i);
                                if (ischecked(hDlg, cpuboard_settings_id[i]))
                                        workprefs.cpuboard_settings |= 1 << i;
                        }
+#endif
                        recursive--;
                }
                break;
@@ -9315,7 +9504,6 @@ static void kickstartfilebuttons (HWND hDlg, WPARAM wParam, TCHAR *path)
 static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
        static int recursive;
-       int val;
        TCHAR tmp[MAX_DPATH];
 
        switch (msg)
@@ -9689,8 +9877,21 @@ static void setstatefilename (HWND hDlg)
 
 static void setdefaultguisize (void)
 {
-       gui_width = GUI_INTERNAL_WIDTH * 100 / 100;
-       gui_height = GUI_INTERNAL_HEIGHT * 100 / 100;
+       double dpix = 1.0, dpiy = 1.0;
+
+       if (isfullscreen() <= 0)
+               scaleresource_getdpimult(&dpix, &dpiy);
+
+       gui_width = (int)(GUI_INTERNAL_WIDTH * dpix);
+       gui_height = (int)(GUI_INTERNAL_HEIGHT * dpiy);
+
+       int w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+       int h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+
+       if ((dpix > 1 || dpiy > 1) && (gui_width > w || gui_height > h)) {
+               gui_width = w;
+               gui_height = h;
+       }
 }
 
 static void getstoredguisize(void)
@@ -9854,15 +10055,17 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
                        scaleresource_setdefaults ();
                        v = SendDlgItemMessage (hDlg, IDC_GUI_SIZE, CB_GETCURSEL, 0, 0L);
                        if (v != CB_ERR) {
+                               double dpix = 1.0, dpiy = 1.0;
                                if (v == 0) {
                                        v = GUI_SCALE_DEFAULT;
                                } else {
                                        v--;
                                        v = 140 - v * 10;
                                }
-                               double m = scaleresource_getdpimult ();
-                               gui_width = (int)(GUI_INTERNAL_WIDTH * m * v / 100);
-                               gui_height = (int)(GUI_INTERNAL_HEIGHT * m * v / 100);
+                               if (isfullscreen() <= 0)
+                                       scaleresource_getdpimult(&dpix, &dpiy);
+                               gui_width = (int)(GUI_INTERNAL_WIDTH * dpix * v / 100);
+                               gui_height = (int)(GUI_INTERNAL_HEIGHT * dpiy * v / 100);
                                if (gui_width < MIN_GUI_INTERNAL_WIDTH || gui_height < MIN_GUI_INTERNAL_HEIGHT) {
                                        gui_width = MIN_GUI_INTERNAL_WIDTH;
                                        gui_height = MIN_GUI_INTERNAL_HEIGHT;
@@ -11102,6 +11305,9 @@ static void sethardfile (HWND hDlg)
        bool ide = current_hfdlg.ci.controller_type >= HD_CONTROLLER_TYPE_IDE_FIRST && current_hfdlg.ci.controller_type <= HD_CONTROLLER_TYPE_IDE_LAST;
        bool scsi = current_hfdlg.ci.controller_type >= HD_CONTROLLER_TYPE_SCSI_FIRST && current_hfdlg.ci.controller_type <= HD_CONTROLLER_TYPE_SCSI_LAST;
 
+       if (current_hfdlg.ci.controller_unit >= 8)
+               current_hfdlg.ci.unit_feature_level = HD_LEVEL_SASI_CHS;
+
        if (!disables)
                current_hfdlg.ci.bootpri = 0;
        if (!physgeo)
@@ -11226,13 +11432,18 @@ static void inithdcontroller (HWND hDlg, int ctype, int ctype_unit, int devtype)
                SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("0"));
                SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("1"));
                if (!ert || !(ert->deviceflags & (EXPANSIONTYPE_SASI | EXPANSIONTYPE_CUSTOM)) ) {
-                       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("2"));
-                       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("3"));
-                       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("4"));
-                       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("5"));
-                       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("6"));
+                       SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("2"));
+                       SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("3"));
+                       SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("4"));
+                       SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("5"));
+                       SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("6"));
+                       SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("7"));
                        if (devtype == UAEDEV_HDF && ert && !_tcscmp(ert->name, _T("a2091")))
                                SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("XT"));
+                       if (devtype == UAEDEV_HDF && ert && !_tcscmp(ert->name, _T("a2090a"))) {
+                               SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("ST-506 #1"));
+                               SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("ST-506 #2"));
+                       }
                }
                ew(hDlg, IDC_HDF_CONTROLLER_UNIT, TRUE);
        } else {
@@ -11377,7 +11588,7 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
                        id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7],
                        id[8], id[9], id[10], id[11], id[12], id[13], id[14], id[15]);
                if (!blocks) {
-                       _stprintf (tmp, _T("%dMB"), bsize / (1024 * 1024));
+                       _stprintf (tmp, _T("%uMB"), (unsigned int)(bsize / (1024 * 1024)));
                } else if (blocks && !cyls) {
                        _stprintf (tmp, _T("%u blocks, %.1fMB"),
                                blocks,
@@ -12872,14 +13083,14 @@ static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA
                        if (workprefs.floppy_speed > 0 && workprefs.floppy_speed < 10)
                                workprefs.floppy_speed = 100;
                        currentpage = FLOPPY_ID;
-                       SendDlgItemMessage (hDlg, IDC_FLOPPYSPD, TBM_SETRANGE, TRUE, MAKELONG (0, 4));
-                       SendDlgItemMessage (hDlg, IDC_FLOPPYSPD, TBM_SETPAGESIZE, 0, 1);
-                       SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_RESETCONTENT, 0, 0L);
-                       SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35dd);
-                       SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35hd);
-                       SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35ddpc);
-                       SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35hdpc);
-                       SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft525sd);
+                       SendDlgItemMessage(hDlg, IDC_FLOPPYSPD, TBM_SETRANGE, TRUE, MAKELONG (0, 4));
+                       SendDlgItemMessage(hDlg, IDC_FLOPPYSPD, TBM_SETPAGESIZE, 0, 1);
+                       SendDlgItemMessage(hDlg, IDC_FLOPPYTYPE, CB_RESETCONTENT, 0, 0L);
+                       SendDlgItemMessage(hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35dd);
+                       SendDlgItemMessage(hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35hd);
+                       SendDlgItemMessage(hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35ddpc);
+                       SendDlgItemMessage(hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35hdpc);
+                       SendDlgItemMessage(hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft525sd);
                        SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_SETCURSEL, 0, 0);
                        for (i = 0; i < 4; i++) {
                                int f_type = floppybuttons[i][3];
@@ -12889,6 +13100,8 @@ static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA
                                SendDlgItemMessage (hDlg, f_type, CB_ADDSTRING, 0, (LPARAM)ft35hd);
                                SendDlgItemMessage (hDlg, f_type, CB_ADDSTRING, 0, (LPARAM)ft525sd);
                                SendDlgItemMessage (hDlg, f_type, CB_ADDSTRING, 0, (LPARAM)ft35ddescom);
+                               if (i >= 2)
+                                       SendDlgItemMessage(hDlg, f_type, CB_ADDSTRING, 0, (LPARAM)_T("PC Bridge"));
                        }
                        setmultiautocomplete (hDlg, df0texts);
                }
@@ -18747,6 +18960,10 @@ void gui_led (int led, int on)
                        on = 0;
                else
                        on = 1;
+               bool m68klabelchange = false;
+               TCHAR *m68label = _T("CPU");
+               ptr[0] = 0;
+               p = ptr;
                if (is_ppc_cpu(&currprefs)) {
                        _tcscpy(ptr, _T("PPC: "));
                        if (ppc_state == PPC_STATE_ACTIVE)
@@ -18757,17 +18974,30 @@ void gui_led (int led, int on)
                                _tcscat(ptr, _T("SLEEP"));
                        else
                                _tcscat(ptr, _T("STOP"));
+                       _tcscat(ptr, _T(" "));
+                       p = ptr + _tcslen(ptr);
+                       m68label = _T("68k");
+                       m68klabelchange = true;
+               }
+               int state = is_x86_cpu(&currprefs);
+               if (state > 0) {
+                       _tcscpy(ptr, _T("x86: "));
+                       if (state == X86_STATE_ACTIVE)
+                               _tcscat(ptr, _T("RUN"));
+                       else
+                               _tcscat(ptr, _T("STOP"));
+                       _tcscat(ptr, _T(" "));
                        p = ptr + _tcslen(ptr);
-                       if (gui_data.cpu_halted < 0)
-                               _tcscpy(p, _T(" 68K: STOP"));
+                       m68label = _T("68k");
+                       m68klabelchange = true;
+               }
+               if (gui_data.cpu_halted < 0) {
+                       if (!m68klabelchange)
+                               _tcscpy(p, _T("STOP"));
                        else
-                               _stprintf(p, _T(" 68K: %.0f%%"), (double)((gui_data.idle) / 10.0));
+                               _tcscat(p, _T(" 68k: STOP"));
                } else {
-                       if (gui_data.cpu_halted < 0) {
-                               _tcscpy(ptr, _T("STOP"));
-                       } else {
-                               _stprintf(ptr, _T("CPU: %.0f%%"), (double)((gui_data.idle) / 10.0));
-                       }
+                       _stprintf(p, _T("%s: %.0f%%"), m68label, (double)((gui_data.idle) / 10.0));
                }
        } else if (led == LED_SND && gui_data.drive_disabled[3]) {
                pos = 0;
index f4b5a9aa1f088575d92925060ef96879115d7f13..3a8aae3813e09c2a8653bb5d922dfd821b2db06a 100644 (file)
@@ -43,6 +43,6 @@ extern void scaleresource_init (const TCHAR*, int);
 extern int scaleresource_choosefont (HWND hDlg, int fonttype);
 extern void scaleresource_setdefaults (void);
 extern void scaleresource_setfont (HWND hDlg);
-extern double scaleresource_getdpimult (void);
+extern void scaleresource_getdpimult (double*, double*);
 
 #endif
index c61fb801df23d80504a67a2f98ed9defc5062a07..7d272810746368f7c444198a533a6216d1ffe177 100644 (file)
@@ -525,9 +525,33 @@ static void sizefont (HWND hDlg, const TCHAR *name, int size, int style, int wei
 }
 #endif
 
-double scaleresource_getdpimult (void)
+
+typedef enum MONITOR_DPI_TYPE {
+       MDT_EFFECTIVE_DPI = 0,
+       MDT_ANGULAR_DPI = 1,
+       MDT_RAW_DPI = 2,
+       MDT_DEFAULT = MDT_EFFECTIVE_DPI
+} MONITOR_DPI_TYPE;
+typedef HRESULT(CALLBACK* GETDPIFORMONITOR)(HMONITOR, MONITOR_DPI_TYPE, UINT*, UINT*);
+
+void scaleresource_getdpimult (double *dpixp, double *dpiyp)
 {
-       return (double)baseheight / GUI_INTERNAL_HEIGHT;
+       GETDPIFORMONITOR pGetDpiForMonitor;
+       POINT pt = { 32000, 32000 };
+       HMONITOR mon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
+
+       *dpixp = 1.0;
+       *dpiyp = 1.0;
+       pGetDpiForMonitor = (GETDPIFORMONITOR)GetProcAddress(GetModuleHandle(_T("Shcore.dll")), "GetDpiForMonitor");
+       if (pGetDpiForMonitor) {
+               UINT dpix, dpiy;
+               if (SUCCEEDED(pGetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &dpix, &dpiy))) {
+                       if (dpix > 96)
+                               *dpixp = (double)dpix / 96.0;
+                       if (dpiy > 96)
+                               *dpiyp = (double)dpiy / 96.0;
+               }
+       }
 }
 
 void scaleresource_setmult (HWND hDlg, int w, int h, int fullscreen)
index eb70459b6c0e68a02092fc7695eafb7318c721ab..8fa1d49b2b8432f54d64c3f0a3b9c12470076480 100644 (file)
     <ClCompile Include="..\..\dlopen.cpp" />
     <ClCompile Include="..\..\ethernet.cpp" />
     <ClCompile Include="..\..\events.cpp" />
+    <ClCompile Include="..\..\fake86_cpu.cpp" />
     <ClCompile Include="..\..\flashrom.cpp" />
     <ClCompile Include="..\..\gfxboard.cpp" />
     <ClCompile Include="..\..\hrtmon.rom.cpp" />
     <ClCompile Include="..\..\tabletlibrary.cpp" />
     <ClCompile Include="..\..\test_card.cpp" />
     <ClCompile Include="..\..\uaenative.cpp" />
+    <ClCompile Include="..\..\x86.cpp" />
     <ClCompile Include="..\ahidsound_dsonly.cpp" />
     <ClCompile Include="..\ahidsound_new.cpp" />
     <ClCompile Include="..\avioutput.cpp" />
index 43a5ecac6351228128e1ab8aec38798be259c2d5..59b2a65c47fae6e9b458e44cf3375a5385be3024 100644 (file)
     <ClCompile Include="..\..\mame\a2410.cpp">
       <Filter>mame</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\x86.cpp">
+      <Filter>common</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\fake86_cpu.cpp">
+      <Filter>common</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\resources\35floppy.ico">
index 72ff77c522939fc0c7e3ad8e9af36f182f8dd454..8ed8b27520e1af53fced188748a34ed732888578 100644 (file)
@@ -1,4 +1,39 @@
 
+Beta 4:
+
+- RTG<>chipset mode switching didn't check if modes have different filter type (forgot to add
+  when RTG filter support was implemented)
+- 68020/030 prefetch pipeline b3 missing addressing mode implemented. Other adjustments: single
+  word unconditional branch-like instruction (for example RTS) stop prefetches immediately but
+  conditional single opcode always prefetch one extra word before stopping. Bcc.S (when not
+  branching) and DBcc probably aren't exactly right yet.
+- A2090 ST-506 support implemented.
+- Note about existing configurations that use A590 XT support: drive type (SCSI ID/XT) must be reset.
+- GUI default windowed mode window size (when it runs for the first time and size information is not
+  yet stored in registry/ini) is now adjusted for high DPI screen. (Windows 8.1+ only). Previously
+  default size was far too small on high DPI displays.
+- Added "I am Windows 10 compatible" manifest entry, winuaebootlog.txt now shows correct Windows 10
+  version information.
+- Cleaned up pfield_do_linetoscr() mess.
+- Added support for AGA subpixel bitplane delays (lores pixel can horizontally scroll 4 shres or 2
+  hires pixels or hires pixel 2 shres pixels). Limit: only works if both odd and even planes have
+  same subpixel scroll value (which probably is true practically in all situations)
+- b1 sprite right border corner case broke SSCAN2 sprite horizontal duplication.
+- x86 bridgeboard emulation! A1060 Sidecar, A2088 and A2088T currently implemented.
+
+x86 bridgeboard information:
+- Currently uses fake86 CPU core + PC support chip emulation. Selected because it was very easy
+  to integrate. Possible future A2286+ emulation needs different CPU core.
+- All jumpers emulated. (Required redesign of expansion GUI extra config)
+- Amiga floppy drive DF2: and DF3: can be re-configured as bridgeboard PC drives A: and B:.
+- Only 360k and 720k standard dos disk images supported.
+- A2088T 360k/720k compatible drive supported. Floppy switch not implemented.
+- A1060 and A2088 apparently only have 360k drive and BIOS support.
+- BIOS ROM required. Searching for "A2088 BIOS" or similar should work... No BIOS ROMs
+  added to rom scanner.
+- Not much real testing done. Boots from dos boot floppy, drive formatting and reading/writing works.
+- x86 CPU speed is currently very randomly chosen speed.
+
 Beta 3:
 
 - CD and sound card audio are now always resampled with Anti interpolator before it gets mixed