From ab2c58ca7174eafcd1b614ecd6dbe3085c22de42 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Thu, 29 Nov 2012 18:55:10 +0000 Subject: [PATCH] Added 8" DSSD floppy type, WD177x inverted bus, and fixed DSKCHG signal. (nw) --- src/emu/imagedev/floppy.c | 31 +++++++++++++++++++++++++++++-- src/emu/imagedev/floppy.h | 12 ++++++++++++ src/emu/machine/wd_fdc.c | 29 +++++++++++++++++++++++++---- src/lib/formats/wd177x_dsk.h | 2 +- 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/src/emu/imagedev/floppy.c b/src/emu/imagedev/floppy.c index 00d4b3832bd..f3a0cf4da2b 100644 --- a/src/emu/imagedev/floppy.c +++ b/src/emu/imagedev/floppy.c @@ -27,6 +27,7 @@ const device_type FLOPPY_525_DD = &device_creator; const device_type FLOPPY_525_QD = &device_creator; const device_type FLOPPY_525_HD = &device_creator; const device_type FLOPPY_8_SSSD = &device_creator; +const device_type FLOPPY_8_DSSD = &device_creator; const device_type FLOPPY_8_SSDD = &device_creator; const device_type FLOPPY_8_DSDD = &device_creator; @@ -201,7 +202,7 @@ void floppy_image_device::device_start() cyl = 0; ss = 0; stp = 1; - dskchg = 0; + dskchg = exists() ? 1 : 0; index_timer = timer_alloc(0); image_dirty = false; } @@ -364,6 +365,7 @@ void floppy_image_device::index_resync() if(new_idx != idx) { idx = new_idx; + if (!cur_index_pulse_cb.isnull()) cur_index_pulse_cb(this, idx); } @@ -1142,7 +1144,7 @@ void floppy_525_hd::handled_variants(UINT32 *variants, int &var_count) const } floppy_8_sssd::floppy_8_sssd(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - floppy_image_device(mconfig, FLOPPY_8_SSSD, "8\" single density floppy drive", tag, owner, clock) + floppy_image_device(mconfig, FLOPPY_8_SSSD, "8\" single density single sided floppy drive", tag, owner, clock) { } @@ -1165,6 +1167,31 @@ void floppy_8_sssd::handled_variants(UINT32 *variants, int &var_count) const variants[var_count++] = floppy_image::SSSD; } +floppy_8_dssd::floppy_8_dssd(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + floppy_image_device(mconfig, FLOPPY_8_SSSD, "8\" single density double sided floppy drive", tag, owner, clock) +{ +} + +floppy_8_dssd::~floppy_8_dssd() +{ +} + +void floppy_8_dssd::setup_characteristics() +{ + form_factor = floppy_image::FF_8; + tracks = 77; + sides = 2; + motor_always_on = true; + set_rpm(360); +} + +void floppy_8_dssd::handled_variants(UINT32 *variants, int &var_count) const +{ + var_count = 0; + variants[var_count++] = floppy_image::SSSD; + variants[var_count++] = floppy_image::DSSD; +} + floppy_8_ssdd::floppy_8_ssdd(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : floppy_image_device(mconfig, FLOPPY_8_DSDD, "8\" double density single sided floppy drive", tag, owner, clock) { diff --git a/src/emu/imagedev/floppy.h b/src/emu/imagedev/floppy.h index 6937cee2013..1d104eb49e3 100644 --- a/src/emu/imagedev/floppy.h +++ b/src/emu/imagedev/floppy.h @@ -352,6 +352,17 @@ protected: virtual void setup_characteristics(); }; +class floppy_8_dssd : public floppy_image_device { +public: + floppy_8_dssd(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~floppy_8_dssd(); + virtual void handled_variants(UINT32 *variants, int &var_count) const; + virtual void device_config_complete() { m_shortname = "floppy_8_dssd"; } + virtual const char *image_interface() const { return "floppy_8"; } +protected: + virtual void setup_characteristics(); +}; + class floppy_8_ssdd : public floppy_image_device { public: floppy_8_ssdd(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -410,6 +421,7 @@ extern const device_type FLOPPY_525_DD; extern const device_type FLOPPY_525_QD; extern const device_type FLOPPY_525_HD; extern const device_type FLOPPY_8_SSSD; +extern const device_type FLOPPY_8_DSSD; extern const device_type FLOPPY_8_SSDD; extern const device_type FLOPPY_8_DSDD; diff --git a/src/emu/machine/wd_fdc.c b/src/emu/machine/wd_fdc.c index 4fd1dc5160d..26d745d7eb0 100644 --- a/src/emu/machine/wd_fdc.c +++ b/src/emu/machine/wd_fdc.c @@ -875,6 +875,8 @@ void wd_fdc_t::do_cmd_w() void wd_fdc_t::cmd_w(UINT8 val) { + if (inverted_bus) val ^= 0xff; + logerror("wd1772 cmd: %02x\n", val); if(intrq && !(intrq_cond & I_IMM)) { @@ -929,7 +931,10 @@ UINT8 wd_fdc_t::status_r() status &= ~S_NRDY; } - return status; + UINT8 val = status; + if (inverted_bus) val ^= 0xff; + + return val; } void wd_fdc_t::do_track_w() @@ -940,6 +945,8 @@ void wd_fdc_t::do_track_w() void wd_fdc_t::track_w(UINT8 val) { + if (inverted_bus) val ^= 0xff; + // No more than one write in flight if(track_buffer != -1) return; @@ -950,7 +957,10 @@ void wd_fdc_t::track_w(UINT8 val) UINT8 wd_fdc_t::track_r() { - return track; + UINT8 val = track; + if (inverted_bus) val ^= 0xff; + + return val; } void wd_fdc_t::do_sector_w() @@ -961,6 +971,8 @@ void wd_fdc_t::do_sector_w() void wd_fdc_t::sector_w(UINT8 val) { + if (inverted_bus) val ^= 0xff; + // No more than one write in flight if(sector_buffer != -1) return; @@ -971,11 +983,16 @@ void wd_fdc_t::sector_w(UINT8 val) UINT8 wd_fdc_t::sector_r() { - return sector; + UINT8 val = sector; + if (inverted_bus) val ^= 0xff; + + return val; } void wd_fdc_t::data_w(UINT8 val) { + if (inverted_bus) val ^= 0xff; + data = val; drop_drq(); } @@ -983,7 +1000,11 @@ void wd_fdc_t::data_w(UINT8 val) UINT8 wd_fdc_t::data_r() { drop_drq(); - return data; + + UINT8 val = data; + if (inverted_bus) val ^= 0xff; + + return val; } void wd_fdc_t::gen_w(int reg, UINT8 val) diff --git a/src/lib/formats/wd177x_dsk.h b/src/lib/formats/wd177x_dsk.h index 75f929eeae4..45abb8120a1 100644 --- a/src/lib/formats/wd177x_dsk.h +++ b/src/lib/formats/wd177x_dsk.h @@ -26,7 +26,7 @@ public: int per_sector_size[40]; // if sector_base_size is 0 int sector_base_id; // 0 or 1 usually, -1 if there's interleave int per_sector_id[40]; // if sector_base_id is -1. If both per are used, then sector per_sector_id[i] has size per_sector_size[i] - int gap_1; // Usually around 544 - number of 4e between index and first IDAM sync + int gap_1; // Usually around 80 - number of 4e between index and first IDAM sync int gap_2; // 22 for <=1.44Mb, 41 for 2.88Mb - number of 4e between sector header and data sync int gap_3; // Usually 84 - number of 4e between sector crc and next IDAM };