From 98800d5b987e33f6bac07695fa6e4dafa6d9b8e7 Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Sat, 17 Oct 2009 20:15:15 +0000 Subject: [PATCH] scsihd updates - Fixed parameter interpretation for READ(10) and READ(12) - Added WRITE(10) --- src/emu/machine/scsihd.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/emu/machine/scsihd.c b/src/emu/machine/scsihd.c index 978427a1224..cc570c3984b 100644 --- a/src/emu/machine/scsihd.c +++ b/src/emu/machine/scsihd.c @@ -77,17 +77,27 @@ static int scsihd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) case 0x28: // READ(10) our_this->lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5]; - our_this->blocks = command[6]<<24 | command[7]<<16 | command[8]<<8 | command[9]; + our_this->blocks = SCSILengthFromUINT16( &command[7] ); logerror("SCSIHD: READ at LBA %x for %x blocks\n", our_this->lba, our_this->blocks); SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); return our_this->blocks * 512; - case 0xa8: // READ(12) + case 0x2a: // WRITE (10) our_this->lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5]; our_this->blocks = SCSILengthFromUINT16( &command[7] ); + logerror("SCSIHD: WRITE to LBA %x for %x blocks\n", our_this->lba, our_this->blocks); + + SCSISetPhase( scsiInstance, SCSI_PHASE_DATAOUT ); + + return our_this->blocks * 512; + + case 0xa8: // READ(12) + our_this->lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5]; + our_this->blocks = command[6]<<24 | command[7]<<16 | command[8]<<8 | command[9]; + logerror("SCSIHD: READ at LBA %x for %x blocks\n", our_this->lba, our_this->blocks); SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); @@ -238,12 +248,12 @@ static void scsihd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr our_this->disk = mess_hd_get_hard_disk_file( devtag_get_device( machine, diskregion ) ); #else our_this->disk = hard_disk_open(get_disk_handle( machine, diskregion )); +#endif if (!our_this->disk) { logerror("SCSIHD: no HD found!\n"); } -#endif } static void scsihd_delete_instance( SCSIInstance *scsiInstance )