Added the PLAY AUDIO TRACK RELATIVE (10) and PLAY AUDIO TRACK RELATIVE (12) CD-ROM commands;

More fixes for the PLAY AUDIO TRACK INDEX command.
This commit is contained in:
OBattler
2018-10-30 16:42:43 +01:00
parent 5e5e1ed70e
commit 8b3f47ab4d
3 changed files with 30 additions and 7 deletions

View File

@@ -8,7 +8,7 @@
*
* Generic CD-ROM drive core.
*
* Version: @(#)cdrom.c 1.0.6 2018/10/28
* Version: @(#)cdrom.c 1.0.7 2018/10/30
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -293,7 +293,11 @@ cdrom_audio_play(cdrom_t *dev, uint32_t pos, uint32_t len, int ismsf)
return 0;
cdrom_log("CD-ROM %i: Play audio - %08X %08X %i\n", dev->id, pos, len, ismsf);
if (ismsf == 2) {
if (ismsf & 0x100) {
/* Track-relative audio play. */
dev->ops->get_track_info(dev, ismsf & 0xff, 0, &ti);
pos += MSFtoLBA(ti.m, ti.s, ti.f) - 150;
} else if (ismsf == 2) {
dev->ops->get_track_info(dev, pos, 0, &ti);
pos = MSFtoLBA(ti.m, ti.s, ti.f) - 150;
/* We have to end at the *end* of the specified track,

View File

@@ -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.65 2018/10/30
* Version: @(#)scsi_cdrom.c 1.0.66 2018/10/30
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -102,7 +102,7 @@ const uint8_t scsi_cdrom_command_flags[0x100] =
IMPLEMENTED | ALLOW_UA, /* 0x46 */
IMPLEMENTED | CHECK_READY, /* 0x47 */
IMPLEMENTED | CHECK_READY, /* 0x48 */
0, /* 0x49 */
IMPLEMENTED | CHECK_READY, /* 0x49 */
IMPLEMENTED | ALLOW_UA, /* 0x4A */
IMPLEMENTED | CHECK_READY, /* 0x4B */
0, 0, /* 0x4C-0x4D */
@@ -123,7 +123,8 @@ const uint8_t scsi_cdrom_command_flags[0x100] =
IMPLEMENTED | CHECK_READY, /* 0xA5 */
0, 0, /* 0xA6-0xA7 */
IMPLEMENTED | CHECK_READY, /* 0xA8 */
0, 0, 0, 0, /* 0xA9-0xAC */
IMPLEMENTED | CHECK_READY, /* 0xA9 */
0, 0, 0, /* 0xAA-0xAC */
IMPLEMENTED | CHECK_READY, /* 0xAD */
0, /* 0xAE */
IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, /* 0xAF */
@@ -2046,6 +2047,8 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb)
case GPCMD_PLAY_AUDIO_12:
case GPCMD_PLAY_AUDIO_MSF:
case GPCMD_PLAY_AUDIO_TRACK_INDEX:
case GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10:
case GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12:
scsi_cdrom_set_phase(dev, SCSI_PHASE_STATUS);
switch(cdb[0]) {
@@ -2068,9 +2071,23 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb)
break;
case GPCMD_PLAY_AUDIO_TRACK_INDEX:
msf = 2;
pos = (cdb[4] << 8) | cdb[5];
if ((cdb[5] != 1) || (cdb[8] != 1)) {
scsi_cdrom_illegal_mode(dev);
break;
}
pos = cdb[4];
len = cdb[7];
break;
case GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10:
msf = 0x100 | cdb[6];
pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5];
len = (cdb[7] << 8) | cdb[8];
break;
case GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12:
msf = 0x100 | cdb[10];
pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5];
len = (cdb[6] << 24) | (cdb[7] << 16) | (cdb[8] << 8) | cdb[9];
break;
}
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {

View File

@@ -8,7 +8,7 @@
*
* Definitions for the generic SCSI device command handler.
*
* Version: @(#)scsi_device.h 1.0.14 2018/10/28
* Version: @(#)scsi_device.h 1.0.15 2018/10/30
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -76,6 +76,7 @@
#define GPCMD_GET_CONFIGURATION 0x46
#define GPCMD_PLAY_AUDIO_MSF 0x47
#define GPCMD_PLAY_AUDIO_TRACK_INDEX 0x48
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10 0x49
#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
#define GPCMD_PAUSE_RESUME 0x4b
#define GPCMD_STOP_PLAY_SCAN 0x4e
@@ -85,6 +86,7 @@
#define GPCMD_MODE_SENSE_10 0x5a
#define GPCMD_PLAY_AUDIO_12 0xa5
#define GPCMD_READ_12 0xa8
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12 0xa9
#define GPCMD_WRITE_12 0xaa
#define GPCMD_READ_DVD_STRUCTURE 0xad /* For reading. */
#define GPCMD_WRITE_AND_VERIFY_12 0xae