(MESS) wd1772: Added WD2797 variant, side select output, and immediate interrupt command (0xd8). [Curt Coder]

This commit is contained in:
Curt Coder 2012-11-16 18:37:23 +00:00
parent 3d7069cd20
commit 664ce38072
2 changed files with 56 additions and 1 deletions

View File

@ -39,6 +39,7 @@ const device_type WD1770x = &device_creator<wd1770_t>;
const device_type WD1772x = &device_creator<wd1772_t>;
const device_type WD1773x = &device_creator<wd1773_t>;
const device_type WD2793x = &device_creator<wd2793_t>;
const device_type WD2797x = &device_creator<wd2797_t>;
wd177x_t::wd177x_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, type, name, tag, owner, clock)
@ -307,6 +308,8 @@ void wd177x_t::read_sector_start()
main_state = READ_SECTOR;
status = (status & ~(S_CRC|S_LOST|S_RNF|S_WP|S_DDM)) | S_BUSY;
drop_drq();
if (has_side_select() && floppy)
floppy->ss_w(BIT(command, 1));
sub_state = has_motor() ? SPINUP : SPINUP_DONE;
status_type_1 = false;
read_sector_continue();
@ -391,6 +394,8 @@ void wd177x_t::read_track_start()
main_state = READ_TRACK;
status = (status & ~(S_LOST|S_RNF)) | S_BUSY;
drop_drq();
if (has_side_select() && floppy)
floppy->ss_w(BIT(command, 1));
sub_state = has_motor() ? SPINUP : SPINUP_DONE;
status_type_1 = false;
read_track_continue();
@ -453,6 +458,8 @@ void wd177x_t::read_id_start()
main_state = READ_ID;
status = (status & ~(S_WP|S_DDM|S_LOST|S_RNF)) | S_BUSY;
drop_drq();
if (has_side_select() && floppy)
floppy->ss_w(BIT(command, 1));
sub_state = has_motor() ? SPINUP : SPINUP_DONE;
status_type_1 = false;
read_id_continue();
@ -513,6 +520,8 @@ void wd177x_t::write_track_start()
main_state = WRITE_TRACK;
status = (status & ~(S_WP|S_DDM|S_LOST|S_RNF)) | S_BUSY;
drop_drq();
if (has_side_select() && floppy)
floppy->ss_w(BIT(command, 1));
sub_state = has_motor() ? SPINUP : SPINUP_DONE;
status_type_1 = false;
write_track_continue();
@ -590,6 +599,8 @@ void wd177x_t::write_sector_start()
main_state = WRITE_SECTOR;
status = (status & ~(S_CRC|S_LOST|S_RNF|S_WP|S_DDM)) | S_BUSY;
drop_drq();
if (has_side_select() && floppy)
floppy->ss_w(BIT(command, 1));
sub_state = has_motor() ? SPINUP : SPINUP_DONE;
status_type_1 = false;
write_sector_continue();
@ -675,7 +686,12 @@ void wd177x_t::interrupt_start()
drop_drq();
motor_timeout = 0;
}
if(command & 0x0f) {
if(command & 0x08) {
intrq = true;
if(!intrq_cb.isnull())
intrq_cb(intrq);
}
if(command & 0x07) {
logerror("%s: unhandled interrupt generation (%02x)\n", ttsn().cstr(), command);
}
}
@ -1736,6 +1752,11 @@ bool wd177x_t::has_side_check() const
return false;
}
bool wd177x_t::has_side_select() const
{
return false;
}
wd1770_t::wd1770_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd177x_t(mconfig, WD1770x, "WD1770", tag, owner, clock)
{
}
@ -1789,6 +1810,25 @@ bool wd2793_t::has_motor() const
}
bool wd2793_t::has_side_check() const
{
return true;
}
wd2797_t::wd2797_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd177x_t(mconfig, WD2797x, "WD2797", tag, owner, clock)
{
}
bool wd2797_t::has_motor() const
{
return false;
}
bool wd2797_t::has_side_check() const
{
return false;
}
bool wd2797_t::has_side_select() const
{
return true;
}

View File

@ -16,6 +16,9 @@
#define MCFG_WD2793x_ADD(_tag, _clock) \
MCFG_DEVICE_ADD(_tag, WD2793x, _clock)
#define MCFG_WD2797x_ADD(_tag, _clock) \
MCFG_DEVICE_ADD(_tag, WD2797x, _clock)
class wd177x_t : public device_t {
public:
typedef delegate<void (bool state)> line_cb;
@ -63,6 +66,7 @@ protected:
virtual bool has_motor() const = 0;
virtual bool has_side_check() const;
virtual bool has_side_select() const;
virtual int step_time(int mode) const;
virtual int settle_time() const;
@ -334,9 +338,20 @@ protected:
virtual bool has_side_check() const;
};
class wd2797_t : public wd177x_t {
public:
wd2797_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
virtual bool has_motor() const;
virtual bool has_side_check() const;
virtual bool has_side_select() const;
};
extern const device_type WD1770x;
extern const device_type WD1772x;
extern const device_type WD1773x;
extern const device_type WD2793x;
extern const device_type WD2797x;
#endif