]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
3100b13
authorToni Wilen <twilen@winuae.net>
Sat, 21 Mar 2015 14:14:01 +0000 (16:14 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 21 Mar 2015 14:14:01 +0000 (16:14 +0200)
23 files changed:
a2091.cpp
cfgfile.cpp
custom.cpp
expansion.cpp
filesys.cpp
hardfile.cpp
ide.cpp
idecontrollers.cpp
include/ide.h
include/options.h
include/rommgr.h
include/scsi.h
ncr9x_scsi.cpp
ncr_scsi.cpp
newcpu.cpp
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32.h
od-win32/win32gfx.cpp
od-win32/win32gui.cpp
od-win32/win32gui_extra.cpp
rommgr.cpp
scsi.cpp

index fd14965a6bd119521e621c6b552f178e2134b617..4c19de714730488f3204ec830100250a23d6a546 100644 (file)
--- a/a2091.cpp
+++ b/a2091.cpp
@@ -283,24 +283,27 @@ static void freescsi(struct wd_state **wd)
        *wd = NULL;
 }
 
-static struct wd_state *allocscsi(struct wd_state **wd, struct romconfig *rc)
+static struct wd_state *allocscsi(struct wd_state **wd, struct romconfig *rc, int ch)
 {
        struct wd_state *scsi;
 
-       freescsi(wd);
-       scsi = xcalloc(struct wd_state, 1);
-       for (int i = 0; i < MAX_SCSI_UNITS; i++) {
-               if (scsi_units[i] == NULL) {
-                       scsi_units[i] = scsi;
-                       if (rc)
-                               rc->unitdata = scsi;
-                       scsi->rc = rc;
-                       *wd = scsi;
-                       return scsi;
+       if (ch < 0) {
+               freescsi(wd);
+       }
+       if ((*wd) == NULL) {
+               scsi = xcalloc(struct wd_state, 1);
+               for (int i = 0; i < MAX_SCSI_UNITS; i++) {
+                       if (scsi_units[i] == NULL) {
+                               scsi_units[i] = scsi;
+                               if (rc)
+                                       rc->unitdata = scsi;
+                               scsi->rc = rc;
+                               *wd = scsi;
+                               return scsi;
+                       }
                }
        }
-       xfree(scsi);
-       return NULL;
+       return *wd;
 }
 
 static struct wd_state *getscsi(struct romconfig *rc)
@@ -1305,10 +1308,12 @@ static void wd_cmd_reset (struct wd_chip_state *wd, bool irq)
        }
 }
 
-static void wd_master_reset(struct wd_chip_state *wd, bool irq)
+static void wd_master_reset(struct wd_state *wd, bool irq)
 {
-       memset(wd->wdregs, 0, sizeof wd->wdregs);
-       wd_cmd_reset(wd, irq);
+       memset(wd->wc.wdregs, 0, sizeof wd->wc.wdregs);
+       wd_cmd_reset(&wd->wc, false);
+       if (irq)
+               doscsistatus(wd, 0);
 }
 
 static void wd_cmd_abort (struct wd_chip_state *wd)
@@ -1660,6 +1665,7 @@ static void xt_readwrite(struct wd_state *wds, int rw)
 static void xt_command(struct wd_state *wds)
 {
        wds->wc.scsi = wds->scsis[XT_UNIT];
+       write_log(_T("XT command %02x\n"), wds->cdmac.xt_cmd[0]);
        switch (wds->cdmac.xt_cmd[0])
        {
        case XT_CMD_READ:
@@ -1676,6 +1682,7 @@ static void xt_command(struct wd_state *wds)
                break;
        case XT_CMD_FORMATBAD:
        case XT_CMD_FORMATTRK:
+       case XT_CMD_FORMATDRV:
                xt_command_done(wds);
                break;
        case XT_CMD_TESTREADY:
@@ -2680,7 +2687,7 @@ static void dmac_gvp_write_byte(struct wd_state *wd, uaecptr addr, uae_u32 b)
                        write_log(_T("gvp_s1_bput_s1 %04X=%04X PC=%08X\n"), addr, b & 255, M68K_GETPC);
 #endif
                        if (!(wd->gdmac.cntr & 8) && (b & 8))
-                               wd_master_reset(&wd->wc, true);
+                               wd_master_reset(wd, true);
                        wd->gdmac.cntr = b;
                        break;
                
@@ -3295,10 +3302,10 @@ void init_wd_scsi (struct wd_state *wd)
 
 void a3000_add_scsi_unit (int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       struct wd_state *wd = allocscsi(&wd_a3000, rc);
+       struct wd_state *wd = allocscsi(&wd_a3000, rc, ch);
        if (!wd || ch < 0)
                return;
-       add_scsi_device(&wd->scsis[ch], ch, ci, rc, 2);
+       add_scsi_device(&wd->scsis[ch], ch, ci, rc);
 }
 
 void a3000scsi_reset (void)
@@ -3332,26 +3339,26 @@ void a3000scsi_free (void)
 
 void a2090_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       struct wd_state *wd = allocscsi(&wd_a2090[ci->controller_type_unit], rc);
+       struct wd_state *wd = allocscsi(&wd_a2090[ci->controller_type_unit], rc, ch);
        if (!wd || ch < 0)
                return;
-       add_scsi_device(&wd->scsis[ch], ch, ci, rc, 1);
+       add_scsi_device(&wd->scsis[ch], ch, ci, rc);
 }
 
 void a2091_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       struct wd_state *wd = allocscsi(&wd_a2091[ci->controller_type_unit], rc);
+       struct wd_state *wd = allocscsi(&wd_a2091[ci->controller_type_unit], rc, ch);
        if (!wd || ch < 0)
                return;
-       add_scsi_device(&wd->scsis[ch], ch, ci, rc, 1);
+       add_scsi_device(&wd->scsis[ch], ch, ci, rc);
 }
 
 void gvp_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       struct wd_state *wd = allocscsi(&wd_gvp[ci->controller_type_unit], rc);
+       struct wd_state *wd = allocscsi(&wd_gvp[ci->controller_type_unit], rc, ch);
        if (!wd || ch < 0)
                return;
-       add_scsi_device(&wd->scsis[ch], ch, ci, rc, 2);
+       add_scsi_device(&wd->scsis[ch], ch, ci, rc);
 }
 
 void a2091_free_device (struct wd_state *wd)
@@ -3717,10 +3724,10 @@ addrbank *gvp_init_accelerator(struct romconfig *rc)
 
 void cdtv_add_scsi_unit (int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       struct wd_state *wd = allocscsi(&wd_cdtv, rc);
+       struct wd_state *wd = allocscsi(&wd_cdtv, rc, ch);
        if (!wd || ch < 0)
                return;
-       add_scsi_device(&wd_cdtv->scsis[ch], ch, ci, rc, 1);
+       add_scsi_device(&wd_cdtv->scsis[ch], ch, ci, rc);
 }
 
 
index 6565b663ecfa40ad5c8659bd455a969be85b88cc..12d392d64a2d42bf575d5e79682bc9a835033535 100644 (file)
@@ -867,16 +867,38 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f)
                                ci->devname ? ci->devname : _T(""), str1b, str2b[0] ? _T(":") : _T(""), str2b,
                                ci->sectors, ci->surfaces, ci->reserved, ci->blocksize,
                                bp, ci->filesys ? ci->filesys : _T(""), hdcs);
-                       if (ci->highcyl) {
+                       if (ci->highcyl || ci->physical_geometry) {
                                TCHAR *s = tmp + _tcslen (tmp);
                                TCHAR *s2 = s;
                                _stprintf (s2, _T(",%d"), ci->highcyl);
-                               if (ci->pcyls && ci->pheads && ci->psecs) {
+                               if (ci->physical_geometry && ci->pheads && ci->psecs) {
                                        TCHAR *s = tmp + _tcslen (tmp);
                                        _stprintf (s, _T(",%d/%d/%d"), ci->pcyls, ci->pheads, ci->psecs);
                                }
                                _tcscat (tmp3, s2);
                        }
+                       if (ci->controller_media_type) {
+                               _tcscat(tmp, _T(",CF"));
+                               _tcscat(tmp3, _T(",CF"));
+                       }
+                       TCHAR *extras = NULL;
+                       if (ct >= HD_CONTROLLER_TYPE_SCSI_FIRST && ct <= HD_CONTROLLER_TYPE_SCSI_LAST) {
+                               if (ci->unit_feature_level == 0) {
+                                       extras = _T("SCSI1");
+                               }
+                       } else if (ct >= HD_CONTROLLER_TYPE_IDE_FIRST && ct <= HD_CONTROLLER_TYPE_IDE_LAST) {
+                               if (ci->unit_feature_level == 0) {
+                                       extras = _T("ATA1");
+                               } else if (ci->unit_feature_level == 2) {
+                                       extras = _T("ATA2+S");
+                               }
+                       }
+                       if (extras) {
+                               _tcscat(tmp, _T(","));
+                               _tcscat(tmp3, _T(","));
+                               _tcscat(tmp, extras);
+                               _tcscat(tmp3, extras);
+                       }
                        if (ci->type == UAEDEV_HDF)
                                cfgfile_write_str (f, _T("hardfile2"), tmp);
 #if 0
@@ -2006,20 +2028,32 @@ static int getintval (TCHAR **p, int *result, int delim)
        return 1;
 }
 
-static int getintval2 (TCHAR **p, int *result, int delim)
+static int getintval2 (TCHAR **p, int *result, int delim, bool last)
 {
        TCHAR *value = *p;
        int base = 10;
        TCHAR *endptr;
-       TCHAR *p2 = _tcschr (*p, delim);
-
+       TCHAR *p2;
+       
+       p2 = _tcschr (*p, delim);
        if (p2 == 0) {
-               p2 = _tcschr (*p, 0);
-               if (p2 == 0) {
-                       *p = 0;
+               if (last) {
+                       if (delim != '.')
+                               p2 = _tcschr (*p, ',');
+                       if (p2 == 0) {
+                               p2 = *p;
+                               while(*p2)
+                                       p2++;
+                               if (p2 == *p)
+                                       return 0;
+                       }
+               } else {
                        return 0;
                }
        }
+       if (!_istdigit(**p))
+               return 0;
+
        if (*p2 != 0)
                *p2++ = '\0';
 
@@ -2036,6 +2070,85 @@ static int getintval2 (TCHAR **p, int *result, int delim)
        return 1;
 }
 
+static bool cfgfile_option_find(TCHAR *s, const TCHAR *option)
+{
+       TCHAR buf[MAX_DPATH];
+       if (!s)
+               return false;
+       _tcscpy(buf, s);
+       _tcscat(buf, _T(","));
+       TCHAR *p = buf;
+       for (;;) {
+               TCHAR *tmpp = _tcschr (p, ',');
+               if (tmpp == NULL)
+                       return false;
+               *tmpp++ = 0;
+               if (!strcasecmp(p, option)) {
+                       return true;
+               }
+               p = tmpp;
+       }
+}
+
+static int cfgfile_option_select(TCHAR *s, const TCHAR *option, const TCHAR *select)
+{
+       TCHAR buf[MAX_DPATH];
+       if (!s)
+               return -1;
+       _tcscpy(buf, s);
+       _tcscat(buf, _T(","));
+       TCHAR *p = buf;
+       for (;;) {
+               TCHAR *tmpp = _tcschr (p, ',');
+               if (tmpp == NULL)
+                       return -1;
+               *tmpp++ = 0;
+               TCHAR *tmpp2 = _tcschr(p, '=');
+               if (!tmpp2)
+                       return -1;
+               *tmpp2++ = 0;
+               if (!strcasecmp(p, option)) {
+                       int idx = 0;
+                       while (select[0]) {
+                               if (!strcasecmp(select, tmpp2))
+                                       return idx;
+                               idx++;
+                               select += _tcslen(select) + 1;
+                       }
+               }
+               p = tmpp;
+       }
+}
+
+static int cfgfile_option_bool(TCHAR *s, const TCHAR *option)
+{
+       TCHAR buf[MAX_DPATH];
+       if (!s)
+               return -1;
+       _tcscpy(buf, s);
+       _tcscat(buf, _T(","));
+       TCHAR *p = buf;
+       for (;;) {
+               TCHAR *tmpp = _tcschr (p, ',');
+               if (tmpp == NULL)
+                       return -1;
+               *tmpp++ = 0;
+               TCHAR *tmpp2 = _tcschr(p, '=');
+               if (tmpp2)
+                       *tmpp2++ = 0;
+               if (!strcasecmp(p, option)) {
+                       TCHAR *tmpp3 = _tcschr (tmpp2, ',');
+                       if (tmpp3)
+                               *tmpp3 = 0;
+                       if (tmpp2 && !strcasecmp(tmpp2, _T("true")))
+                               return 1;
+                       if (tmpp2 && !strcasecmp(tmpp2, _T("false")))
+                               return 0;
+                       return 1;
+               }
+               p = tmpp;
+       }
+}
 static void set_chipset_mask (struct uae_prefs *p, int val)
 {
        p->chipset_mask = (val == 0 ? 0
@@ -3192,9 +3305,9 @@ static void parse_addmem (struct uae_prefs *p, TCHAR *buf, int num)
 {
        int size = 0, addr = 0;
 
-       if (!getintval2 (&buf, &addr, ','))
+       if (!getintval2 (&buf, &addr, ',', false))
                return;
-       if (!getintval2 (&buf, &size, 0))
+       if (!getintval2 (&buf, &size, 0, true))
                return;
        if (addr & 0xffff)
                return;
@@ -3513,7 +3626,7 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, int type, TCHA
                        || ! getintval (&tmpp, &uci.reserved, ',')
                        || ! getintval (&tmpp, &uci.blocksize, ','))
                        goto invalid_fs;
-               if (getintval2 (&tmpp, &uci.bootpri, ',')) {
+               if (getintval2 (&tmpp, &uci.bootpri, ',', false)) {
                        tmpp2 = tmpp;
                        tmpp = _tcschr (tmpp, ',');
                        if (tmpp != 0) {
@@ -3524,12 +3637,36 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, int type, TCHA
                                        *tmpp2++ = 0;
                                get_filesys_controller (tmpp, &uci.controller_type, &uci.controller_type_unit, &uci.controller_unit);
                                if (tmpp2) {
-                                       if (getintval2 (&tmpp2, &uci.highcyl, ',')) {
+                                       if (getintval2 (&tmpp2, &uci.highcyl, ',', false)) {
                                                getintval (&tmpp2, &uci.pcyls, '/');
                                                getintval (&tmpp2, &uci.pheads, '/');
-                                               getintval2 (&tmpp2, &uci.psecs, '/');
+                                               getintval2 (&tmpp2, &uci.psecs, '/', true);
+                                               if (uci.pheads && uci.psecs) {
+                                                       uci.physical_geometry = true;
+                                               } else {
+                                                       uci.pheads = uci.psecs = uci.pcyls = 0;
+                                                       uci.physical_geometry = false;
+                                               }
                                        }
                                }
+                               uci.controller_media_type = 0;
+                               uci.unit_feature_level = 1;
+
+                               if (cfgfile_option_find(tmpp2, _T("CF")))
+                                       uci.controller_media_type = 1;
+                               else if (cfgfile_option_find(tmpp2, _T("HD")))
+                                       uci.controller_media_type = 0;
+
+                               if (cfgfile_option_find(tmpp2, _T("SCSI2")))
+                                       uci.unit_feature_level = 1;
+                               else if (cfgfile_option_find(tmpp2, _T("SCSI1")))
+                                       uci.unit_feature_level = 0;
+                               else if (cfgfile_option_find(tmpp2, _T("ATA2+S")))
+                                       uci.unit_feature_level = 2;
+                               else if (cfgfile_option_find(tmpp2, _T("ATA2+")))
+                                       uci.unit_feature_level = 1;
+                               else if (cfgfile_option_find(tmpp2, _T("ATA1")))
+                                       uci.unit_feature_level = 0;
                        }
                }
                if (type == 2) {
@@ -3743,80 +3880,6 @@ bool cfgfile_board_enabled(struct uae_prefs *p, int romtype, int devnum)
        return brc->roms[idx].romfile[0] != 0;
 }
 
-static bool cfgfile_option_find(TCHAR *s, const TCHAR *option)
-{
-       TCHAR buf[MAX_DPATH];
-       _tcscpy(buf, s);
-       _tcscat(buf, _T(","));
-       TCHAR *p = buf;
-       for (;;) {
-               TCHAR *tmpp = _tcschr (p, ',');
-               if (tmpp == NULL)
-                       return false;
-               *tmpp++ = 0;
-               if (!strcasecmp(p, option)) {
-                       return true;
-               }
-               p = tmpp;
-       }
-}
-
-static int cfgfile_option_select(TCHAR *s, const TCHAR *option, const TCHAR *select)
-{
-       TCHAR buf[MAX_DPATH];
-       _tcscpy(buf, s);
-       _tcscat(buf, _T(","));
-       TCHAR *p = buf;
-       for (;;) {
-               TCHAR *tmpp = _tcschr (p, ',');
-               if (tmpp == NULL)
-                       return -1;
-               *tmpp++ = 0;
-               TCHAR *tmpp2 = _tcschr(p, '=');
-               if (!tmpp2)
-                       return -1;
-               *tmpp2++ = 0;
-               if (!strcasecmp(p, option)) {
-                       int idx = 0;
-                       while (select[0]) {
-                               if (!strcasecmp(select, tmpp2))
-                                       return idx;
-                               idx++;
-                               select += _tcslen(select) + 1;
-                       }
-               }
-               p = tmpp;
-       }
-}
-
-static int cfgfile_option_bool(TCHAR *s, const TCHAR *option)
-{
-       TCHAR buf[MAX_DPATH];
-       _tcscpy(buf, s);
-       _tcscat(buf, _T(","));
-       TCHAR *p = buf;
-       for (;;) {
-               TCHAR *tmpp = _tcschr (p, ',');
-               if (tmpp == NULL)
-                       return -1;
-               *tmpp++ = 0;
-               TCHAR *tmpp2 = _tcschr(p, '=');
-               if (tmpp2)
-                       *tmpp2++ = 0;
-               if (!strcasecmp(p, option)) {
-                       TCHAR *tmpp3 = _tcschr (tmpp2, ',');
-                       if (tmpp3)
-                               *tmpp3 = 0;
-                       if (tmpp2 && !strcasecmp(tmpp2, _T("true")))
-                               return 1;
-                       if (tmpp2 && !strcasecmp(tmpp2, _T("false")))
-                               return 0;
-                       return 1;
-               }
-               p = tmpp;
-       }
-}
-
 static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, const TCHAR *value, struct multipath *mp)
 {
        TCHAR buf[256], buf2[MAX_DPATH], buf3[MAX_DPATH];
index 09870d06b75221da62a5a31b77d78d98c7559c18..74275766b9d3b899dbfb156966f8dbf046c63d78 100644 (file)
@@ -264,6 +264,7 @@ static int diwhigh_written;
 static unsigned int ddfstrt, ddfstop;
 static int line_cyclebased, badmode, diw_change;
 static int bplcon1_fetch;
+static int hpos_is_zero_bplcon1_hack = -1;
 
 #define SET_LINE_CYCLEBASED line_cyclebased = 2;
 
@@ -1584,6 +1585,10 @@ static void toscr_right_edge (int nbits, int fm)
                do_delays (diff, fm);
                nbits2 -= diff;
                delay_cycles = 0;
+               if (hpos_is_zero_bplcon1_hack >= 0) {
+                       compute_toscr_delay(hpos_is_zero_bplcon1_hack);
+                       hpos_is_zero_bplcon1_hack = -1;
+               }
                toscr_delay[0] -= 2;
                toscr_delay[0] &= fetchmode_mask;
                toscr_delay[1] -= 2;
@@ -4671,6 +4676,31 @@ STATIC_INLINE void COPCON (uae_u16 a)
        copcon = a;
 }
 
+static void check_copper_stop(void)
+{
+       if (copper_enabled_thisline < 0 && !((dmacon & DMA_COPPER) && (dmacon & DMA_MASTER))) {
+               copper_enabled_thisline = 0;
+               unset_special (SPCFLAG_COPPER);
+       }
+}
+
+static void copper_stop(void)
+{
+       if (copper_enabled_thisline) {
+               // let MOVE to finish
+               switch (cop_state.state)
+               {
+                       case COP_read2:
+                       copper_enabled_thisline = -1;
+                       break;
+               }
+       }
+       if (copper_enabled_thisline >= 0) {
+               copper_enabled_thisline = 0;
+               unset_special (SPCFLAG_COPPER);
+       }
+}
+
 static void DMACON (int hpos, uae_u16 v)
 {
        int oldcop, newcop;
@@ -4696,8 +4726,7 @@ static void DMACON (int hpos, uae_u16 v)
                if (newcop && !oldcop) {
                        compute_spcflag_copper (hpos);
                } else if (!newcop) {
-                       copper_enabled_thisline = 0;
-                       unset_special (SPCFLAG_COPPER);
+                       copper_stop();
                }
        }
 
@@ -6223,6 +6252,7 @@ static void update_copper (int until_hpos)
 #endif
                                cop_state.ignore_next = 0;
                        }
+                       check_copper_stop();
                        break;
 
                case COP_wait1:
@@ -7623,6 +7653,16 @@ static void hsync_handler_pre (bool onvsync)
 
        if (!nocustom ()) {
                sync_copper_with_cpu (maxhpos, 0);
+
+               // Seven Seas scrolling quick fix hack
+               // checks if copper is going to modify BPLCON1 in next cycle.
+               if (copper_enabled_thisline && cop_state.state == COP_read2 && (cop_state.i1 & 0x1fe) == 0x102) {
+                       // it did, pre-load value for Denise shifter emulation
+                       hpos_is_zero_bplcon1_hack = chipmem_wget_indirect(cop_state.ip);
+                       // following finish_decision() is going to finish this line
+                       // it is too late when copper actually does the move
+               }
+
                finish_decisions ();
                if (thisline_decision.plfleft >= 0) {
                        if (currprefs.collision_level > 1)
index fb8319e01f5946297b9ce213c913356c99ed8fcc..7470d4bd48f266f2226013fdc3ed8fb4ba972c74 100644 (file)
@@ -2326,7 +2326,7 @@ const struct expansionromtype expansionroms[] = {
        },
        {
                _T("adide"), _T("AdIDE"), _T("ICD"),
-               adide_init, adide_add_ide_unit, ROMTYPE_ADIDE, 0, 0, 2, false,
+               adide_init, adide_add_ide_unit, ROMTYPE_ADIDE | ROMTYPE_NONE, 0, 0, 2, false,
                NULL, 0,
                true, EXPANSIONTYPE_IDE
        },
@@ -2356,14 +2356,37 @@ const struct expansionromtype expansionroms[] = {
                _T("kommos"), _T("A500/A2000 SCSI"), _T("Jürgen Kommos"),
                kommos_init, kommos_add_scsi_unit, ROMTYPE_KOMMOS, 0, 0, 1, true,
                NULL, 0,
-               false, EXPANSIONTYPE_SCSI,
+               false, EXPANSIONTYPE_SCSI
        },
        {
                _T("vector"), _T("Vector Falcon 8000"), _T("HK-Computer"),
                vector_init, vector_add_scsi_unit, ROMTYPE_VECTOR, 0, 0, 2, false,
                NULL, 0,
+               false, EXPANSIONTYPE_SCSI
+       },
+       {
+               _T("add500"), _T("ADD-500"), _T("Archos"),
+               add500_init, add500_add_scsi_unit, ROMTYPE_ADD500, 0, 0, 2, false,
+               NULL, 0,
                false, EXPANSIONTYPE_SCSI,
+               8498, 27, 0,
        },
+       {
+               _T("adscsi2000"), _T("AdSCSI Advantage 2000"), _T("ICD"),
+               adscsi_init, adscsi_add_scsi_unit, ROMTYPE_ADSCSI, 0, 0, 2, false,
+               NULL, 0,
+               false, EXPANSIONTYPE_SCSI
+       },
+#if 0
+       {
+               _T("kronos"), _T("Kronos"), _T("C-Ltd"),
+               kronos_init, kronos_add_scsi_unit, ROMTYPE_KRONOS, 0, 0, 2, false,
+               NULL, 0,
+               false, EXPANSIONTYPE_SCSI,
+               0, 0, 0,
+               { 0xd1, 4, 0x00, 0x00, 0x03, 0xec, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 },
+       },
+#endif
        {
                _T("amax"), _T("AMAX ROM dongle"), _T("ReadySoft"),
                NULL, 0, NULL, NULL, ROMTYPE_AMAX | ROMTYPE_NONE, 0, 0, 0, false
index c97d71f4902f24a18be9cdc140c524d7bcb8b446..d7b90c180773a79447686e4b4edba670d36c13ef 100644 (file)
@@ -824,11 +824,45 @@ static void add_cpuboard_unit_init(void)
        }
 }
 
+
+static bool ismainboardide(void)
+{
+       return currprefs.cs_ide != 0;
+}
+static bool isa3000scsi(void)
+{
+       return currprefs.cs_mbdmac == 1;
+}
+static bool isa4000tscsi(void)
+{
+       return currprefs.cs_mbdmac == 2;
+}
+static bool iscdtvscsi(void)
+{
+       return currprefs.cs_cdtvscsi != 0;
+}
+// this needs better implementation.
+static void add_mainboard_unit_init(void)
+{
+       if (ismainboardide()) {
+               gayle_add_ide_unit(-1, NULL);
+       }
+       if (isa3000scsi()) {
+               a3000_add_scsi_unit(-1, NULL, NULL);
+       }
+       if (isa4000tscsi()) {
+               a4000t_add_scsi_unit(-1, NULL, NULL);
+       }
+       if (iscdtvscsi()) {
+               cdtv_add_scsi_unit(-1, NULL, NULL);
+       }
+}
+
 static bool add_ide_unit(int type, int unit, struct uaedev_config_info *uci)
 {
        bool added = false;
        if (type == HD_CONTROLLER_TYPE_IDE_MB) {
-               if (currprefs.cs_ide) {
+               if (ismainboardide()) {
                        gayle_add_ide_unit(unit, uci);
                        added = true;
                }
@@ -856,21 +890,21 @@ static bool add_scsi_unit(int type, int unit, struct uaedev_config_info *uci)
        bool added = false;
        if (type == HD_CONTROLLER_TYPE_SCSI_A3000) {
 #ifdef A2091
-               if (currprefs.cs_mbdmac == 1) {
+               if (isa3000scsi()) {
                        a3000_add_scsi_unit (unit, uci, NULL);
                        added = true;
                }
 #endif
        } else if (type == HD_CONTROLLER_TYPE_SCSI_A4000T) {
 #ifdef NCR
-               if (currprefs.cs_mbdmac == 2) {
+               if (isa4000tscsi()) {
                        a4000t_add_scsi_unit (unit, uci, NULL);
                        added = true;
                }
 #endif
        } else if (type == HD_CONTROLLER_TYPE_SCSI_CDTV) {
 #ifdef CDTV
-               if (currprefs.cs_cdtvscsi) {
+               if (iscdtvscsi()) {
                        cdtv_add_scsi_unit (unit, uci, NULL);
                        added = true;
                }
@@ -952,6 +986,7 @@ static void initialize_mountinfo (void)
        }
 
        // init all controllers first
+       add_mainboard_unit_init();
        add_cpuboard_unit_init();
        for (int i = 0; expansionroms[i].name; i++) {
                const struct expansionromtype *ert = &expansionroms[i];
index b9705af94b68d7818711e753bdbac2e60815f513..952400161a039a02527a09481180b1085a2798e9 100644 (file)
@@ -399,7 +399,7 @@ int hdf_hd_open (struct hd_hardfiledata *hfd)
        struct uaedev_config_info *ci = &hfd->hfd.ci;
        if (hdf_open (&hfd->hfd) <= 0)
                return 0;
-       if (ci->pcyls && ci->pheads && ci->psecs) {
+       if (ci->physical_geometry) {
                hfd->cyls = ci->pcyls;
                hfd->heads = ci->pheads;
                hfd->secspertrack = ci->psecs;
@@ -1458,11 +1458,18 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
        case 0x37: /* READ DEFECT DATA */
                if (nodisk (hfd))
                        goto nodisk;
+               scsi_len = lr = 4;
+               r[0] = 0;
+               r[1] = cmdbuf[1] & 0x1f;
+               r[2] = 0;
+               r[3] = 0;
+#if 0
                status = 2; /* CHECK CONDITION */
                s[0] = 0x70;
                s[2] = 0; /* NO SENSE */
                s[12] = 0x1c; /* DEFECT LIST NOT FOUND */
                ls = 0x12;
+#endif
                break;
 readprot:
                status = 2; /* CHECK CONDITION */
diff --git a/ide.cpp b/ide.cpp
index eec552494a7c8cf15e54ce845953e148cb5985a6..cfab87d53454020e4aa8686247bbed02505d6f01 100644 (file)
--- a/ide.cpp
+++ b/ide.cpp
@@ -143,8 +143,6 @@ uae_u16 adide_encode_word(uae_u16 w)
        return o;
 }
 
-
-
 static void ide_grow_buffer(struct ide_hdf *ide, int newsize)
 {
        if (ide->secbuf_size >= newsize)
@@ -161,10 +159,10 @@ static void ide_grow_buffer(struct ide_hdf *ide, int newsize)
 
 static void pw (struct ide_hdf *ide, int offset, uae_u16 w)
 {
-       if (ide->adide)
-               w = adide_decode_word(w);
        if (ide->byteswap)
                w = (w >> 8) | (w << 8);
+       if (ide->adide)
+               w = adide_decode_word(w);
        ide->secbuf[offset * 2 + 0] = (uae_u8)w;
        ide->secbuf[offset * 2 + 1] = w >> 8;
 }
@@ -183,7 +181,14 @@ static void ps (struct ide_hdf *ide, int offset, const TCHAR *src, int max)
                char c2 = ' ';
                if (i + 1 < len)
                        c2 = s[i + 1];
-               pw(ide, offset + i / 2, (c2 << 8) | c1);
+               uae_u16 w = (c1 << 0) | (c2 << 8);
+               if (ide->byteswap)
+                       w = (w >> 8) | (w << 8);
+               if (ide->adide)
+                       w = adide_decode_word(w);
+               ide->secbuf[offset * 2 + 0] = w >> 8;
+               ide->secbuf[offset * 2 + 1] = w >> 0;
+               offset++;
        }
        xfree (s);
 }
@@ -305,6 +310,7 @@ static void ide_identify_drive (struct ide_hdf *ide)
        uae_u8 *buf = ide->secbuf;
        TCHAR tmp[100];
        bool atapi = ide->atapi;
+       bool cf = ide->media_type > 0;
 
        if (!ide_isdrive (ide)) {
                ide_fail (ide);
@@ -315,7 +321,7 @@ static void ide_identify_drive (struct ide_hdf *ide)
                write_log (_T("IDE%d identify drive\n"), ide->num);
        ide_data_ready (ide);
        ide->direction = 0;
-       pw (ide, 0, atapi ? 0x85c0 : 1 << 6);
+       pw (ide, 0, atapi ? 0x85c0 : (cf ? 0x848a : (1 << 6)));
        pw (ide, 1, ide->hdhfd.cyls_def);
        pw (ide, 2, 0xc837);
        pw (ide, 3, ide->hdhfd.heads_def);
@@ -326,7 +332,7 @@ static void ide_identify_drive (struct ide_hdf *ide)
        pw (ide, 20, 3);
        pw (ide, 21, ide->blocksize);
        pw (ide, 22, 4);
-       ps (ide, 23, _T("0.6"), 8); /* firmware revision */
+       ps (ide, 23, _T("0.7"), 8); /* firmware revision */
        if (ide->atapi)
                _tcscpy (tmp, _T("UAE-ATAPI"));
        else
@@ -353,27 +359,29 @@ static void ide_identify_drive (struct ide_hdf *ide)
        pw (ide, 61, (uae_u16)(totalsecs >> 16));
        pw (ide, 62, 0x0f);
        pw (ide, 63, 0x0f);
-       pw (ide, 64, 0x03); /* PIO3 and PIO4 */
-       pw (ide, 65, 120); /* MDMA2 supported */
-       pw (ide, 66, 120);
-       pw (ide, 67, 120);
-       pw (ide, 68, 120);
-       pw (ide, 80, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)); /* ATA-1 to ATA-6 */
-       pw (ide, 81, 0x1c); /* ATA revision */
-       pw (ide, 82, (1 << 14) | (atapi ? 0x10 | 4 : 0)); /* NOP, ATAPI: PACKET and Removable media features supported */
-       pw (ide, 83, (1 << 14) | (1 << 13) | (1 << 12) | (ide->lba48 ? (1 << 10) : 0)); /* cache flushes, LBA 48 supported */
-       pw (ide, 84, 1 << 14);
-       pw (ide, 85, 1 << 14);
-       pw (ide, 86, (1 << 14) | (1 << 13) | (1 << 12) | (ide->lba48 ? (1 << 10) : 0)); /* cache flushes, LBA 48 enabled */
-       pw (ide, 87, 1 << 14);
-       pw (ide, 88, (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | (1 << 0)); /* UDMA modes */
-       pw (ide, 93, (1 << 14) | (1 << 13) | (1 << 0));
-       if (ide->lba48) {
-               totalsecs = ide->hdhfd.size / ide->blocksize;
-               pw (ide, 100, (uae_u16)(totalsecs >> 0));
-               pw (ide, 101, (uae_u16)(totalsecs >> 16));
-               pw (ide, 102, (uae_u16)(totalsecs >> 32));
-               pw (ide, 103, (uae_u16)(totalsecs >> 48));
+       if (ide->ata_level) {
+               pw (ide, 64, ide->ata_level ? 0x03 : 0x00); /* PIO3 and PIO4 */
+               pw (ide, 65, 120); /* MDMA2 supported */
+               pw (ide, 66, 120);
+               pw (ide, 67, 120);
+               pw (ide, 68, 120);
+               pw (ide, 80, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)); /* ATA-1 to ATA-6 */
+               pw (ide, 81, 0x1c); /* ATA revision */
+               pw (ide, 82, (1 << 14) | (atapi ? 0x10 | 4 : 0)); /* NOP, ATAPI: PACKET and Removable media features supported */
+               pw (ide, 83, (1 << 14) | (1 << 13) | (1 << 12) | (ide->lba48 ? (1 << 10) : 0)); /* cache flushes, LBA 48 supported */
+               pw (ide, 84, 1 << 14);
+               pw (ide, 85, 1 << 14);
+               pw (ide, 86, (1 << 14) | (1 << 13) | (1 << 12) | (ide->lba48 ? (1 << 10) : 0)); /* cache flushes, LBA 48 enabled */
+               pw (ide, 87, 1 << 14);
+               pw (ide, 88, (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | (1 << 0)); /* UDMA modes */
+               pw (ide, 93, (1 << 14) | (1 << 13) | (1 << 0));
+               if (ide->lba48) {
+                       totalsecs = ide->hdhfd.size / ide->blocksize;
+                       pw (ide, 100, (uae_u16)(totalsecs >> 0));
+                       pw (ide, 101, (uae_u16)(totalsecs >> 16));
+                       pw (ide, 102, (uae_u16)(totalsecs >> 32));
+                       pw (ide, 103, (uae_u16)(totalsecs >> 48));
+               }
        }
 }
 
@@ -735,7 +743,10 @@ static void do_process_rw_command (struct ide_hdf *ide)
        }
        ide->intdrq = true;
        last = dec_nsec (ide, nsec) == 0;
-       put_lbachs (ide, lba, cyl, head, sec, last ? nsec - 1 : nsec);
+       // ATA-2 spec says CHS/LBA does only need to be updated if error condition
+       if (ide->ata_level != 2 || !last) {
+               put_lbachs (ide, lba, cyl, head, sec, last ? nsec - 1 : nsec);
+       }
        if (last && ide->direction) {
                ide->intdrq = false;
                if (IDE_LOG > 1)
@@ -1273,6 +1284,10 @@ struct ide_hdf *add_ide_unit (struct ide_hdf **idetable, int max, int ch, struct
                ide->lba48 = ide->hdhfd.size >= 128 * (uae_u64)0x40000000 ? 1 : 0;
                gui_flicker_led (LED_HD, ch, -1);
                ide->cd_unit_num = -1;
+               ide->media_type = ci->controller_media_type;
+               ide->ata_level = ci->unit_feature_level;
+               if (!ide->ata_level && (ide->hdhfd.size >= 4 * (uae_u64)0x40000000 || ide->media_type))
+                       ide->ata_level = 1;
 
                write_log (_T("IDE%d HD '%s', LCHS=%d/%d/%d. PCHS=%d/%d/%d %uM. LBA48=%d\n"),
                        ch, ide->hdhfd.hfd.ci.rootdir,
index 973d1ba381c47bad5a6e25028076646935847e4d..f9b4069bfebc4fac96970662d2093fcb4a6c719b 100644 (file)
@@ -1244,26 +1244,28 @@ addrbank *adide_init(struct romconfig *rc)
        ide->rom = xcalloc(uae_u8, ide->rom_size);
        memset(ide->rom, 0xff, ide->rom_size);
        ide->rom_mask = ide->rom_size - 1;
-       struct zfile *z = read_device_from_romconfig(rc, roms);
+       if (!rc->autoboot_disabled) {
+               struct zfile *z = read_device_from_romconfig(rc, roms);
+               if (z) {
+                       for (int i = 0; i < 16384; i++) {
+                               uae_u8 b;
+                               zfile_fread(&b, 1, 1, z);
+                               ide->rom[i * 2 + 0] = b;
+                               ide->rom[i * 2 + 1] = 0xff;
+                       }
+                       zfile_fclose(z);
+               }
+       }
        for (int i = 0; i < 16; i++) {
                uae_u8 b = adide_autoconfig[i];
                ew(ide, i * 4, b);
        }
-       if (z) {
-               for (int i = 0; i < 16384; i++) {
-                       uae_u8 b;
-                       zfile_fread(&b, 1, 1, z);
-                       ide->rom[i * 2 + 0] = b;
-                       ide->rom[i * 2 + 1] = 0xff;
-               }
-               zfile_fclose(z);
-       }
        return ide->bank;
 }
 
 void adide_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       add_ide_standard_unit(ch, ci, rc, adide_board, ADIDE_IDE, true, true);
+       add_ide_standard_unit(ch, ci, rc, adide_board, ADIDE_IDE, false, true);
 }
 
 addrbank *mtec_init(struct romconfig *rc)
index c1edf0f874d85cb81b02d98df4daa233bd40717a..a88b47d85d35ed13fc22e95661c8b6715e336569 100644 (file)
@@ -72,7 +72,9 @@ struct ide_hdf
        int num;
        int blocksize;
        int maxtransferstate;
+       int ata_level;
        int ide_drv;
+       int media_type;
 
        bool atapi;
        bool atapi_drdy;
index 7df9e0a70045662465a6a933c7ae6806db7b3b32..ff7993c82112e310cbca1b5de1292b8c864495a1 100644 (file)
@@ -156,7 +156,9 @@ struct uaedev_config_info {
        int controller_type;
        int controller_type_unit;
        int controller_unit;
-       // zero if default
+       int controller_media_type; // 1 = CF IDE, 0 = normal
+       int unit_feature_level;
+       bool physical_geometry; // if false: use defaults
        int pcyls, pheads, psecs;
        int flags;
        int buffers;
index 4009333593dfc3f05491e6cf8e7f200e3cf99ae7..8ec7909d8acab720066cd26c6ba39dd668996630 100644 (file)
@@ -64,6 +64,9 @@ extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size);
 #define ROMTYPE_ADIDE          0x00100014
 #define ROMTYPE_MTEC           0x00100015
 #define ROMTYPE_PROTAR         0x00100016
+#define ROMTYPE_ADD500         0x00100017
+#define ROMTYPE_KRONOS         0x00100018
+#define ROMTYPE_ADSCSI         0x00100019
 
 #define ROMTYPE_QUAD           0x01000000
 #define ROMTYPE_EVEN           0x02000000
index 58ecc4abb066d7c53cb1b45e08c9bd1b42298950..99487fa46129937409d7cce809c6e71a65d3c1da 100644 (file)
@@ -72,8 +72,8 @@ extern struct scsi_data_tape *tape_alloc (int unitnum, const TCHAR *tape_directo
 extern void tape_free (struct scsi_data_tape*);
 extern void tape_media_change (int unitnum, struct uaedev_config_info*);
 
-int add_scsi_device(struct scsi_data **sd, int ch, struct uaedev_config_info *ci, struct romconfig *rc, int scsi_level);
-int add_scsi_hd (struct scsi_data **sd, int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci, int scsi_level);
+int add_scsi_device(struct scsi_data **sd, int ch, struct uaedev_config_info *ci, struct romconfig *rc);
+int add_scsi_hd (struct scsi_data **sd, int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci);
 int add_scsi_cd (struct scsi_data **sd, int ch, int unitnum);
 int add_scsi_tape (struct scsi_data **sd, int ch, const TCHAR *tape_directory, bool readonly);
 void free_scsi (struct scsi_data *sd);
@@ -174,3 +174,12 @@ void vector_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfi
 
 addrbank *protar_init(struct romconfig *rc);
 void protar_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
+
+addrbank *add500_init(struct romconfig *rc);
+void add500_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
+
+addrbank *kronos_init(struct romconfig *rc);
+void kronos_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
+
+addrbank *adscsi_init(struct romconfig *rc);
+void adscsi_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
index 56e6126760aef5b98449bdd1fcf59038b6bff2b5..0dca73a24eee2fa4bdd0b3ac60f1e9180911e404 100644 (file)
@@ -204,10 +204,10 @@ static struct ncr9x_state *allocscsi(struct ncr9x_state **ncr, struct romconfig
                for (int i = 0; i < MAX_NCR9X_UNITS; i++) {
                        if (ncr_units[i] == NULL) {
                                ncr_units[i] = scsi;
-                               rc->unitdata = scsi;
+                               if (rc)
+                                       rc->unitdata = scsi;
                                scsi->rc = rc;
-                               if (ncr)
-                                       *ncr = scsi;
+                               *ncr = scsi;
                                return scsi;
                        }
                }
@@ -1495,13 +1495,13 @@ void ncr9x_init(void)
 {
 }
 
-static void add_ncr_scsi_hd(struct ncr9x_state *ncr, int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci, int scsi_level)
+static void add_ncr_scsi_hd(struct ncr9x_state *ncr, int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci)
 {
        struct scsi_data *handle = NULL;
 
        freescsi(ncr->scsid[ch]);
        ncr->scsid[ch] = NULL;
-       if (!add_scsi_hd(&handle, ch, hfd, ci, scsi_level))
+       if (!add_scsi_hd(&handle, ch, hfd, ci))
                return;
        handle->privdata = ncr;
        ncr->scsid[ch] = xcalloc(SCSIDevice, 1);
@@ -1546,7 +1546,7 @@ static void ncr9x_add_scsi_unit(struct ncr9x_state **ncrp, int ch, struct uaedev
                else if (ci->type == UAEDEV_TAPE)
                        add_ncr_scsi_tape (ncr, ch, ci->rootdir, ci->readonly);
                else if (ci->type == UAEDEV_HDF)
-                       add_ncr_scsi_hd (ncr, ch, NULL, ci, 2);
+                       add_ncr_scsi_hd (ncr, ch, NULL, ci);
        }
 }
 
index 970986786cab4950de24bb19808d4995e952d001..c8f68ade07242b81726c83b685c4a1f168b0bb41 100644 (file)
@@ -125,8 +125,7 @@ static struct ncr_state *allocscsi(struct ncr_state **ncr, struct romconfig *rc,
                                if (rc)
                                        rc->unitdata = scsi;
                                scsi->rc = rc;
-                               if (ncr)
-                                       *ncr = scsi;
+                               *ncr = scsi;
                                return scsi;
                        }
                }
@@ -842,13 +841,13 @@ void ncr_reset(void)
        }
 }
 
-static void add_ncr_scsi_hd (struct ncr_state *ncr, int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci, int scsi_level)
+static void add_ncr_scsi_hd (struct ncr_state *ncr, int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci)
 {
        struct scsi_data *handle = NULL;
 
        freescsi (ncr->scsid[ch]);
        ncr->scsid[ch] = NULL;
-       if (!add_scsi_hd(&handle, ch, hfd, ci, scsi_level))
+       if (!add_scsi_hd(&handle, ch, hfd, ci))
                return;
        handle->privdata = ncr;
        ncr->scsid[ch] = xcalloc (SCSIDevice, 1);
@@ -897,7 +896,7 @@ static void ncr_add_scsi_unit(struct ncr_state **ncrp, int ch, struct uaedev_con
                else if (ci->type == UAEDEV_TAPE)
                        add_ncr_scsi_tape (ncr, ch, ci->rootdir, ci->readonly);
                else if (ci->type == UAEDEV_HDF)
-                       add_ncr_scsi_hd (ncr, ch, NULL, ci, 2);
+                       add_ncr_scsi_hd (ncr, ch, NULL, ci);
        }
 }
 
index 0e05cc09e0a8ffabe13610de35c24faec0125508..2aea16be5126e9e6a1b1fedf710742f62db07286 100644 (file)
@@ -3520,7 +3520,7 @@ static int do_specialties (int cycles)
 
                if (action_replay_flag == ACTION_REPLAY_ACTIVATE || action_replay_flag == ACTION_REPLAY_DORESET)
                        action_replay_enter ();
-               if (action_replay_flag == ACTION_REPLAY_HIDE && !is_ar_pc_in_rom ()) {
+               if ((action_replay_flag == ACTION_REPLAY_HIDE || action_replay_flag == ACTION_REPLAY_ACTIVE) && !is_ar_pc_in_rom ()) {
                        action_replay_hide ();
                        unset_special (SPCFLAG_ACTION_REPLAY);
                }
index 55b0c46625b640ada0f5b4d531697a2f0661cc70..630e0c1f6096a9ab2672e559941d63dbae4fa9a5 100644 (file)
 #define IDC_NEW_HD                      1341
 #define IDC_PORT0                       1342
 #define IDC_NEW_FSARCH                  1342
-#define IDC_NEW_FS2                     1342
 #define IDC_PORT1                       1343
 #define IDC_NEW_CD                      1344
 #define IDC_NEW_CD2                     1345
 #define IDC_SECTORS_TEXT                1370
 #define IDC_SURFACES_TEXT               1371
 #define IDC_RESERVED_TEXT               1372
-#define IDC_RESERVED_TEXT2              1373
+#define IDC_CYLINDERS_TEXT              1373
 #define IDC_BLOCKSIZE_TEXT              1374
 #define ID_OK                           1375
 #define IDC_HARDFILE_BOOTPRI_TEXT       1375
 #define IDC_HDF_DONOTMOUNT              1383
 #define IDC_HDF_DONOTMOUNT2             1384
 #define IDC_HDF_ADDFSRES                1384
+#define IDC_HDF_PHYSGEOMETRY            1385
 #define IDC_ROMFILE                     1390
 #define IDC_KEYFILE                     1391
 #define IDC_SCSIROMSELECT               1391
 #define IDC_RESETAMIGA                  1504
 #define IDC_QUITEMU                     1505
 #define IDC_HDF_CONTROLLER_UNIT         1505
+#define IDC_HDF_CONTROLLER_TYPE         1506
 #define IDC_MAPDRIVES                   1507
+#define IDC_HDF_FEATURE_LEVEL           1507
 #define IDC_CPUTEXT                     1508
 #define IDC_MAPDRIVES_NET               1508
 #define IDC_RESTARTEMU                  1508
index 70377b88f9508fd26d9271ccea469b47d59a0913..2f1d6fe05f1a337ab580d2c6e1b54eb144ba9fde 100644 (file)
@@ -578,13 +578,13 @@ BEGIN
     CONTROL         "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,296,64,11
 END
 
-IDD_HARDFILE DIALOGEX 0, 0, 396, 263
+IDD_HARDFILE DIALOGEX 0, 0, 397, 279
 STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 EXSTYLE WS_EX_ACCEPTFILES
 CAPTION "Hardfile Settings"
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
-    GROUPBOX        "Settings",IDC_STATIC,2,2,392,164
+    GROUPBOX        "Settings",IDC_STATIC,2,2,392,183
     RTEXT           "Path:",IDC_HARDFILE_DIR_TEXT,10,18,37,10
     COMBOBOX        IDC_PATH_NAME,52,15,325,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
     PUSHBUTTON      "...",IDC_SELECTOR,380,14,11,15
@@ -592,38 +592,42 @@ BEGIN
     COMBOBOX        IDC_PATH_FILESYS,51,35,325,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
     PUSHBUTTON      "...",IDC_FILESYS_SELECTOR,380,34,11,15
     RTEXT           "Device:",IDC_HARDFILE_DEVICE_TEXT,16,58,31,10
-    EDITTEXT        IDC_HARDFILE_DEVICE,52,55,121,15,ES_AUTOHSCROLL
-    PUSHBUTTON      "Enable RDB mode",IDC_HDF_RDB,285,55,92,14
-    CONTROL         "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,74,67,10
-    CONTROL         "Bootable",IDC_HDF_AUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,74,67,10
-    CONTROL         "Do not mount",IDC_HDF_DONOTMOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,217,74,67,10
-    CONTROL         "Global filesystem",IDC_HDF_ADDFSRES,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,298,74,82,10
-    RTEXT           "Boot priority:",IDC_HARDFILE_BOOTPRI_TEXT,67,94,83,10
-    EDITTEXT        IDC_HARDFILE_BOOTPRI,155,90,44,15
-    RTEXT           "Surfaces:",IDC_SURFACES_TEXT,209,94,48,10
-    EDITTEXT        IDC_HEADS,262,90,40,15,ES_NUMBER
-    RTEXT           "Reserved:",IDC_RESERVED_TEXT,307,94,50,10
-    EDITTEXT        IDC_RESERVED,362,90,28,15,ES_NUMBER
-    RTEXT           "HD Controller:",IDC_STATIC,10,94,54,10,SS_CENTERIMAGE
-    COMBOBOX        IDC_HDF_CONTROLLER,6,112,158,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
-    RTEXT           "Sectors:",IDC_SECTORS_TEXT,209,113,48,10
-    EDITTEXT        IDC_SECTORS,262,111,40,15,ES_NUMBER
-    RTEXT           "Block size:",IDC_BLOCKSIZE_TEXT,306,113,50,10
-    EDITTEXT        IDC_BLOCKSIZE,362,111,28,15,ES_NUMBER
-    EDITTEXT        IDC_HDFINFO,5,131,385,12,ES_CENTER | ES_READONLY
-    EDITTEXT        IDC_HDFINFO2,5,147,385,12,ES_CENTER | ES_READONLY
-    GROUPBOX        "New hard disk image file",IDC_STATIC,2,171,392,62
-    PUSHBUTTON      "Create",IDC_HF_CREATE,58,187,80,14
-    COMBOBOX        IDC_HF_TYPE,58,211,80,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
-    EDITTEXT        IDC_HF_SIZE,154,187,61,15,ES_NUMBER
-    LTEXT           "MB",IDC_STATIC,220,190,53,10,SS_CENTERIMAGE
-    EDITTEXT        IDC_HF_DOSTYPE,154,210,61,15
-    LTEXT           "DOS type",IDC_STATIC,222,212,51,10,SS_CENTERIMAGE
-    CONTROL         "Sparse file",IDC_HF_SPARSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,196,87,10
-    CONTROL         "Dynamic HDF",IDC_HF_DYNAMIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,208,87,10
-    PUSHBUTTON      "OK",IDOK,147,242,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,203,242,50,14
-    COMBOBOX        IDC_HDF_CONTROLLER_UNIT,173,112,25,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    EDITTEXT        IDC_HARDFILE_DEVICE,52,55,89,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "Enable RDB mode",IDC_HDF_RDB,214,109,75,14
+    CONTROL         "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,52,75,67,10
+    CONTROL         "Bootable",IDC_HDF_AUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,75,78,10
+    CONTROL         "Do not mount",IDC_HDF_DONOTMOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,52,89,67,10
+    CONTROL         "Global filesystem",IDC_HDF_ADDFSRES,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,152,89,82,10
+    RTEXT           "Boot priority:",IDC_HARDFILE_BOOTPRI_TEXT,150,57,83,10
+    EDITTEXT        IDC_HARDFILE_BOOTPRI,238,55,44,15
+    RTEXT           "Surfaces:",IDC_SURFACES_TEXT,298,76,45,10
+    EDITTEXT        IDC_HEADS,347,73,40,15,ES_NUMBER
+    RTEXT           "Reserved:",IDC_RESERVED_TEXT,297,113,46,10
+    EDITTEXT        IDC_RESERVED,347,111,40,15,ES_NUMBER
+    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
+    RTEXT           "Sectors:",IDC_SECTORS_TEXT,298,95,45,10
+    EDITTEXT        IDC_SECTORS,347,92,40,15,ES_NUMBER
+    RTEXT           "Block size:",IDC_BLOCKSIZE_TEXT,299,132,45,10
+    EDITTEXT        IDC_BLOCKSIZE,347,130,40,15,ES_NUMBER
+    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
+    PUSHBUTTON      "Create",IDC_HF_CREATE,58,206,80,14
+    COMBOBOX        IDC_HF_TYPE,58,230,80,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    EDITTEXT        IDC_HF_SIZE,154,206,61,15,ES_NUMBER
+    LTEXT           "MB",IDC_STATIC,220,209,53,10,SS_CENTERIMAGE
+    EDITTEXT        IDC_HF_DOSTYPE,154,229,61,15
+    LTEXT           "DOS type",IDC_STATIC,222,231,51,10,SS_CENTERIMAGE
+    CONTROL         "Sparse file",IDC_HF_SPARSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,215,87,10
+    CONTROL         "Dynamic HDF",IDC_HF_DYNAMIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,227,87,10
+    PUSHBUTTON      "OK",IDOK,147,258,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,203,258,50,14
+    COMBOBOX        IDC_HDF_CONTROLLER_UNIT,149,131,25,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Manual geometry",IDC_HDF_PHYSGEOMETRY,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,299,56,87,10
+    RTEXT           "Cylinders:",IDC_CYLINDERS_TEXT,300,113,43,10,NOT WS_VISIBLE
+    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
 END
 
 IDD_FILESYS DIALOGEX 15, 25, 396, 111
@@ -1439,6 +1443,7 @@ BEGIN
 
     IDD_HARDFILE, DIALOG
     BEGIN
+        RIGHTMARGIN, 396
     END
 
     IDD_FILESYS, DIALOG
index b068e5b87dd36fe23385a934d1cc4cf4f2ef1498..a7ec090af4ac3af9646acd7071361254bae57fdb 100644 (file)
 #define LANG_DLL_FULL_VERSION_MATCH 1
 
 #if WINUAEPUBLICBETA
-#define WINUAEBETA _T("12")
+#define WINUAEBETA _T("13")
 #else
 #define WINUAEBETA _T("")
 #endif
 
-#define WINUAEDATE MAKEBD(2015, 3, 14)
+#define WINUAEDATE MAKEBD(2015, 3, 21)
 
 //#define WINUAEEXTRA _T("AmiKit Preview")
 //#define WINUAEEXTRA _T("Amiga Forever Edition")
index 4ee26a99504bc8c17bf5d91fce02541d8f68360b..870e6e8273e67f0d8acf7b5f6bff2984651eb5ef 100644 (file)
@@ -1799,7 +1799,7 @@ void graphics_reset(bool forced)
        } else {
                // full reset if display size can't changed.
                if (currprefs.gfx_api) {
-                       display_change_requested = 1;
+                       display_change_requested = 3;
                } else {
                        display_change_requested = 2;
                }
@@ -1934,7 +1934,9 @@ int check_prefs_changed_gfx (void)
                }
 
                if (display_change_requested) {
-                       if (display_change_requested == 2) {
+                       if (display_change_requested == 3) {
+                               c = 1024;
+                       } else if (display_change_requested == 2) {
                                c = 512;
                        } else {
                                c = 2;
@@ -2014,6 +2016,9 @@ int check_prefs_changed_gfx (void)
                                S2X_reset ();
                        }
                }
+               if (c & 1024) {
+                       target_graphics_buffer_update();
+               }
                if (c & 512) {
                        reopen_gfx ();
                        graphics_mode_changed = 1;
index 3d74a4ca55447e8645ea6a5fdb5e455a89751c90..77be4cbf5e6ec268997ccdab3988c30e01e2e844 100644 (file)
@@ -1685,7 +1685,12 @@ static void show_rom_list (void)
                118, -1, -1, // alf+
                120, -1, -1, // masoboshi
                121, -1, -1, // supradrive
-               124, -1, -2, // kupke golem
+               124, -1, -1, // kupke golem
+               131, -1, -1, // protar
+               130, -1, -1, // m-tec
+               129, -1, -1, // adide
+               127, -1, -1, // kommos
+               128, -1, -2, // vector falcon
 
                18, -1, 19, -1, 74, 23, -1, -1,  // CD32 FMV
                91, -1, -2, // Picasso IV
@@ -1729,6 +1734,11 @@ static void show_rom_list (void)
                _T("A590/A2091 SCSI/XT\0GVP Series I SCSI\0GVP Series II SCSI\0A4091 SCSI\0Fastlane SCSI\0Oktagon 2008 SCSI\0")
                _T("AlfaPower/AT-BUS 508/2008 SCSI\0AlfaPower Plus SCSI\0Masoboshi MC-302/MC-702 IDE/SCSI\0SupraDrive SCSI\0")
                _T("Golem SCSI\0")
+               _T("Protar A500HD SCSI\0")
+               _T("M-Tec AT500 IDE\0")
+               _T("AdIDE\0")
+               _T("Kommos A500/A2000 SCSI\0")
+               _T("Vector Falcon 8000 SCSI\0")
 
                _T("CD32 Full Motion Video\0")
                _T("Picasso IV\0")
@@ -10506,6 +10516,7 @@ static void default_hfdlg (struct hfdlg_vals *f, bool rdb)
        f->ci.type = UAEDEV_HDF;
        f->ci.controller_type = ctrl;
        f->ci.controller_unit = unit;
+       f->ci.unit_feature_level = 1;
 }
 static void default_rdb_hfdlg (struct hfdlg_vals *f, const TCHAR *filename)
 {
@@ -10667,16 +10678,22 @@ static int hdmenutable[256];
 static void sethardfile (HWND hDlg)
 {
        bool rdb = is_hdf_rdb ();
+       bool physgeo = rdb && ischecked(hDlg, IDC_HDF_PHYSGEOMETRY);
+       bool enablegeo = !rdb || physgeo;
        bool disables = !rdb || (rdb && current_hfdlg.ci.controller_type == HD_CONTROLLER_TYPE_UAE);
+       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 (!disables)
                current_hfdlg.ci.bootpri = 0;
+       if (!physgeo)
+               current_hfdlg.ci.physical_geometry = false;
        SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.ci.rootdir);
        SetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys);
        SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.ci.devname);
-       SetDlgItemInt (hDlg, IDC_SECTORS, current_hfdlg.ci.sectors, FALSE);
-       SetDlgItemInt (hDlg, IDC_HEADS, current_hfdlg.ci.surfaces, FALSE);
-       SetDlgItemInt (hDlg, IDC_RESERVED, current_hfdlg.ci.reserved, FALSE);
+       SetDlgItemInt (hDlg, IDC_SECTORS, rdb ? current_hfdlg.ci.psecs : current_hfdlg.ci.sectors, FALSE);
+       SetDlgItemInt (hDlg, IDC_HEADS, rdb ? current_hfdlg.ci.pheads : current_hfdlg.ci.surfaces, FALSE);
+       SetDlgItemInt (hDlg, IDC_RESERVED, rdb ? current_hfdlg.ci.pcyls : current_hfdlg.ci.reserved, FALSE);
        SetDlgItemInt (hDlg, IDC_BLOCKSIZE, current_hfdlg.ci.blocksize, FALSE);
        SetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, current_hfdlg.ci.bootpri, TRUE);
        CheckDlgButton (hDlg, IDC_HDF_RW, !current_hfdlg.ci.readonly);
@@ -10687,9 +10704,26 @@ static void sethardfile (HWND hDlg)
        ew (hDlg, IDC_HDF_DONOTMOUNT, disables);
        hide (hDlg, IDC_HDF_AUTOBOOT, !disables);
        hide (hDlg, IDC_HDF_DONOTMOUNT, !disables);
-       ew (hDlg, IDC_HARDFILE_BOOTPRI, disables);
+       hide (hDlg, IDC_HARDFILE_BOOTPRI, !disables);
+       hide (hDlg, IDC_HARDFILE_BOOTPRI_TEXT, !disables);
+       hide (hDlg, IDC_HDF_PHYSGEOMETRY, !rdb);
+       ew(hDlg, IDC_SECTORS, enablegeo);
+       ew(hDlg, IDC_HEADS, enablegeo);
+       ew(hDlg, IDC_RESERVED, enablegeo);
+       ew(hDlg, IDC_BLOCKSIZE, enablegeo);
+       hide(hDlg, IDC_RESERVED_TEXT, rdb);
+       hide(hDlg, IDC_CYLINDERS_TEXT, !rdb);
        gui_set_string_cursor(hdmenutable, hDlg, IDC_HDF_CONTROLLER, current_hfdlg.ci.controller_type +  current_hfdlg.ci.controller_type_unit * HD_CONTROLLER_NEXT_UNIT);
        SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_unit, 0);
+       ew(hDlg, IDC_HDF_CONTROLLER_TYPE, ide);
+       ew(hDlg, IDC_HDF_FEATURE_LEVEL, ide || scsi);
+       if (!ide) {
+               current_hfdlg.ci.controller_media_type = 0;
+       }
+       if (current_hfdlg.ci.controller_media_type && current_hfdlg.ci.unit_feature_level == 0)
+               current_hfdlg.ci.unit_feature_level = 1;
+       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_TYPE, CB_SETCURSEL, current_hfdlg.ci.controller_media_type, 0);
+       SendDlgItemMessage (hDlg, IDC_HDF_FEATURE_LEVEL, CB_SETCURSEL, current_hfdlg.ci.unit_feature_level, 0);
 }
 
 static void addhdcontroller(HWND hDlg, const struct expansionromtype *erc, int *hdmenutable, int firstid)
@@ -10771,6 +10805,20 @@ static void inithdcontroller (HWND hDlg, int ctype, int ctype_unit, int devtype)
        } else {
                ew(hDlg, IDC_HDF_CONTROLLER_UNIT, FALSE);
        }
+
+       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_TYPE, CB_RESETCONTENT, 0, 0);
+       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("HD"));
+       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("CF"));
+
+       SendDlgItemMessage (hDlg, IDC_HDF_FEATURE_LEVEL, CB_RESETCONTENT, 0, 0);
+       if (ctype >= HD_CONTROLLER_TYPE_IDE_FIRST && ctype <= HD_CONTROLLER_TYPE_IDE_LAST) {
+               SendDlgItemMessage (hDlg, IDC_HDF_FEATURE_LEVEL, CB_ADDSTRING, 0, (LPARAM)_T("ATA-1"));
+               SendDlgItemMessage (hDlg, IDC_HDF_FEATURE_LEVEL, CB_ADDSTRING, 0, (LPARAM)_T("ATA-2+"));
+               SendDlgItemMessage (hDlg, IDC_HDF_FEATURE_LEVEL, CB_ADDSTRING, 0, (LPARAM)_T("ATA-2+ Strict"));
+       } else if (ctype >= HD_CONTROLLER_TYPE_SCSI_FIRST && ctype <= HD_CONTROLLER_TYPE_SCSI_LAST) {
+               SendDlgItemMessage (hDlg, IDC_HDF_FEATURE_LEVEL, CB_ADDSTRING, 0, (LPARAM)_T("SCSI-1"));
+               SendDlgItemMessage (hDlg, IDC_HDF_FEATURE_LEVEL, CB_ADDSTRING, 0, (LPARAM)_T("SCSI-2"));
+       }
 }
 
 static void inithardfile (HWND hDlg)
@@ -10820,6 +10868,7 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
        uae_u32 blocks, cyls, i;
        TCHAR tmp[200], tmp2[200];
        TCHAR idtmp[17];
+       bool phys = is_hdf_rdb();
 
        bsize = 0;
        if (force) {
@@ -10849,30 +10898,34 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
                        }
                }
                if (defaults) {
-                       if (hfd.flags & HFD_FLAGS_REALDRIVE) {
-                               if (current_hfdlg.ci.controller_type >= HD_CONTROLLER_TYPE_IDE_FIRST && current_hfdlg.ci.controller_type <= HD_CONTROLLER_TYPE_IDE_LAST) {
-                                       getchspgeometry (bsize, &current_hfdlg.ci.pcyls, &current_hfdlg.ci.pheads, &current_hfdlg.ci.psecs, true);
-                                       if (current_hfdlg.forcedcylinders == 0)
-                                               current_hfdlg.forcedcylinders = current_hfdlg.ci.pcyls;
-                               } else {
-                                       getchspgeometry (bsize, &current_hfdlg.ci.pcyls, &current_hfdlg.ci.pheads, &current_hfdlg.ci.psecs, false);
-                               }
-                       } else if (current_hfdlg.ci.blocksize && current_hfdlg.ci.sectors && current_hfdlg.ci.surfaces) {
-                               getchsgeometry_hdf (open ? &hfd : NULL, bsize, &current_hfdlg.ci.cyls, &current_hfdlg.ci.surfaces, &current_hfdlg.ci.sectors);
-                               current_hfdlg.original = 0;
-                       }
                        if (blocksize > 512) {
                                hfd.ci.blocksize = blocksize;
                        }
                }
+               if (!current_hfdlg.ci.physical_geometry) {
+                       if (current_hfdlg.ci.controller_type >= HD_CONTROLLER_TYPE_IDE_FIRST && current_hfdlg.ci.controller_type <= HD_CONTROLLER_TYPE_IDE_LAST) {
+                               getchspgeometry (bsize, &current_hfdlg.ci.pcyls, &current_hfdlg.ci.pheads, &current_hfdlg.ci.psecs, true);
+                       } else {
+                               getchspgeometry (bsize, &current_hfdlg.ci.pcyls, &current_hfdlg.ci.pheads, &current_hfdlg.ci.psecs, false);
+                       }
+               } else {
+                       current_hfdlg.forcedcylinders = current_hfdlg.ci.pcyls;
+               }
                hdf_close (&hfd);
        }
 
-       cyls = current_hfdlg.forcedcylinders;
-       if (!cyls && current_hfdlg.ci.blocksize && current_hfdlg.ci.sectors && current_hfdlg.ci.surfaces) {
-               cyls = bsize / (current_hfdlg.ci.blocksize * current_hfdlg.ci.sectors * current_hfdlg.ci.surfaces);
+       if (current_hfdlg.ci.controller_type >= HD_CONTROLLER_TYPE_IDE_FIRST && current_hfdlg.ci.controller_type <= HD_CONTROLLER_TYPE_IDE_LAST) {
+               if (!current_hfdlg.ci.unit_feature_level && bsize >= 4 * (uae_u64)0x40000000)
+                       current_hfdlg.ci.unit_feature_level = 1;
+       }
+
+       cyls = phys ? current_hfdlg.ci.pcyls : current_hfdlg.forcedcylinders;
+       int heads = phys ? current_hfdlg.ci.pheads : current_hfdlg.ci.surfaces;
+       int secs = phys ? current_hfdlg.ci.psecs : current_hfdlg.ci.sectors;
+       if (!cyls && current_hfdlg.ci.blocksize && secs && heads) {
+               cyls = bsize / (current_hfdlg.ci.blocksize * secs * heads);
        }
-       blocks = cyls * (current_hfdlg.ci.sectors * current_hfdlg.ci.surfaces);
+       blocks = cyls * (secs * heads);
        if (!blocks && current_hfdlg.ci.blocksize)
                blocks = bsize / current_hfdlg.ci.blocksize;
        for (i = 0; i < sizeof (idtmp) / sizeof (TCHAR) - 1; i++) {
@@ -10896,7 +10949,7 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
                                (double)bsize / (1024.0 * 1024.0));             
                } else {
                        _stprintf (tmp, _T("%u/%u/%u, %u/%u blocks, %.1fMB/%.1fMB"),
-                               cyls, current_hfdlg.ci.surfaces, current_hfdlg.ci.sectors,
+                               cyls, heads, secs,
                                blocks, (int)(bsize / current_hfdlg.ci.blocksize),
                                (double)blocks * 1.0 * current_hfdlg.ci.blocksize / (1024.0 * 1024.0),
                                (double)bsize / (1024.0 * 1024.0));
@@ -11114,6 +11167,16 @@ static INT_PTR CALLBACK CDDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wParam,
        return FALSE;
 }
 
+static void set_phys_cyls(HWND hDlg)
+{
+       if (ischecked(hDlg, IDC_HDF_PHYSGEOMETRY)) {
+               int v = (current_hfdlg.ci.pheads * current_hfdlg.ci.psecs * current_hfdlg.ci.blocksize);
+               current_hfdlg.ci.pcyls = v ? current_hfdlg.size / v : 0;
+               current_hfdlg.ci.physical_geometry = true;
+               SetDlgItemInt (hDlg, IDC_RESERVED, current_hfdlg.ci.pcyls, FALSE);
+       }
+}
+
 static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
        static int recursive = 0;
@@ -11121,6 +11184,7 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
        TCHAR tmp[MAX_DPATH], fs[MAX_DPATH], dev[MAX_DPATH];
        int hdctrlr, hdunit;
        int v;
+       int *p;
 
        switch (msg) {
        case WM_DROPFILES:
@@ -11129,10 +11193,11 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
 
        case WM_INITDIALOG:
                recursive++;
+               setchecked(hDlg, IDC_HDF_PHYSGEOMETRY, current_hfdlg.ci.physical_geometry);
                inithardfile (hDlg);
+               updatehdfinfo (hDlg, true, false);
                sethardfile (hDlg);
                sethfdostype (hDlg, 0);
-               updatehdfinfo (hDlg, true, false);
                setac (hDlg, IDC_PATH_NAME);
                recursive--;
                customDlgType = IDD_HARDFILE;
@@ -11197,6 +11262,20 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                                        sethardfile (hDlg);
                                }
                                break;
+                       case IDC_HDF_CONTROLLER_TYPE:
+                               posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_TYPE, CB_GETCURSEL, 0, 0);
+                               if (posn != CB_ERR) {
+                                       current_hfdlg.ci.controller_media_type = posn;
+                                       sethardfile(hDlg);
+                               }
+                               break;
+                       case IDC_HDF_FEATURE_LEVEL:
+                               posn = SendDlgItemMessage (hDlg, IDC_HDF_FEATURE_LEVEL, CB_GETCURSEL, 0, 0);
+                               if (posn != CB_ERR) {
+                                       current_hfdlg.ci.unit_feature_level = posn;
+                                       sethardfile(hDlg);
+                               }
+                               break;
                        }
                }
                switch (LOWORD (wParam)) {
@@ -11243,6 +11322,11 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                case IDCANCEL:
                        EndDialog (hDlg, 0);
                        break;
+               case IDC_HDF_PHYSGEOMETRY:
+                       current_hfdlg.ci.physical_geometry = ischecked(hDlg, IDC_HDF_PHYSGEOMETRY);
+                       updatehdfinfo(hDlg, true, false);
+                       sethardfile(hDlg);
+                       break;
                case IDC_HDF_RW:
                        current_hfdlg.ci.readonly = !ischecked (hDlg, IDC_HDF_RW);
                        break;
@@ -11266,9 +11350,6 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                        SetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, current_hfdlg.ci.bootpri, TRUE);
                        break;
                case IDC_HDF_RDB:
-                       SetDlgItemInt (hDlg, IDC_SECTORS, 0, FALSE);
-                       SetDlgItemInt (hDlg, IDC_RESERVED, 0, FALSE);
-                       SetDlgItemInt (hDlg, IDC_HEADS, 0, FALSE);
                        SetDlgItemText (hDlg, IDC_PATH_FILESYS, _T(""));
                        SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, _T(""));
                        current_hfdlg.ci.sectors = current_hfdlg.ci.reserved = current_hfdlg.ci.surfaces = 0;
@@ -11276,25 +11357,33 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                        sethardfile (hDlg);
                        break;
                case IDC_SECTORS:
-                       v = current_hfdlg.ci.sectors;
-                       current_hfdlg.ci.sectors = GetDlgItemInt (hDlg, IDC_SECTORS, NULL, FALSE);
-                       if (v != current_hfdlg.ci.sectors) {
+                       p = ischecked(hDlg, IDC_HDF_PHYSGEOMETRY) ? &current_hfdlg.ci.psecs : &current_hfdlg.ci.sectors;
+                       v = *p;
+                       *p = GetDlgItemInt (hDlg, IDC_SECTORS, NULL, FALSE);
+                       if (v != *p) {
+                               set_phys_cyls(hDlg);
                                updatehdfinfo (hDlg, true, false);
                                ew (hDlg, IDC_HDF_RDB, !is_hdf_rdb ());
                        }
                        break;
                case IDC_RESERVED:
-                       v = current_hfdlg.ci.reserved;
-                       current_hfdlg.ci.reserved = GetDlgItemInt (hDlg, IDC_RESERVED, NULL, FALSE);
-                       if (v != current_hfdlg.ci.reserved) {
+                       p = ischecked(hDlg, IDC_HDF_PHYSGEOMETRY) ? &current_hfdlg.ci.pcyls : &current_hfdlg.ci.reserved;
+                       v = *p;
+                       *p = GetDlgItemInt (hDlg, IDC_RESERVED, NULL, FALSE);
+                       if (v != *p) {
+                               if (ischecked(hDlg, IDC_HDF_PHYSGEOMETRY)) {
+                                       current_hfdlg.ci.physical_geometry = true;
+                               }
                                updatehdfinfo (hDlg, true, false);
                                ew (hDlg, IDC_HDF_RDB, !is_hdf_rdb ());
                        }
                        break;
                case IDC_HEADS:
-                       v = current_hfdlg.ci.surfaces;
-                       current_hfdlg.ci.surfaces  = GetDlgItemInt (hDlg, IDC_HEADS, NULL, FALSE);
-                       if (v != current_hfdlg.ci.surfaces) {
+                       p = ischecked(hDlg, IDC_HDF_PHYSGEOMETRY) ? &current_hfdlg.ci.pheads : &current_hfdlg.ci.surfaces;
+                       v = *p;
+                       *p = GetDlgItemInt (hDlg, IDC_HEADS, NULL, FALSE);
+                       if (v != *p) {
+                               set_phys_cyls(hDlg);
                                updatehdfinfo (hDlg, true, false);
                                ew (hDlg, IDC_HDF_RDB, !is_hdf_rdb ());
                        }
@@ -11360,6 +11449,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
                                SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_SETCURSEL, index, 0);
                                gui_set_string_cursor(hdmenutable, hDlg, IDC_HDF_CONTROLLER, current_hfdlg.ci.controller_type + current_hfdlg.ci.controller_type_unit * HD_CONTROLLER_NEXT_UNIT);
                                SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_unit, 0);
+                               SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_TYPE, CB_SETCURSEL, current_hfdlg.ci.controller_media_type, 0);
                        }
                        recursive--;
                        return TRUE;
@@ -11434,10 +11524,15 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
                                SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_unit, 0);
                        }
                } else if (LOWORD(wParam) == IDC_HDF_CONTROLLER_UNIT) {
-                       posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0);
+                       posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_GETCURSEL, 0, 0);
                        if (posn != CB_ERR) {
                                current_hfdlg.ci.controller_unit = posn;
                        }
+               } else if (LOWORD(wParam) == IDC_HDF_CONTROLLER_TYPE) {
+                       posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_TYPE, CB_GETCURSEL, 0, 0);
+                       if (posn != CB_ERR) {
+                               current_hfdlg.ci.controller_media_type = posn;
+                       }
                }
                recursive--;
                break;
index c3104229d504ec60efce174ed3f4252dc71c8ed4..7ffc3691bf6368318ed7161de98569df0ebe3ea2 100644 (file)
@@ -210,7 +210,7 @@ static INT_PTR CALLBACK DummyProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
 
 extern int full_property_sheet;
 
-struct newresource *scaleresource (struct newresource *res, HWND parent, int resize, DWORD exstyle)
+static struct newresource *scaleresource2 (struct newresource *res, HWND parent, int resize, DWORD exstyle, bool test)
 {
        DLGTEMPLATEEX *d, *s;
        DLGTEMPLATEEX_END *d2, *s2;
@@ -239,6 +239,12 @@ struct newresource *scaleresource (struct newresource *res, HWND parent, int res
        d = (DLGTEMPLATEEX*)ns->resource;
        s = (DLGTEMPLATEEX*)res->resource;
 
+       if (test) {
+               // HACK! far enough to be invisible..
+               d->x = 20000;
+               d->y = 20000;
+       }
+
        if (resize > 0) {
                d->style &= ~DS_MODALFRAME;
                d->style |= WS_THICKFRAME;
@@ -300,6 +306,11 @@ struct newresource *scaleresource (struct newresource *res, HWND parent, int res
        return ns;
 }
 
+struct newresource *scaleresource (struct newresource *res, HWND parent, int resize, DWORD exstyle)
+{
+       return scaleresource2(res, parent, resize, exstyle, false);
+}
+
 void freescaleresource (struct newresource *ns)
 {
        xfree ((void*)ns->resource);
@@ -451,7 +462,12 @@ static void getbaseunits (void)
                abort();
        }
        multx = multy = 100;
-       nr2 = scaleresource (nr, NULL, -1, 0);
+       // dialog is visible before WM_INITDIALOG in Windows 10!
+       // even when dialog does not have visible flag!
+       // last confirmed on build 10041
+       // hopefully this gets fixed before RTM..
+       bool win10bughack = osVersion.dwMajorVersion == 6 && osVersion.dwMinorVersion == 3;
+       nr2 = scaleresource2(nr, NULL, -1, 0, win10bughack);
        hwnd = CreateDialogIndirect (nr2->inst, nr2->resource, NULL, TestProc);
        if (hwnd) {
                DestroyWindow (hwnd);
index 5a22311f9ac0484e1d1583c8aaf91804fac86728..1238e94544d55ebc1958cb6337218217f6c75eb1 100644 (file)
@@ -95,7 +95,7 @@ struct romdata *getromdatabypath (const TCHAR *path)
        return NULL;
 }
 
-#define NEXT_ROM_ID 132
+#define NEXT_ROM_ID 134
 
 static struct romheader romheaders[] = {
        { _T("Freezer Cartridges"), 1 },
@@ -363,6 +363,10 @@ static struct romdata roms[] = {
        { _T("Kupke Golem 030"), 0, 0, 0, 0, _T("GOLEM030\0"), 8192, 126, 0, 0, ROMTYPE_CB_GOLEM030, 0, 0, NULL,
        0x05d473f4, 0x574ec567,0xcc67e06f,0x91dcecb9,0x8c204399,0x5fe2a09f, NULL, NULL },
 
+       { _T("ICD AdSCSI 2000"), 1, 6, 1, 6, _T("ADSCSI\0"), 32768, 133, 0, 0, ROMTYPE_ADSCSI, 0, 0, NULL,
+       0x7dba3e1f, 0x1e05f284,0xd59a1e5d,0x4e4de44e,0x6f075175,0x625cd6c0, NULL, NULL },
+       { _T("Archos ADD-500"), 1, 21, 1, 21, _T("ADD\0"), 16384, 132, 0, 0, ROMTYPE_ADD500, 0, 0, NULL,
+       0x3f4e4a74, 0x9ed96fc0,0xd6381dc3,0x3192b0af,0xdfae4b74,0x576c3a69, NULL, NULL },
        { _T("Protar A500HD"), 1, 193, 1, 193, _T("PROTAR\0"), 32768, 131, 0, 0, ROMTYPE_PROTAR, 0, 0, NULL,
        0x10c1b22c, 0x2b800cde,0x79fd559e,0xebd5e432,0xd711af3d,0x0b8ea7e9, NULL, NULL },
        { _T("M-Tec AT500"), 1, 33, 1, 33, _T("MTECAT\0"), 32768, 130, 0, 0, ROMTYPE_MTEC, 0, 0, NULL,
index b6115a574e29cda80f0b8399c89caa28086418a7..d9ff4762b45d1243eb5c3fb1cd2e7e937286eb9e 100644 (file)
--- a/scsi.cpp
+++ b/scsi.cpp
@@ -23,7 +23,7 @@
 #include "custom.h"
 
 #define SCSI_EMU_DEBUG 0
-#define RAW_SCSI_DEBUG 0
+#define RAW_SCSI_DEBUG 2
 #define NCR5380_DEBUG 0
 
 #define NCR5380_SUPRA 1
 #define NONCR_VECTOR 5
 #define NONCR_APOLLO 6
 #define NCR5380_PROTAR 7
-#define NCR_LAST 8
+#define NCR5380_ADD500 8
+#define NCR5380_KRONOS 9
+#define NCR5380_ADSCSI 10
+#define NCR_LAST 11
 
 extern int log_scsiemu;
 
@@ -438,7 +441,7 @@ void free_scsi (struct scsi_data *sd)
        scsi_free (sd);
 }
 
-int add_scsi_hd (struct scsi_data **sd, int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci, int scsi_level)
+int add_scsi_hd (struct scsi_data **sd, int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci)
 {
        free_scsi (*sd);
        *sd = NULL;
@@ -448,7 +451,7 @@ int add_scsi_hd (struct scsi_data **sd, int ch, struct hd_hardfiledata *hfd, str
        }
        if (!hdf_hd_open (hfd))
                return 0;
-       hfd->ansi_version = scsi_level;
+       hfd->ansi_version = ci->unit_feature_level + 1;
        *sd = scsi_alloc_hd (ch, hfd);
        return *sd ? 1 : 0;
 }
@@ -468,14 +471,14 @@ int add_scsi_tape (struct scsi_data **sd, int ch, const TCHAR *tape_directory, b
        return *sd ? 1 : 0;
 }
 
-int add_scsi_device(struct scsi_data **sd, int ch, struct uaedev_config_info *ci, struct romconfig *rc, int scsi_level)
+int add_scsi_device(struct scsi_data **sd, int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
        if (ci->type == UAEDEV_CD)
                return add_scsi_cd(sd, ch, ci->device_emu_unit);
        else if (ci->type == UAEDEV_TAPE)
                return add_scsi_tape(sd, ch, ci->rootdir, ci->readonly);
        else if (ci->type == UAEDEV_HDF)
-               return add_scsi_hd(sd, ch, NULL, ci, 1);
+               return add_scsi_hd(sd, ch, NULL, ci);
        return 0;
 }
 
@@ -597,6 +600,16 @@ struct soft_scsi
        uaecptr dmac_address;
        int dmac_length;
        int dmac_active;
+
+       // add500
+       uae_u16 databuffer[2];
+       bool databuffer_empty;
+
+       // kronos
+       uae_u8 *databufferptr;
+       int databuffer_size;
+       int db_read_index;
+       int db_write_index;
 };
 
 
@@ -613,6 +626,7 @@ static void soft_scsi_free_unit(struct soft_scsi *s)
                free_scsi (rs->device[j]);
                rs->device[j] = NULL;
        }
+       xfree(s->databufferptr);
        xfree(s);
 }
 
@@ -685,7 +699,19 @@ void raw_scsi_reset(struct raw_scsi *rs)
 
 extern addrbank soft_bank_generic;
 
-static void generic_soft_scsi_add(int ch, struct uaedev_config_info *ci, struct romconfig *rc, int type, int boardsize, int romsize)
+static void ew(struct soft_scsi *scsi, int addr, uae_u32 value)
+{
+       addr &= 0xffff;
+       if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) {
+               scsi->acmemory[addr] = (value & 0xf0);
+               scsi->acmemory[addr + 2] = (value & 0x0f) << 4;
+       } else {
+               scsi->acmemory[addr] = ~(value & 0xf0);
+               scsi->acmemory[addr + 2] = ~((value & 0x0f) << 4);
+       }
+}
+
+static void generic_soft_scsi_add(int ch, struct uaedev_config_info *ci, struct romconfig *rc, int type, int boardsize, int romsize, int romtype)
 {
        struct soft_scsi *ss = allocscsi(&soft_scsi_units[type * MAX_DUPLICATE_EXPANSION_BOARDS + ci->controller_type_unit], rc, ch);
        ss->type = type;
@@ -707,10 +733,24 @@ static void generic_soft_scsi_add(int ch, struct uaedev_config_info *ci, struct
                }
        }
        memset(ss->acmemory, 0xff, sizeof ss->acmemory);
+       const struct expansionromtype *ert = get_device_expansion_rom(romtype);
+       if (ert) {
+               const uae_u8 *ac = NULL;
+               if (ert->subtypes)
+                       ac = ert->subtypes[rc->subtype].autoconfig;
+               else 
+                       ac = ert->autoconfig;
+               if (ac[0]) {
+                       for (int i = 0; i < 16; i++) {
+                               uae_u8 b = ac[i];
+                               ew(ss, i * 4, b);
+                       }
+               }
+       }
        raw_scsi_reset(&ss->rscsi);
        if (ch < 0)
                return;
-       add_scsi_device(&ss->rscsi.device[ch], ch, ci, rc, 1);
+       add_scsi_device(&ss->rscsi.device[ch], ch, ci, rc);
 }
 
 void raw_scsi_busfree(struct raw_scsi *rs)
@@ -836,9 +876,6 @@ uae_u8 raw_scsi_get_data(struct raw_scsi *rs)
        switch (rs->bus_phase)
        {
                case SCSI_SIGNAL_PHASE_FREE:
-#if RAW_SCSI_DEBUG
-               write_log(_T("raw_scsi: bus free\n"));
-#endif
                v = 0;
                break;
                case SCSI_SIGNAL_PHASE_ARBIT:
@@ -1047,7 +1084,7 @@ void apollo_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig
 
 void apollo_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       generic_soft_scsi_add(ch, ci, rc, NONCR_APOLLO, -1, -1);
+       generic_soft_scsi_add(ch, ci, rc, NONCR_APOLLO, -1, -1, ROMTYPE_APOLLO);
        // make sure IDE side is also initialized
        struct uaedev_config_info ci2 = { 0 };
        apollo_add_ide_unit(-1, &ci2, rc);
@@ -1126,6 +1163,8 @@ uae_u8 ncr5380_bget(struct soft_scsi *scsi, int reg)
        struct raw_scsi *r = &scsi->rscsi;
        switch(reg)
        {
+               case 1:
+               break;
                case 4:
                {
                        uae_u8 t = raw_scsi_get_signal_phase(r);
@@ -1204,8 +1243,10 @@ void ncr5380_bput(struct soft_scsi *scsi, int reg, uae_u8 v)
                break;
                case 2:
                if ((v & 1) && !(old & 1)) { // Arbitrate
+                       r->databusoutput = false;
                        raw_scsi_set_signal_phase(r, true, false, false);
                        scsi->regs[1] |= 1 << 6; // AIP
+                       scsi->regs[1] &= ~(1 << 5); // LA
                } else if (!(v & 1) && (old & 1)) {
                        scsi->regs[1] &= ~(1 << 6);
                }
@@ -1239,18 +1280,6 @@ void ncr5380_bput(struct soft_scsi *scsi, int reg, uae_u8 v)
        ncr5380_check_phase(scsi);
 }
 
-static void ew(struct soft_scsi *scsi, int addr, uae_u32 value)
-{
-       addr &= 0xffff;
-       if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) {
-               scsi->acmemory[addr] = (value & 0xf0);
-               scsi->acmemory[addr + 2] = (value & 0x0f) << 4;
-       } else {
-               scsi->acmemory[addr] = ~(value & 0xf0);
-               scsi->acmemory[addr + 2] = ~((value & 0x0f) << 4);
-       }
-}
-
 static int suprareg(struct soft_scsi *ncr, uaecptr addr, bool write)
 {
        int reg = (addr & 0x0f) >> 1;
@@ -1290,6 +1319,31 @@ static int protarreg(struct soft_scsi *ncr, uaecptr addr)
        return reg;
 }
 
+static int add500reg(struct soft_scsi *ncr, uaecptr addr)
+{
+       int reg = -1;
+       if ((addr & 0x8048) == 0x8000) {
+               reg = 0;
+       } else if ((addr & 0x8040) == 0x8040) {
+               reg = (addr >> 1) & 7;
+       }
+       return reg;
+}
+
+static int adscsireg(struct soft_scsi *ncr, uaecptr addr, bool write)
+{
+       int reg = -1;
+       if ((addr == 0x38 || addr == 0x39) && !write) {
+               reg = 0;
+       } else if ((addr == 0x20 || addr == 0x21) && write) {
+               reg = 0;
+       } else  if (addr < 0x20) {
+               reg = (addr >> 2) & 7;
+       }
+       return reg;
+}
+
+
 static uae_u8 read_supra_dma(struct soft_scsi *ncr, uaecptr addr)
 {
        uae_u8 val = 0;
@@ -1530,10 +1584,86 @@ static uae_u32 ncr80_bget2(struct soft_scsi *ncr, uaecptr addr, int size)
                } else {
                        v = ncr->rom[addr & 65535];
                }
+
+       } else if (ncr->type == NCR5380_ADD500) {
+
+               struct raw_scsi *rs = &ncr->rscsi;
+               if (addr & 0x8000) {
+                       uae_u8 t = raw_scsi_get_signal_phase(rs);
+                       if ((addr & 0x8048) == 0x8000) {
+                               if (!(addr & 1)) {
+                                       if (t & SCSI_IO_REQ) {
+                                               ncr->databuffer[0] = ncr->databuffer[1];
+                                               ncr->databuffer[1] = raw_scsi_get_data(rs) << 8;
+                                               ncr->databuffer[1] |= raw_scsi_get_data(rs);
+                                               if (ncr->databuffer_empty) {
+                                                       ncr->databuffer[0] = ncr->databuffer[1];
+                                                       ncr->databuffer[1] = raw_scsi_get_data(rs) << 8;
+                                                       ncr->databuffer[1] |= raw_scsi_get_data(rs);
+                                               }
+                                               ncr->databuffer_empty = false;
+                                       } else {
+                                               ncr->databuffer_empty = true;
+                                       }
+                               }
+                               v = ncr->databuffer[0] >> 8;
+                               ncr->databuffer[0] <<= 8;
+                       } else {
+                               reg = add500reg(ncr, addr);
+                               if (reg >= 0) {
+                                       v = ncr5380_bget(ncr, reg);
+                               } else if ((addr & 0x8049) == 0x8009) {
+                                       v = 0;
+                                       if (!(t & SCSI_IO_REQ) && ncr->databuffer_empty) {
+                                               v |= 1 << 0;
+                                       }
+                               }
+                       }
+               } else {
+                       v = ncr->rom[addr];
+               }
+
+       } else if (ncr->type == NCR5380_ADSCSI) {
+
+               struct raw_scsi *rs = &ncr->rscsi;
+               if (ncr->configured)
+                       reg = adscsireg(ncr, addr, false);
+               if (reg >= 0) {
+                       v = ncr5380_bget(ncr, reg);
+               } else {
+                       v = ncr->rom[addr & 65535];
+               }
+               if (addr == 0x40) {
+                       uae_u8 t = raw_scsi_get_signal_phase(rs);
+                       v = 0;
+                       // bits 0 to 2: ID (inverted)
+                       // shorter delay before drive detection (8s vs 18s)
+                       v |= 1 << 5;
+                       if (t & SCSI_IO_REQ) {
+                               v |= 1 << 6;
+                               v |= 1 << 7;
+                       }
+                       activate_debugger();
+               }
+
+
+       } else if (ncr->type == NCR5380_KRONOS) {
+
+               struct raw_scsi *rs = &ncr->rscsi;
+               if (addr < sizeof ncr->acmemory)
+                       v = ncr->acmemory[addr];
+               if (ncr->configured) {
+                       if (addr == 0x40 || addr == 0x41) {
+                               v = 0;
+                       }
+               }
+               if (addr & 0x8000) {
+                       v = ncr->rom[addr & 8191];
+               }
        }
 
 #if NCR5380_DEBUG > 1
-       if (addr < 0x1000)
+       //if (addr >= 0x8000)
                write_log(_T("GET %08x %02x %d %08x\n"), addr, v, reg, M68K_GETPC);
 #endif
 
@@ -1640,6 +1770,32 @@ static void ncr80_bput2(struct soft_scsi *ncr, uaecptr addr, uae_u32 val, int si
                if (reg >= 0)
                        ncr5380_bput(ncr, reg, val);
 
+       } else if (ncr->type == NCR5380_ADD500) {
+
+               if ((addr & 0x8048) == 0x8008) {
+                       struct raw_scsi *rs = &ncr->rscsi;
+                       ncr->databuffer_empty = true;
+               } else {
+                       reg = add500reg(ncr, addr);
+                       if (reg >= 0) {
+                               ncr5380_bput(ncr, reg, val);
+                       }
+               }
+
+       } else if (ncr->type == NCR5380_ADSCSI) {
+
+               if (ncr->configured)
+                       reg = adscsireg(ncr, addr, true);
+               if (reg >= 0) {
+                       ncr5380_bput(ncr, reg, val);
+               }
+
+       } else if (ncr->type == NCR5380_KRONOS) {
+
+               if (addr == 0x60 || addr == 0x61) {
+                       ;
+               }
+
        }
 #if NCR5380_DEBUG > 1
        write_log(_T("PUT %08x %02x %d %08x\n"), addr, val, reg, M68K_GETPC);
@@ -1708,7 +1864,7 @@ static void REGPARAM2 ncr80_wput(struct soft_scsi *ncr, uaecptr addr, uae_u32 w)
                return;
        }
        ncr80_bput2(ncr, addr, w >> 8, 2);
-       ncr80_bput2(ncr, addr + 1, w, 2);
+       ncr80_bput2(ncr, addr + 1, w & 0xff, 2);
 }
 
 static void REGPARAM2 ncr80_bput(struct soft_scsi *ncr, uaecptr addr, uae_u32 b)
@@ -1856,7 +2012,7 @@ addrbank *supra_init(struct romconfig *rc)
 
 void supra_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       generic_soft_scsi_add(ch, ci, rc, NCR5380_SUPRA, 65536, 2 * 16384);
+       generic_soft_scsi_add(ch, ci, rc, NCR5380_SUPRA, 65536, 2 * 16384, ROMTYPE_SUPRA);
 }
 
 addrbank *golem_init(struct romconfig *rc)
@@ -1893,7 +2049,7 @@ addrbank *golem_init(struct romconfig *rc)
 
 void golem_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       generic_soft_scsi_add(ch, ci, rc, NONCR_GOLEM, 65536, 8192);
+       generic_soft_scsi_add(ch, ci, rc, NONCR_GOLEM, 65536, 8192, ROMTYPE_GOLEM);
 }
 
 addrbank *stardrive_init(struct romconfig *rc)
@@ -1915,7 +2071,7 @@ addrbank *stardrive_init(struct romconfig *rc)
 
 void stardrive_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       generic_soft_scsi_add(ch, ci, rc, NCR5380_STARDRIVE, 65536, 0);
+       generic_soft_scsi_add(ch, ci, rc, NCR5380_STARDRIVE, 65536, 0, ROMTYPE_STARDRIVE);
 }
 
 addrbank *kommos_init(struct romconfig *rc)
@@ -1946,7 +2102,7 @@ addrbank *kommos_init(struct romconfig *rc)
 
 void kommos_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       generic_soft_scsi_add(ch, ci, rc, NONCR_KOMMOS, 65536, 32768);
+       generic_soft_scsi_add(ch, ci, rc, NONCR_KOMMOS, 65536, 32768, ROMTYPE_KOMMOS);
 }
 
 addrbank *vector_init(struct romconfig *rc)
@@ -1981,7 +2137,7 @@ addrbank *vector_init(struct romconfig *rc)
 
 void vector_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       generic_soft_scsi_add(ch, ci, rc, NONCR_VECTOR, 65536, 32768);
+       generic_soft_scsi_add(ch, ci, rc, NONCR_VECTOR, 65536, 32768, ROMTYPE_VECTOR);
 }
 
 
@@ -2011,9 +2167,100 @@ addrbank *protar_init(struct romconfig *rc)
 
 void protar_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
 {
-       generic_soft_scsi_add(ch, ci, rc, NCR5380_PROTAR, 65536, 65536);
+       generic_soft_scsi_add(ch, ci, rc, NCR5380_PROTAR, 65536, 65536, ROMTYPE_PROTAR);
 }
 
+addrbank *add500_init(struct romconfig *rc)
+{
+       struct soft_scsi *scsi = getscsi(rc);
+       int roms[2];
+       
+       if (!scsi)
+               return &expamem_null;
+
+       roms[0] = 132;
+       roms[1] = -1;
+
+       scsi->rscsi.use_ack = true;
+
+       struct zfile *z = read_device_from_romconfig(rc, roms);
+       if (z) {
+               for (int i = 0; i < 16384; i++) {
+                       uae_u8 b;
+                       zfile_fread(&b, 1, 1, z);
+                       scsi->rom[i * 2] = b;
+               }
+               zfile_fclose(z);
+               memcpy(scsi->acmemory, scsi->rom, sizeof scsi->acmemory);
+       }
+       return scsi->bank;
+}
+
+void add500_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
+{
+       generic_soft_scsi_add(ch, ci, rc, NCR5380_ADD500, 65536, 32768, ROMTYPE_ADD500);
+}
+
+addrbank *kronos_init(struct romconfig *rc)
+{
+       struct soft_scsi *scsi = getscsi(rc);
+       int roms[2];
+       
+       if (!scsi)
+               return &expamem_null;
+
+       roms[0] = -1;
+       roms[1] = -1;
+       scsi->databuffer_size = 1024;
+       scsi->databufferptr = xcalloc(uae_u8, scsi->databuffer_size);
+
+       struct zfile *z = read_device_from_romconfig(rc, roms);
+       if (z) {
+               for (int i = 0; i < 4096; i++) {
+                       uae_u8 b;
+                       zfile_fread(&b, 1, 1, z);
+                       scsi->rom[i * 2] = b;
+               }
+               zfile_fclose(z);
+       }
+       return scsi->bank;
+}
+
+void kronos_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
+{
+       generic_soft_scsi_add(ch, ci, rc, NCR5380_KRONOS, 65536, 32768, ROMTYPE_KRONOS);
+}
+
+addrbank *adscsi_init(struct romconfig *rc)
+{
+       struct soft_scsi *scsi = getscsi(rc);
+       int roms[2];
+       
+       if (!scsi)
+               return &expamem_null;
+
+       roms[0] = 132;
+       roms[1] = -1;
+
+       struct zfile *z = read_device_from_romconfig(rc, roms);
+       if (z) {
+               for (int i = 0; i < 32768; i++) {
+                       uae_u8 b;
+                       zfile_fread(&b, 1, 1, z);
+                       scsi->rom[i * 2] = b;
+               }
+               zfile_fclose(z);
+               memcpy(scsi->acmemory, scsi->rom, sizeof scsi->acmemory);
+       }
+       return scsi->bank;
+}
+
+void adscsi_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
+{
+       generic_soft_scsi_add(ch, ci, rc, NCR5380_ADSCSI, 65536, 65536, ROMTYPE_ADSCSI);
+}
+
+
 
 void soft_scsi_free(void)
 {