*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)
}
}
-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)
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:
break;
case XT_CMD_FORMATBAD:
case XT_CMD_FORMATTRK:
+ case XT_CMD_FORMATDRV:
xt_command_done(wds);
break;
case XT_CMD_TESTREADY:
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;
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)
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)
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);
}
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
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';
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
{
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;
|| ! 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) {
*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) {
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];
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;
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;
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;
if (newcop && !oldcop) {
compute_spcflag_copper (hpos);
} else if (!newcop) {
- copper_enabled_thisline = 0;
- unset_special (SPCFLAG_COPPER);
+ copper_stop();
}
}
#endif
cop_state.ignore_next = 0;
}
+ check_copper_stop();
break;
case COP_wait1:
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)
},
{
_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
},
_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
}
}
+
+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;
}
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;
}
}
// 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];
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;
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 */
return o;
}
-
-
static void ide_grow_buffer(struct ide_hdf *ide, int newsize)
{
if (ide->secbuf_size >= 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;
}
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);
}
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);
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);
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
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));
+ }
}
}
}
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)
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,
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)
int num;
int blocksize;
int maxtransferstate;
+ int ata_level;
int ide_drv;
+ int media_type;
bool atapi;
bool atapi_drdy;
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;
#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
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);
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);
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;
}
}
{
}
-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);
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);
}
}
if (rc)
rc->unitdata = scsi;
scsi->rc = rc;
- if (ncr)
- *ncr = scsi;
+ *ncr = scsi;
return scsi;
}
}
}
}
-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);
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);
}
}
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);
}
#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
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
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
IDD_HARDFILE, DIALOG
BEGIN
+ RIGHTMARGIN, 396
END
IDD_FILESYS, DIALOG
#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")
} 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;
}
}
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;
S2X_reset ();
}
}
+ if (c & 1024) {
+ target_graphics_buffer_update();
+ }
if (c & 512) {
reopen_gfx ();
graphics_mode_changed = 1;
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
_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")
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)
{
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);
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)
} 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)
uae_u32 blocks, cyls, i;
TCHAR tmp[200], tmp2[200];
TCHAR idtmp[17];
+ bool phys = is_hdf_rdb();
bsize = 0;
if (force) {
}
}
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, ¤t_hfdlg.ci.pcyls, ¤t_hfdlg.ci.pheads, ¤t_hfdlg.ci.psecs, true);
- if (current_hfdlg.forcedcylinders == 0)
- current_hfdlg.forcedcylinders = current_hfdlg.ci.pcyls;
- } else {
- getchspgeometry (bsize, ¤t_hfdlg.ci.pcyls, ¤t_hfdlg.ci.pheads, ¤t_hfdlg.ci.psecs, false);
- }
- } else if (current_hfdlg.ci.blocksize && current_hfdlg.ci.sectors && current_hfdlg.ci.surfaces) {
- getchsgeometry_hdf (open ? &hfd : NULL, bsize, ¤t_hfdlg.ci.cyls, ¤t_hfdlg.ci.surfaces, ¤t_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, ¤t_hfdlg.ci.pcyls, ¤t_hfdlg.ci.pheads, ¤t_hfdlg.ci.psecs, true);
+ } else {
+ getchspgeometry (bsize, ¤t_hfdlg.ci.pcyls, ¤t_hfdlg.ci.pheads, ¤t_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++) {
(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));
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;
TCHAR tmp[MAX_DPATH], fs[MAX_DPATH], dev[MAX_DPATH];
int hdctrlr, hdunit;
int v;
+ int *p;
switch (msg) {
case WM_DROPFILES:
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;
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)) {
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;
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;
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) ? ¤t_hfdlg.ci.psecs : ¤t_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) ? ¤t_hfdlg.ci.pcyls : ¤t_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) ? ¤t_hfdlg.ci.pheads : ¤t_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 ());
}
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;
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;
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;
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;
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);
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);
return NULL;
}
-#define NEXT_ROM_ID 132
+#define NEXT_ROM_ID 134
static struct romheader romheaders[] = {
{ _T("Freezer Cartridges"), 1 },
{ _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,
#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;
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;
}
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;
}
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;
}
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;
};
free_scsi (rs->device[j]);
rs->device[j] = NULL;
}
+ xfree(s->databufferptr);
xfree(s);
}
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;
}
}
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)
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:
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);
struct raw_scsi *r = &scsi->rscsi;
switch(reg)
{
+ case 1:
+ break;
case 4:
{
uae_u8 t = raw_scsi_get_signal_phase(r);
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);
}
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;
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;
} 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
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);
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)
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)
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)
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)
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)
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);
}
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)
{