Fixed device chain loading (again) and ZIP and CD-ROM resetting.

This commit is contained in:
OBattler
2018-10-25 07:43:32 +02:00
parent 89ec54ebd2
commit 3870edf150
3 changed files with 12 additions and 12 deletions

View File

@@ -9,7 +9,7 @@
* Implementation of the generic device interface to handle * Implementation of the generic device interface to handle
* all devices attached to the emulator. * 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, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -116,6 +116,10 @@ device_add_common(const device_t *d, void *p, int inst)
if (c >= DEVICE_MAX) if (c >= DEVICE_MAX)
fatal("DEVICE: too many devices\n"); 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) { if (p == NULL) {
memcpy(&old, &device_current, sizeof(device_context_t)); memcpy(&old, &device_current, sizeof(device_context_t));
device_set_context(&device_current, d, inst); device_set_context(&device_current, d, inst);
@@ -128,6 +132,7 @@ device_add_common(const device_t *d, void *p, int inst)
else else
device_log("DEVICE: device init failed\n"); device_log("DEVICE: device init failed\n");
devices[c] = NULL;
device_priv[c] = NULL; device_priv[c] = NULL;
return(NULL); return(NULL);
@@ -139,8 +144,6 @@ device_add_common(const device_t *d, void *p, int inst)
} else } else
device_priv[c] = p; device_priv[c] = p;
devices[c] = (device_t *)d;
return(priv); return(priv);
} }

View File

@@ -9,7 +9,7 @@
* Implementation of the Iomega ZIP drive with SCSI(-like) * Implementation of the Iomega ZIP drive with SCSI(-like)
* commands, for both ATAPI and SCSI usage. * 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, <mgrca8@gmail.com> * Author: Miran Grca, <mgrca8@gmail.com>
* *
@@ -1345,6 +1345,7 @@ zip_reset(void *p)
dev->status = 0; dev->status = 0;
dev->callback = 0LL; dev->callback = 0LL;
zip_set_callback(dev); zip_set_callback(dev);
zip_set_signature(dev);
dev->packet_status = 0xff; dev->packet_status = 0xff;
dev->unit_attention = 0; dev->unit_attention = 0;
} }
@@ -1949,13 +1950,8 @@ zip_command(void *p, uint8_t *cdb)
else else
zipbufferb[0] = 0x00; /*Hard disk*/ zipbufferb[0] = 0x00; /*Hard disk*/
zipbufferb[1] = 0x80; /*Removable*/ zipbufferb[1] = 0x80; /*Removable*/
if (dev->drv->is_250) { zipbufferb[2] = (dev->drv->bus_type == ZIP_BUS_SCSI) ? 0x02 : 0x00; /*SCSI-2 compliant*/
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[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[4] = 31; zipbufferb[4] = 31;
if (dev->drv->bus_type == ZIP_BUS_SCSI) { if (dev->drv->bus_type == ZIP_BUS_SCSI) {
zipbufferb[6] = 1; /* 16-bit transfers supported */ zipbufferb[6] = 1; /* 16-bit transfers supported */

View File

@@ -9,7 +9,7 @@
* Implementation of the CD-ROM drive with SCSI(-like) * Implementation of the CD-ROM drive with SCSI(-like)
* commands, for both ATAPI and SCSI usage. * 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, <mgrca8@gmail.com> * Author: Miran Grca, <mgrca8@gmail.com>
* *
@@ -1424,6 +1424,7 @@ scsi_cdrom_reset(void *p)
dev->status = 0; dev->status = 0;
dev->callback = 0LL; dev->callback = 0LL;
scsi_cdrom_set_callback(dev); scsi_cdrom_set_callback(dev);
scsi_cdrom_set_signature(dev);
dev->packet_status = 0xff; dev->packet_status = 0xff;
dev->unit_attention = 0xff; dev->unit_attention = 0xff;
} }