From 3870edf150bef48fb08a2d2888290bfae6d95f32 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 25 Oct 2018 07:43:32 +0200 Subject: [PATCH] Fixed device chain loading (again) and ZIP and CD-ROM resetting. --- src/device.c | 9 ++++++--- src/disk/zip.c | 12 ++++-------- src/scsi/scsi_cdrom.c | 3 ++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/device.c b/src/device.c index 68447e644..0305a362b 100644 --- a/src/device.c +++ b/src/device.c @@ -9,7 +9,7 @@ * Implementation of the generic device interface to handle * all devices attached to the emulator. * - * Version: @(#)device.c 1.0.21 2018/10/23 + * Version: @(#)device.c 1.0.22 2018/10/25 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -116,6 +116,10 @@ device_add_common(const device_t *d, void *p, int inst) if (c >= DEVICE_MAX) fatal("DEVICE: too many devices\n"); + /* Do this so that a chained device_add will not identify the same ID + its master device is already trying to assign. */ + devices[c] = (device_t *)d; + if (p == NULL) { memcpy(&old, &device_current, sizeof(device_context_t)); device_set_context(&device_current, d, inst); @@ -128,6 +132,7 @@ device_add_common(const device_t *d, void *p, int inst) else device_log("DEVICE: device init failed\n"); + devices[c] = NULL; device_priv[c] = NULL; return(NULL); @@ -139,8 +144,6 @@ device_add_common(const device_t *d, void *p, int inst) } else device_priv[c] = p; - devices[c] = (device_t *)d; - return(priv); } diff --git a/src/disk/zip.c b/src/disk/zip.c index 2f22aa82d..2c0d196f5 100644 --- a/src/disk/zip.c +++ b/src/disk/zip.c @@ -9,7 +9,7 @@ * Implementation of the Iomega ZIP drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)zip.c 1.0.28 2018/10/19 + * Version: @(#)zip.c 1.0.29 2018/10/25 * * Author: Miran Grca, * @@ -1345,6 +1345,7 @@ zip_reset(void *p) dev->status = 0; dev->callback = 0LL; zip_set_callback(dev); + zip_set_signature(dev); dev->packet_status = 0xff; dev->unit_attention = 0; } @@ -1949,13 +1950,8 @@ zip_command(void *p, uint8_t *cdb) else zipbufferb[0] = 0x00; /*Hard disk*/ zipbufferb[1] = 0x80; /*Removable*/ - if (dev->drv->is_250) { - zipbufferb[2] = (dev->drv->bus_type == ZIP_BUS_SCSI) ? 0x02 : 0x00; /*SCSI-2 compliant*/ - zipbufferb[3] = (dev->drv->bus_type == ZIP_BUS_SCSI) ? 0x02 : 0x21; - } else { - zipbufferb[2] = (dev->drv->bus_type == ZIP_BUS_SCSI) ? 0x02 : 0x00; /*SCSI-2 compliant*/ - zipbufferb[3] = (dev->drv->bus_type == ZIP_BUS_SCSI) ? 0x02 : 0x21; - } + zipbufferb[2] = (dev->drv->bus_type == ZIP_BUS_SCSI) ? 0x02 : 0x00; /*SCSI-2 compliant*/ + zipbufferb[3] = (dev->drv->bus_type == ZIP_BUS_SCSI) ? 0x02 : 0x21; zipbufferb[4] = 31; if (dev->drv->bus_type == ZIP_BUS_SCSI) { zipbufferb[6] = 1; /* 16-bit transfers supported */ diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index ebe31ff92..b211e6898 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -9,7 +9,7 @@ * Implementation of the CD-ROM drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)scsi_cdrom.c 1.0.54 2018/10/21 + * Version: @(#)scsi_cdrom.c 1.0.55 2018/10/25 * * Author: Miran Grca, * @@ -1424,6 +1424,7 @@ scsi_cdrom_reset(void *p) dev->status = 0; dev->callback = 0LL; scsi_cdrom_set_callback(dev); + scsi_cdrom_set_signature(dev); dev->packet_status = 0xff; dev->unit_attention = 0xff; }