Moved the adaptec mode sense handling into the ACB4070 device [smf]

This commit is contained in:
smf- 2013-09-19 10:18:21 +00:00
parent aabd71c42f
commit bff72b3f0b
4 changed files with 46 additions and 48 deletions

View File

@ -61,29 +61,6 @@ static const char *const phasenames[] =
#define FORMAT_UNIT_TIMEOUT 5
struct adaptec_sense_t
{
// parameter list
UINT8 reserved1[3];
UINT8 length;
// descriptor list
UINT8 density;
UINT8 reserved2[4];
UINT8 block_size[3];
// drive parameter list
UINT8 format_code;
UINT8 cylinder_count[2];
UINT8 head_count;
UINT8 reduced_write[2];
UINT8 write_precomp[2];
UINT8 landing_zone;
UINT8 step_pulse_code;
UINT8 bit_flags;
UINT8 sectors_per_track;
};
/*
LOGLEVEL
0 no logging,
@ -172,9 +149,9 @@ void scsihle_device::device_timer(emu_timer &timer, device_timer_id tid, int par
if(IS_COMMAND(SCSI_CMD_FORMAT_UNIT) && (data_idx==0))
{
scsi_change_phase(SCSI_PHASE_STATUS);
}
break;
}
break;
}
}
void scsihle_device::scsibus_exec_command()
@ -448,7 +425,6 @@ void scsihle_device::scsi_in( UINT32 data, UINT32 mask )
if(data_idx == 0 && bytes_left == 0)
{
check_process_dataout();
scsi_change_phase(SCSI_PHASE_STATUS);
}
else
@ -512,27 +488,6 @@ void scsihle_device::scsi_in( UINT32 data, UINT32 mask )
}
}
void scsihle_device::check_process_dataout()
{
int capacity=0;
int tracks;
adaptec_sense_t *sense;
LOG(1,"SCSIBUS:check_process_dataout cmd=%02X\n",command[0]);
switch (command[0])
{
case SCSI_CMD_MODE_SELECT:
sense=(adaptec_sense_t *)buffer;
tracks=(sense->cylinder_count[0]<<8)+sense->cylinder_count[1];
capacity=(tracks * sense->head_count * 17);
LOG(1,"Tracks=%d, Heads=%d sec/track=%d\n",tracks,sense->head_count,sense->sectors_per_track);
LOG(1,"Setting disk capacity to %d blocks\n",capacity);
dump_data_bytes(0x16);
break;
}
}
// get the length of a SCSI command based on it's command byte type
int scsihle_device::get_scsi_cmd_len(int cbyte)
{

View File

@ -41,7 +41,6 @@ private:
void scsibus_read_data();
void scsibus_write_data();
void scsibus_exec_command();
void check_process_dataout();
void dump_command_bytes();
void dump_data_bytes(int count);
void dump_bytes(UINT8 *buff, int count);

View File

@ -33,8 +33,27 @@ void acb4070_device::ExecCommand()
m_transfer_length = TRANSFERLENGTH_DATA_BUFFER;
break;
case SCSI_CMD_MODE_SELECT:
m_phase = SCSI_PHASE_DATAOUT;
m_transfer_length = SCSILengthFromUINT8( &command[ 4 ] );
break;
default:
scsihd_device::ExecCommand();
break;
}
}
void acb4070_device::WriteData( UINT8 *data, int dataLength )
{
switch( command[ 0 ] )
{
case SCSI_CMD_MODE_SELECT:
adaptec_sense_t *sense=(adaptec_sense_t *) data;
int tracks=(sense->cylinder_count[0]<<8)+sense->cylinder_count[1];
int capacity=(tracks * sense->head_count * 17);
logerror("Tracks=%d, Heads=%d sec/track=%d\n",tracks,sense->head_count,sense->sectors_per_track);
logerror("Setting disk capacity to %d blocks\n",capacity);
break;
}
}

View File

@ -12,6 +12,31 @@ public:
acb4070_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void ExecCommand();
virtual void WriteData( UINT8 *data, int dataLength );
private:
struct adaptec_sense_t
{
// parameter list
UINT8 reserved1[3];
UINT8 length;
// descriptor list
UINT8 density;
UINT8 reserved2[4];
UINT8 block_size[3];
// drive parameter list
UINT8 format_code;
UINT8 cylinder_count[2];
UINT8 head_count;
UINT8 reduced_write[2];
UINT8 write_precomp[2];
UINT8 landing_zone;
UINT8 step_pulse_code;
UINT8 bit_flags;
UINT8 sectors_per_track;
};
};
// device type definition