summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2012-11-16 18:37:23 +0000
committer Curt Coder <curtcoder@mail.com>2012-11-16 18:37:23 +0000
commit664ce380729736e4f09a5c465960ea1ef0301a77 (patch)
tree9eeea852dd6e5dc77296f856695a9bea9cef01a9
parent3d7069cd20a3baa45149a44c95d3ca54b76a2c1c (diff)
(MESS) wd1772: Added WD2797 variant, side select output, and immediate interrupt command (0xd8). [Curt Coder]
-rw-r--r--src/mess/machine/wd1772.c42
-rw-r--r--src/mess/machine/wd1772.h15
2 files changed, 56 insertions, 1 deletions
diff --git a/src/mess/machine/wd1772.c b/src/mess/machine/wd1772.c
index 44778cf1fd4..a88cf96ef85 100644
--- a/src/mess/machine/wd1772.c
+++ b/src/mess/machine/wd1772.c
@@ -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)
{
}
@@ -1790,5 +1811,24 @@ 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;
+}
diff --git a/src/mess/machine/wd1772.h b/src/mess/machine/wd1772.h
index fe51df9073f..8a27ea60cb7 100644
--- a/src/mess/machine/wd1772.h
+++ b/src/mess/machine/wd1772.h
@@ -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