Fixed a minor issue in hdc_ide.c;

Fixed SCSI DMA command termination in the CD-ROM and Iomega ZIP code.
This commit is contained in:
OBattler
2018-03-16 22:46:05 +01:00
parent 9ae91cdae6
commit f8f889b72c
3 changed files with 24 additions and 16 deletions

View File

@@ -9,7 +9,7 @@
* Implementation of the CD-ROM drive with SCSI(-like)
* commands, for both ATAPI and SCSI usage.
*
* Version: @(#)cdrom.c 1.0.35 2018/03/15
* Version: @(#)cdrom.c 1.0.36 2018/03/16
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -2766,14 +2766,17 @@ int cdrom_read_from_dma(uint8_t id)
ret = cdrom_phase_data_out(id);
if (ret) {
if (ret || (cdrom_drives[id].bus_type == CDROM_BUS_SCSI)) {
cdrom_buf_free(id);
cdrom[id].packet_status = CDROM_PHASE_COMPLETE;
cdrom[id].status = READY_STAT;
cdrom[id].phase = 3;
ui_sb_update_icon(SB_CDROM | id, 0);
cdrom_irq_raise(id);
if (ret)
return 1;
else
return 0;
} else
return 0;
}
@@ -2819,14 +2822,17 @@ int cdrom_write_to_dma(uint8_t id)
} else
ret = cdrom_write_to_ide_dma(cdrom_drives[id].ide_channel);
if (ret) {
if (ret || (cdrom_drives[id].bus_type == CDROM_BUS_SCSI)) {
cdrom_buf_free(id);
cdrom[id].packet_status = CDROM_PHASE_COMPLETE;
cdrom[id].status = READY_STAT;
cdrom[id].phase = 3;
ui_sb_update_icon(SB_CDROM | id, 0);
cdrom_irq_raise(id);
if (ret)
return 1;
else
return 0;
} else
return 0;
}

View File

@@ -9,7 +9,7 @@
* Implementation of the IDE emulation for hard disks and ATAPI
* CD-ROM devices.
*
* Version: @(#)hdc_ide.c 1.0.36 2018/03/16
* Version: @(#)hdc_ide.c 1.0.37 2018/03/16
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -861,7 +861,6 @@ void ide_reset(void)
{
ide_log("Found IDE hard disk on channel %i\n", hdd[d].ide_channel);
loadhd(&ide_drives[hdd[d].ide_channel], d, hdd[d].fn);
ide_drives[hdd[d].ide_channel].sector_buffer = NULL; /* Important, makes sure malloc does not reuse an existing pointer from elsewhere. */
ide_drives[hdd[d].ide_channel].sector_buffer = (uint8_t *) malloc(256*512);
if (++c >= (IDE_NUM+XTIDE_NUM)) break;
}
@@ -869,7 +868,6 @@ void ide_reset(void)
{
ide_log("Found XT IDE hard disk on channel %i\n", hdd[d].xtide_channel);
loadhd(&ide_drives[hdd[d].xtide_channel | 8], d, hdd[d].fn);
ide_drives[hdd[d].xtide_channel | 8].sector_buffer = NULL; /* Important, makes sure malloc does not reuse an existing pointer from elsewhere. */
ide_drives[hdd[d].xtide_channel | 8].sector_buffer = (uint8_t *) malloc(256*512);
if (++c >= (IDE_NUM+XTIDE_NUM)) break;
}
@@ -883,10 +881,8 @@ void ide_reset(void)
else if (ide_drive_is_cdrom(&ide_drives[d]) && (ide_drives[d].type == IDE_NONE))
ide_drives[d].type = IDE_CDROM;
if (ide_drives[d].type != IDE_NONE) {
ide_drives[d].buffer = NULL; /* Important, makes sure malloc does not reuse an existing pointer from elsewhere. */
if (ide_drives[d].type != IDE_NONE)
ide_drives[d].buffer = (uint16_t *) malloc(65536 * sizeof(uint16_t));
}
ide_set_signature(&ide_drives[d]);

View File

@@ -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.9 2018/03/15
* Version: @(#)zip.c 1.0.10 2018/03/16
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -2267,14 +2267,17 @@ int zip_read_from_dma(uint8_t id)
ret = zip_phase_data_out(id);
if (ret) {
if (ret || (zip_drives[id].bus_type == ZIP_BUS_SCSI)) {
zip_buf_free(id);
zip[id].packet_status = ZIP_PHASE_COMPLETE;
zip[id].status = READY_STAT;
zip[id].phase = 3;
ui_sb_update_icon(SB_ZIP | id, 0);
zip_irq_raise(id);
if (ret)
return 1;
else
return 0;
} else
return 0;
}
@@ -2322,14 +2325,17 @@ int zip_write_to_dma(uint8_t id)
} else
ret = zip_write_to_ide_dma(zip_drives[id].ide_channel);
if (ret) {
if (ret || (zip_drives[id].bus_type == ZIP_BUS_SCSI)) {
zip_buf_free(id);
zip[id].packet_status = ZIP_PHASE_COMPLETE;
zip[id].status = READY_STAT;
zip[id].phase = 3;
ui_sb_update_icon(SB_ZIP | id, 0);
zip_irq_raise(id);
if (ret)
return 1;
else
return 0;
} else
return 0;
}