Fixed CD-ROM timings on the NCR 53x8xx SCSI controllers, the IDE_TIME, CDROM_TIME, and ZIP_TIME values, and the delay added to the CD-ROM READ SUBCHANNEL command, fixes slowdowns on several games that use CD Audio, such as Tomb Raider II.
This commit is contained in:
@@ -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.71 2019/09/26
|
||||
* Version: @(#)scsi_cdrom.c 1.0.72 2019/11/19
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -604,15 +604,19 @@ scsi_cdrom_update_request_length(scsi_cdrom_t *dev, int len, int block_len)
|
||||
static double
|
||||
scsi_cdrom_bus_speed(scsi_cdrom_t *dev)
|
||||
{
|
||||
double ret = -1.0;
|
||||
|
||||
if (dev->drv->bus_type == CDROM_BUS_SCSI) {
|
||||
dev->callback = -1.0; /* Speed depends on SCSI controller */
|
||||
return 0.0;
|
||||
} else {
|
||||
/* TODO: Get the actual selected speed from IDE. */
|
||||
if (scsi_cdrom_current_mode(dev) == 2)
|
||||
return 66666666.666666666666666; /* 66 MB/s MDMA-2 speed */
|
||||
else
|
||||
return 8333333.333333333333333; /* 8.3 MB/s PIO-2 speed */
|
||||
if (dev && dev->drv)
|
||||
ret = ide_atapi_get_period(dev->drv->ide_channel);
|
||||
if (ret == -1.0) {
|
||||
dev->callback = -1.0;
|
||||
return 0.0;
|
||||
} else
|
||||
return ret * 1000000.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -663,7 +667,7 @@ scsi_cdrom_command_common(scsi_cdrom_t *dev)
|
||||
case 0xb9:
|
||||
case 0xbe:
|
||||
if (dev->current_cdb[0] == 0x42)
|
||||
dev->callback += 200.0 * CDROM_TIME;
|
||||
dev->callback += 40.0;
|
||||
/* Account for seek time. */
|
||||
bytes_per_second = 176.0 * 1024.0;
|
||||
bytes_per_second *= (double) dev->drv->cur_speed;
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
* Implementation of the CD-ROM drive with SCSI(-like)
|
||||
* commands, for both ATAPI and SCSI usage.
|
||||
*
|
||||
* Version: @(#)scsi_cdrom.h 1.0.1 2018/10/17
|
||||
* Version: @(#)scsi_cdrom.h 1.0.2 2019/11/19
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2018 Miran Grca.
|
||||
* Copyright 2018,2019 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_SCSI_CDROM_H
|
||||
#define EMU_SCSI_CDROM_H
|
||||
|
||||
|
||||
#define CDROM_TIME 500.0
|
||||
#define CDROM_TIME 10.0
|
||||
|
||||
|
||||
#ifdef SCSI_DEVICE_H
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* To do: Identify the type of serial EEPROM used and its
|
||||
* interface.
|
||||
*
|
||||
* Version: @(#)scsi_ncr53c8xx.c 1.0.17 2018/10/30
|
||||
* Version: @(#)scsi_ncr53c8xx.c 1.0.18 2019/11/19
|
||||
*
|
||||
* Authors: Paul Brook (QEMU)
|
||||
* Artyom Tarasenko (QEMU)
|
||||
@@ -705,10 +705,12 @@ ncr53c8xx_add_msg_byte(ncr53c8xx_t *dev, uint8_t data)
|
||||
static void
|
||||
ncr53c8xx_timer_on(ncr53c8xx_t *dev, scsi_device_t *sd, double p)
|
||||
{
|
||||
if (p <= 0)
|
||||
timer_on_auto(&dev->timer, ((double) sd->buffer_length) * 0.1); /* Fast SCSI: 10000000 bytes per second */
|
||||
else
|
||||
timer_on_auto(&dev->timer, p);
|
||||
double period;
|
||||
|
||||
/* Fast SCSI: 10000000 bytes per second */
|
||||
period = (p > 0.0) ? p : (((double) sd->buffer_length) * 0.1);
|
||||
|
||||
timer_on_auto(&dev->timer, period + 40.0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1023,11 +1025,12 @@ again:
|
||||
/* If we receive an empty opcode increment the DSP by 4 bytes
|
||||
instead of 8 and execute the next opcode at that location */
|
||||
dev->dsp += 4;
|
||||
timer_on_auto(&dev->timer, 10.0);
|
||||
if (insn_processed < 100)
|
||||
goto again;
|
||||
else
|
||||
else {
|
||||
timer_on_auto(&dev->timer, 10.0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
addr = read_dword(dev, dev->dsp + 4);
|
||||
ncr53c8xx_log("SCRIPTS dsp=%08x opcode %08x arg %08x\n", dev->dsp, insn, addr);
|
||||
@@ -1093,8 +1096,6 @@ again:
|
||||
dev->dfifo = dev->dbc & 0xff;
|
||||
dev->ctest5 = (dev->ctest5 & 0xfc) | ((dev->dbc >> 8) & 3);
|
||||
|
||||
timer_on_auto(&dev->timer, 40.0);
|
||||
|
||||
if (dev->dcntl & NCR_DCNTL_SSM)
|
||||
ncr53c8xx_script_dma_interrupt(dev, NCR_DSTAT_SSI);
|
||||
return;
|
||||
@@ -1363,8 +1364,6 @@ again:
|
||||
ncr53c8xx_log("%02X: Unknown command\n", (uint8_t) (insn >> 30));
|
||||
}
|
||||
|
||||
timer_on_auto(&dev->timer, 40.0);
|
||||
|
||||
ncr53c8xx_log("instructions processed %i\n", insn_processed);
|
||||
if (insn_processed > 10000 && !dev->waiting) {
|
||||
/* Some windows drivers make the device spin waiting for a memory
|
||||
@@ -1393,6 +1392,8 @@ again:
|
||||
ncr53c8xx_log("NCR 810: SCRIPTS: Waiting\n");
|
||||
}
|
||||
|
||||
timer_on_auto(&dev->timer, 40.0);
|
||||
|
||||
ncr53c8xx_log("SCRIPTS execution stopped\n");
|
||||
}
|
||||
|
||||
@@ -1419,8 +1420,6 @@ ncr53c8xx_callback(void *p)
|
||||
|
||||
if (dev->sstop)
|
||||
timer_stop(&dev->timer);
|
||||
else
|
||||
timer_on_auto(&dev->timer, 10.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user