From a0b7d553129122348c575bf94029aec9388d43bc Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 29 Dec 2016 20:49:01 +0100 Subject: [PATCH] Implemented ATAPI and SCSI SEEK (6) command. --- src/ide.c | 10 +++++++++- src/scsi.h | 1 + src/scsi_cdrom.c | 11 ++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/ide.c b/src/ide.c index c05b926c2..0b9326284 100644 --- a/src/ide.c +++ b/src/ide.c @@ -2692,8 +2692,16 @@ atapi_out: idecallback[ide_board]=50*IDE_TIME; break; + case GPCMD_SEEK_6: case GPCMD_SEEK: - pos=(idebufferb[3]<<16)|(idebufferb[4]<<8)|idebufferb[5]; + if (idebufferb[0] == GPCMD_SEEK_6) + { + pos=(idebufferb[2]<<8)|idebufferb[3]; + } + else + { + pos=(idebufferb[2]<<24)|(idebufferb[3]<<16)|(idebufferb[4]<<8)|idebufferb[5]; + } cdrom->seek(pos); ide->packetstatus = ATAPI_STATUS_COMPLETE; idecallback[ide_board]=50*IDE_TIME; diff --git a/src/scsi.h b/src/scsi.h index db14fbb8c..4818f72ac 100644 --- a/src/scsi.h +++ b/src/scsi.h @@ -14,6 +14,7 @@ #define GPCMD_TEST_UNIT_READY 0x00 #define GPCMD_REQUEST_SENSE 0x03 #define GPCMD_READ_6 0x08 +#define GPCMD_SEEK_6 0x0B #define GPCMD_INQUIRY 0x12 #define GPCMD_MODE_SELECT_6 0x15 #define GPCMD_MODE_SENSE_6 0x1a diff --git a/src/scsi_cdrom.c b/src/scsi_cdrom.c index adf14a028..e659ed552 100644 --- a/src/scsi_cdrom.c +++ b/src/scsi_cdrom.c @@ -31,6 +31,7 @@ uint8_t SCSICommandTable[0x100] = [GPCMD_PREVENT_REMOVAL] = CHECK_READY, [GPCMD_READ_CDROM_CAPACITY] = CHECK_READY, [GPCMD_READ_10] = CHECK_READY, + [GPCMD_SEEK_6] = CHECK_READY | NONDATA, [GPCMD_SEEK] = CHECK_READY | NONDATA, [GPCMD_READ_SUBCHANNEL] = CHECK_READY, [GPCMD_READ_TOC_PMA_ATIP] = CHECK_READY | ALLOW_UA, /* Read TOC - can get through UNIT_ATTENTION, per VIDE-CDD.SYS @@ -921,8 +922,16 @@ void SCSICDROM_Command(uint8_t id, uint8_t lun, uint8_t *cdb) SCSIDMAResetPosition(id); break; + case GPCMD_SEEK6: case GPCMD_SEEK: - SCSIDevices[id].lba_pos = (cdb[3]<<16)|(cdb[4]<<8)|cdb[5]; + if (cbd[0] == GPCMD_SEEK6) + { + SCSIDevices[id].lba_pos = (cdb[2]<<8)|cdb[3]; + } + else + { + SCSIDevices[id].lba_pos = (cdb[2]<<24)|(cdb[3]<<16)|(cdb[4]<<8)|cdb[5]; + } cdrom->seek(SCSIDevices[id].lba_pos); SCSIPhase = SCSI_PHASE_STATUS;