Updated the CDROM speed setting code some more, and fixed a bug.
This commit is contained in:
@@ -911,7 +911,6 @@ static void cdrom_command_common(uint8_t id)
|
||||
case 0xb8:
|
||||
case 0xb9:
|
||||
case 0xbe:
|
||||
/* bytes_per_second = 150.0 * 1024.0; */
|
||||
bytes_per_second = (1000000.0 / 12000.0) * 2048.0; /* Account for seek time. */
|
||||
bytes_per_second *= (double)cdrom_speeds[dev->cur_speed].speed;
|
||||
break;
|
||||
@@ -921,12 +920,13 @@ static void cdrom_command_common(uint8_t id)
|
||||
dev->callback = -1LL; /* Speed depends on SCSI controller */
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
period = 1000000.0 / bytes_per_second;
|
||||
dusec = (double) TIMER_USEC;
|
||||
dusec = dusec * period * (double) (dev->packet_len);
|
||||
dev->callback = ((int64_t) dusec);
|
||||
dev->callback += ((int64_t) dusec);
|
||||
}
|
||||
cdrom_set_callback(id);
|
||||
}
|
||||
@@ -1573,10 +1573,11 @@ skip_ready_check:
|
||||
void cdrom_clear_callback(uint8_t channel)
|
||||
{
|
||||
uint8_t id = atapi_cdrom_drives[channel];
|
||||
cdrom_t *dev = cdrom[id];
|
||||
cdrom_t *dev;
|
||||
|
||||
if (id < CDROM_NUM)
|
||||
{
|
||||
dev = cdrom[id];
|
||||
dev->callback = 0LL;
|
||||
cdrom_set_callback(id);
|
||||
}
|
||||
@@ -1826,9 +1827,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
|
||||
case GPCMD_SET_SPEED_ALT:
|
||||
len = (cdb[3] | (cdb[2] << 8)) / 176;
|
||||
dev->cur_speed = cdrom_speed_idx(len);
|
||||
if (dev->cur_speed < 1)
|
||||
dev->cur_speed = 0;
|
||||
else if (dev->cur_speed > cdrom_drives[id].speed_idx)
|
||||
if (dev->cur_speed > cdrom_drives[id].speed_idx)
|
||||
dev->cur_speed = cdrom_drives[id].speed_idx;
|
||||
cdrom_set_phase(id, SCSI_PHASE_STATUS);
|
||||
cdrom_command_complete(id);
|
||||
@@ -1988,6 +1987,9 @@ cdrom_readtoc_fallback:
|
||||
break;
|
||||
}
|
||||
|
||||
dev->seek_diff = ABS((int) (pos - dev->seek_pos));
|
||||
dev->seek_pos = dev->sector_pos;
|
||||
|
||||
if (!dev->sector_len) {
|
||||
cdrom_set_phase(id, SCSI_PHASE_STATUS);
|
||||
/* cdrom_log("CD-ROM %i: All done - callback set\n", id); */
|
||||
@@ -2957,12 +2959,6 @@ int cdrom_read_from_ide_dma(uint8_t channel)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cdrom_irq_raise(uint8_t id)
|
||||
{
|
||||
if (cdrom_drives[id].bus_type < CDROM_BUS_SCSI)
|
||||
ide_irq_raise(&(ide_drives[cdrom_drives[id].ide_channel]));
|
||||
}
|
||||
|
||||
int cdrom_read_from_scsi_dma(uint8_t scsi_id, uint8_t scsi_lun)
|
||||
{
|
||||
uint8_t id = scsi_cdrom_drives[scsi_id][scsi_lun];
|
||||
@@ -2978,6 +2974,12 @@ int cdrom_read_from_scsi_dma(uint8_t scsi_id, uint8_t scsi_lun)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void cdrom_irq_raise(uint8_t id)
|
||||
{
|
||||
if (cdrom_drives[id].bus_type < CDROM_BUS_SCSI)
|
||||
ide_irq_raise(&(ide_drives[cdrom_drives[id].ide_channel]));
|
||||
}
|
||||
|
||||
int cdrom_read_from_dma(uint8_t id)
|
||||
{
|
||||
cdrom_t *dev = cdrom[id];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* CD-ROM image support.
|
||||
*
|
||||
* Version: @(#)cdrom_image.cpp 1.0.5 2018/03/18
|
||||
* Version: @(#)cdrom_image.cpp 1.0.6 2018/03/20
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -100,8 +100,6 @@ void image_audio_callback(uint8_t id, int16_t *output, int len)
|
||||
{
|
||||
cdrom_t *dev = cdrom[id];
|
||||
|
||||
return; /*FIXME: why? */
|
||||
|
||||
if (!cdrom_drives[id].sound_on || (dev->cd_state != CD_PLAYING) || cdrom_image[id].image_is_iso)
|
||||
{
|
||||
cdrom_image_log("image_audio_callback(i): Not playing\n", id);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* This header file lists the functions provided by
|
||||
* various platform specific cdrom-ioctl files.
|
||||
*
|
||||
* Version: @(#)cdrom_image.h 1.0.1 2018/02/14
|
||||
* Version: @(#)cdrom_image.h 1.0.2 2018/03/20
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* RichardG, <richardg867@gmail.com>
|
||||
@@ -52,9 +52,6 @@ extern void image_close(uint8_t id);
|
||||
|
||||
extern void cdrom_set_null_handler(uint8_t id);
|
||||
|
||||
//FIXME: delete this! --FvK
|
||||
extern void update_status_bar_icon_state(int tag, int state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the generic device interface to handle
|
||||
* all devices attached to the emulator.
|
||||
*
|
||||
* Version: @(#)device.c 1.0.4 2018/03/15
|
||||
* Version: @(#)device.c 1.0.5 2018/03/20
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -130,7 +130,6 @@ device_close_all(void)
|
||||
|
||||
for (c=0; c<DEVICE_MAX; c++) {
|
||||
if (devices[c] != NULL) {
|
||||
pclog("DEVICE: closing device '%s'\n", devices[c]->name);
|
||||
if (devices[c]->close != NULL)
|
||||
devices[c]->close(device_priv[c]);
|
||||
devices[c] = device_priv[c] = NULL;
|
||||
|
||||
Reference in New Issue
Block a user