DRQ wasn't setted properly, now there are proper gd-rom command writes

This commit is contained in:
Angelo Salese 2013-08-18 23:05:43 +00:00
parent 5843797908
commit 0bb9376577
3 changed files with 22 additions and 13 deletions

View File

@ -11,12 +11,6 @@
#include "gdrom.h"
#include "debugger.h"
static const UINT8 GDROM_Cmd11_Reply[32] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x19, 0x00, 0x00, 0x08, 0x53, 0x45, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x52, 0x65, 0x76, 0x20, 0x36, 0x2E, 0x34, 0x32, 0x39, 0x39, 0x30, 0x33, 0x31, 0x36
};
static void phys_frame_to_msf(int phys_frame, int *m, int *s, int *f)
{
*m = phys_frame / (60*75);
@ -49,6 +43,15 @@ void gdrom_device::device_reset()
{
scsihle_device::device_reset();
static const UINT8 GDROM_Def_Cmd11_Reply[32] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x19, 0x00, 0x00, 0x08, 0x53, 0x45, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x52, 0x65, 0x76, 0x20, 0x36, 0x2E, 0x34, 0x32, 0x39, 0x39, 0x30, 0x33, 0x31, 0x36
};
for(int i = 0;i<32;i++)
GDROM_Cmd11_Reply[i] = GDROM_Def_Cmd11_Reply[i];
is_file = TRUE;
cdrom = subdevice<cdrom_image_device>("image")->get_cdrom_file();
if( !cdrom )
@ -126,10 +129,12 @@ void gdrom_device::ExecCommand( int *transferLength )
case 0x12: // INQUIRY
logerror("GDROM: REQUEST SENSE\n");
debugger_break(machine());
SetPhase( SCSI_PHASE_DATAIN );
transferOffset = command[2];
SetPhase( SCSI_PHASE_DATAOUT );
//transferOffset = command[2];
*transferLength = SCSILengthFromUINT8( &command[ 4 ] );
printf("SET_MODE %02x %02x\n",command[2],command[4]);
//for(int i=command[2];i<command[2]+command[4];i++)
// GDROM_Cmd11_Reply[i] = command[i];
break;
case 0x15: // MODE SELECT(6)
@ -273,7 +278,7 @@ void gdrom_device::ExecCommand( int *transferLength )
SetPhase( SCSI_PHASE_DATAIN );
*transferLength = length;
debugger_break(machine());
//debugger_break(machine());
break;
}
case 0x45: // PLAY AUDIO(10)

View File

@ -47,6 +47,7 @@ private:
cdrom_file *cdrom;
optional_device<cdda_device> m_cdda;
bool is_file;
UINT8 GDROM_Cmd11_Reply[32];
};
// device type definition

View File

@ -440,7 +440,9 @@ READ32_MEMBER(dc_cons_state::dc_mess_gdrom_r)
if( atapi_xferlen == 0 )
{
atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
printf("Read from SCSI\n");
//debugger_break(machine());
gdrom_set_status(ATAPI_STAT_DRQ,false);
atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;
gdrom_raise_irq();
}
@ -449,6 +451,7 @@ READ32_MEMBER(dc_cons_state::dc_mess_gdrom_r)
else
{
data = 0;
printf("Read from empty SCSI queue\n");
}
return data;
@ -504,7 +507,7 @@ WRITE32_MEMBER(dc_cons_state::dc_mess_gdrom_w )
gdrom_raise_irq();
// not sure here, but clear DRQ at least?
atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
gdrom_set_status(ATAPI_STAT_DRQ,false);
printf("cdata wait status\n");
}
}
@ -560,7 +563,7 @@ WRITE32_MEMBER(dc_cons_state::dc_mess_gdrom_w )
{
//gdrom_set_status(ATAPI_STAT_SERVDSC,true);
/* Ok? */
gdrom_set_status(ATAPI_STAT_DRQ,false);
gdrom_set_status(ATAPI_STAT_DRQ,true);
//atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_DRQ | ATAPI_STAT_SERVDSC | ATAPI_STAT_DRQ;
}
atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;