summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2021-01-12 21:25:38 +0100
committer Olivier Galibert <galibert@pobox.com>2021-01-15 20:39:21 +0100
commit1b20d1f218643c184c56498f498aa424f78402d5 (patch)
tree2ba2a5448a65d6c6bc38b394eaca55b6564ef85d
parentfc17cb4dc95c1ef26afbc038812f694dd1ef15c8 (diff)
swim2: Add reading, writing gcr up to track 63.
-rw-r--r--src/devices/imagedev/floppy.cpp160
-rw-r--r--src/devices/imagedev/floppy.h28
-rwxr-xr-xsrc/devices/machine/applefdintf.cpp1
-rw-r--r--src/devices/machine/fdc_pll.cpp13
-rw-r--r--src/devices/machine/fdc_pll.h2
-rw-r--r--src/devices/machine/swim2.cpp131
-rw-r--r--src/devices/machine/swim2.h7
-rw-r--r--src/lib/formats/ap_dsk35.cpp6
-rw-r--r--src/mame/machine/mac.cpp2
9 files changed, 269 insertions, 81 deletions
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index fb99ba5dacb..b44ec0c52e5 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -18,7 +18,7 @@
*/
// Show step operation
-#define TRACE_STEP 0
+#define TRACE_STEP 1
#define TRACE_AUDIO 0
#define PITCH_SEEK_SAMPLES 1
@@ -119,8 +119,9 @@ DEFINE_DEVICE_TYPE(ALPS_3255190X, alps_3255190x, "alps_3255190x", "ALPS 32551901
DEFINE_DEVICE_TYPE(IBM_6360, ibm_6360, "ibm_6360", "IBM 6360 8\" single-sided single density floppy drive")
// Mac 3.5" drives
-DEFINE_DEVICE_TYPE(MFD51W, mfd51w_device, "mfd51w", "Apple/Sony 3.5 DD variable-speed drive")
-DEFINE_DEVICE_TYPE(MFD75W, mfd75w_device, "mfd75w", "Apple/Sony 3.5 HD variable-speed drive")
+DEFINE_DEVICE_TYPE(OAD34V, oa_d34v_device, "oa_d34v", "Apple/Sony 3.5 SD (400K GCR)")
+DEFINE_DEVICE_TYPE(MFD51W, mfd51w_device, "mfd51w", "Apple/Sony 3.5 DD (400/800K GCR)")
+DEFINE_DEVICE_TYPE(MFD75W, mfd75w_device, "mfd75w", "Apple/Sony 3.5 HD (Superdrive)")
const floppy_format_type floppy_image_device::default_floppy_formats[] = {
@@ -336,6 +337,7 @@ void floppy_image_device::device_start()
cyl = 0;
subcyl = 0;
ss = 0;
+ actual_ss = 0;
ds = -1;
stp = 1;
wpt = 0;
@@ -354,6 +356,7 @@ void floppy_image_device::device_start()
save_item(NAME(wtg));
save_item(NAME(mon));
save_item(NAME(ss));
+ save_item(NAME(actual_ss));
save_item(NAME(ds));
save_item(NAME(idx));
save_item(NAME(wpt));
@@ -683,6 +686,10 @@ bool floppy_image_device::twosid_r()
return heads == 1;
}
+void floppy_image_device::track_changed()
+{
+}
+
void floppy_image_device::stp_w(int state)
{
// Before spin-up is done, ignore step pulses
@@ -706,6 +713,7 @@ void floppy_image_device::stp_w(int state)
// Do we want a stepper sound?
// We plan for 5 zones with possibly specific sounds
if (m_make_sound) m_sound_out->step(cyl*5/tracks);
+ track_changed();
}
/* Update disk detection if applicable */
if (exists() && !dskchg_writable)
@@ -963,8 +971,12 @@ void floppy_image_device::write_flux(const attotime &start, const attotime &end,
buf.push_back(floppy_image::MG_N);
}
- if(index && (buf[index] & floppy_image::TIME_MASK) == start_pos)
- index--;
+ if((buf[index] & floppy_image::TIME_MASK) == start_pos) {
+ if(index)
+ index--;
+ else
+ index = buf.size() - 1;
+ }
uint32_t cur_mg = buf[index] & floppy_image::MG_MASK;
if(cur_mg == floppy_image::MG_N || cur_mg == floppy_image::MG_D)
@@ -973,6 +985,10 @@ void floppy_image_device::write_flux(const attotime &start, const attotime &end,
uint32_t pos = start_pos;
int ti = 0;
int cells = buf.size();
+ if(transition_count != 0 && trans_pos[0] == pos) {
+ cur_mg = cur_mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
+ ti ++;
+ }
while(pos != end_pos) {
if(buf.size() < cells+10)
buf.resize(cells+200);
@@ -2367,6 +2383,7 @@ void ibm_6360::setup_characteristics()
mac_floppy_device::mac_floppy_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : floppy_image_device(mconfig, type, tag, owner, clock)
{
+ m_has_mfm = false;
}
void mac_floppy_device::device_start()
@@ -2381,48 +2398,72 @@ void mac_floppy_device::device_reset()
floppy_image_device::device_reset();
m_reg = 0;
m_strb = 0;
+ m_mfm = m_has_mfm;
}
+// Initial state of bits f-c (2M, ready, MFM, rd1):
+// 0000 - 400K GCR drive
+// 0001 - 4MB Typhoon drive
+// x011 - Superdrive (x depends on the HD hole of the inserted disk, if any)
+// 1010 - 800K GCR drive
+// 1110 - HD-20 drive
+// 1111 - No drive (pull-up on the sense line)
+
bool mac_floppy_device::wpt_r()
{
static const char *const regnames[16] = {
"Dir", "Step", "Motor", "Eject",
- "RdData0", "MFMDrive", "DoubleSide", "NoDrive",
+ "RdData0", "Superdrive", "DoubleSide", "NoDrive",
"NoDiskInPl", "NoWrProtect", "NotTrack0", "NoTachPulse",
- "RdData1", "MFMModeOn", "NoReady", "NotRevised"
+ "RdData1", "MFMModeOn", "NoReady", "HD"
};
- logerror("fdc disk wpt_r reg %x %s\n", m_reg, regnames[m_reg]);
- if(m_reg == 4)
- machine().debug_break();
+ // actual_ss may have changed after the phases were set
+ m_reg = (m_reg & 7) | (actual_ss ? 8 : 0);
+
+ if(m_reg != 4 && m_reg != 12)
+ logerror("fdc disk sense reg %x %s %p\n", m_reg, regnames[m_reg], image.get());
switch(m_reg) {
+ case 0x1: // Step signal
+ // We don't do the delay
+ return true;
+
case 0x2: // Is the motor on?
return mon;
case 0x4: // Used when reading data, result ignored
return false;
- case 0x5: // Is it a superdrive?
- return true;
+ case 0x5: // Is it a superdrive (supports 1.4M MFM) ?
+ return m_has_mfm;
case 0x6: // Is the drive double-sided?
- return true;
+ return sides == 2;
- case 0x7: // Does drive exist?
- return true;
+ case 0x7: // Does the drive exist?
+ return false;
case 0x8: // Is there a disk in the drive?
- return image != nullptr;
+ return image.get() == nullptr;
case 0x9: // Is the disk write-protected?
- return wpt;
+ return !wpt;
case 0xa: // Not on track 0?
- return cyl == 0;
+ return cyl != 0;
- case 0xf: // Does it implement the new interface?
- return true;
+ case 0xc: // Another identification bit
+ return m_rd1;
+
+ case 0xd: // Is the current mode GCR or MFM?
+ return m_mfm;
+
+ case 0xe: // Is the floppy ready?
+ return ready;
+
+ case 0xf: // Does it implement the new interface *or* is the current disk is 1.4M MFM (superdrive only)
+ return is_2m();
default:
return false;
@@ -2440,7 +2481,7 @@ void mac_floppy_device::seek_phase_w(int phases)
bool prev_strb = m_strb;
- m_reg = (phases & 7) | (ss ? 8 : 0);
+ m_reg = (phases & 7) | (actual_ss ? 8 : 0);
m_strb = (phases >> 3) & 1;
if(m_strb && !prev_strb) {
@@ -2450,9 +2491,10 @@ void mac_floppy_device::seek_phase_w(int phases)
dir_w(0);
break;
- case 0x1: // Step
- logerror("cmd step\n");
+ case 0x1: // Step on
+ logerror("cmd step on\n");
stp_w(0);
+ // There should be a delay, but it's not necessary
stp_w(1);
break;
@@ -2480,6 +2522,20 @@ void mac_floppy_device::seek_phase_w(int phases)
call_unload();
break;
+ case 0x9: // MFM mode on
+ logerror("cmd mfm on\n");
+ if(m_has_mfm) {
+ m_mfm = true;
+ track_changed();
+ }
+ break;
+
+ case 0xd: // GCR mode on
+ logerror("cmd gcr on\n");
+ m_mfm = false;
+ track_changed();
+ break;
+
default:
logerror("cmd reg %x %s\n", m_reg, regnames[m_reg]);
break;
@@ -2487,8 +2543,51 @@ void mac_floppy_device::seek_phase_w(int phases)
}
}
+void mac_floppy_device::track_changed()
+{
+ floppy_image_device::track_changed();
+
+ float new_rpm;
+ if(m_mfm)
+ new_rpm = 300;
+ else if(cyl <= 15)
+ new_rpm = 394;
+ else if(cyl <= 31)
+ new_rpm = 429;
+ else if(cyl <= 47)
+ new_rpm = 472;
+ else if(cyl <= 63)
+ new_rpm = 525;
+ else
+ new_rpm = 590;
+
+ if(rpm != new_rpm)
+ set_rpm(new_rpm);
+}
+
+
+oa_d34v_device::oa_d34v_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : mac_floppy_device(mconfig, OAD34V, tag, owner, clock)
+{
+}
+
+void oa_d34v_device::setup_characteristics()
+{
+ form_factor = floppy_image::FF_35;
+ tracks = 80;
+ sides = 1;
+ set_rpm(394);
+
+ variants.push_back(floppy_image::SSDD);
+}
+
+bool oa_d34v_device::is_2m() const
+{
+ return false;
+}
+
mfd51w_device::mfd51w_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : mac_floppy_device(mconfig, MFD51W, tag, owner, clock)
{
+ m_has_mfm = true;
}
void mfd51w_device::setup_characteristics()
@@ -2496,15 +2595,20 @@ void mfd51w_device::setup_characteristics()
form_factor = floppy_image::FF_35;
tracks = 80;
sides = 2;
- set_rpm(300);
+ set_rpm(394);
- variants.push_back(floppy_image::SSSD);
variants.push_back(floppy_image::SSDD);
variants.push_back(floppy_image::DSDD);
}
+bool mfd51w_device::is_2m() const
+{
+ return true;
+}
+
mfd75w_device::mfd75w_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : mac_floppy_device(mconfig, MFD75W, tag, owner, clock)
{
+ m_has_mfm = true;
}
void mfd75w_device::setup_characteristics()
@@ -2514,8 +2618,12 @@ void mfd75w_device::setup_characteristics()
sides = 2;
set_rpm(300);
- variants.push_back(floppy_image::SSSD);
variants.push_back(floppy_image::SSDD);
variants.push_back(floppy_image::DSDD);
variants.push_back(floppy_image::DSHD);
}
+
+bool mfd75w_device::is_2m() const
+{
+ return true;
+}
diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h
index 82cc39dcfdb..d63c29e66d7 100644
--- a/src/devices/imagedev/floppy.h
+++ b/src/devices/imagedev/floppy.h
@@ -114,7 +114,7 @@ public:
virtual void seek_phase_w(int phases);
void stp_w(int state);
void dir_w(int state) { dir = state; }
- void ss_w(int state) { if (sides > 1) ss = state; }
+ void ss_w(int state) { actual_ss = state; if (sides > 1) ss = state; }
void inuse_w(int state) { }
void dskchg_w(int state) { if (dskchg_writable) dskchg = state; }
void ds_w(int state) { ds = state; check_led(); }
@@ -146,6 +146,7 @@ protected:
// device_image_interface implementation
virtual const software_list_loader &get_software_list_loader() const override { return image_software_list_loader::instance(); }
+ virtual void track_changed();
virtual void setup_characteristics() = 0;
void init_floppy_load(bool write_supported);
@@ -173,7 +174,7 @@ protected:
int stp; /* step */
int wtg; /* write gate */
int mon; /* motor on */
- int ss; /* side select */
+ int ss, actual_ss; /* side select (forced to 0 if single-sided drive / actual value) */
int ds; /* drive select */
/* state of output lines */
@@ -284,21 +285,41 @@ public:
protected:
u8 m_reg;
bool m_strb;
+ bool m_mfm, m_has_mfm;
+ bool m_rd1;
mac_floppy_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
virtual void device_reset() override;
+ virtual void track_changed() override;
+
+ virtual bool is_2m() const = 0;
};
+// 400K GCR
+class oa_d34v_device : public mac_floppy_device {
+public:
+ oa_d34v_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ virtual ~oa_d34v_device() = default;
+protected:
+ virtual void setup_characteristics() override;
+
+ virtual bool is_2m() const override;
+};
+
+// 400/800K GCR (e.g. dual-sided)
class mfd51w_device : public mac_floppy_device {
public:
mfd51w_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~mfd51w_device() = default;
protected:
virtual void setup_characteristics() override;
+
+ virtual bool is_2m() const override;
};
+// 400/800K GCR + 1.44 MFM (Superdrive)
class mfd75w_device : public mac_floppy_device {
public:
mfd75w_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -306,8 +327,11 @@ public:
protected:
virtual void setup_characteristics() override;
+
+ virtual bool is_2m() const override;
};
+DECLARE_DEVICE_TYPE(OAD34V, oa_d34v_device)
DECLARE_DEVICE_TYPE(MFD51W, mfd51w_device)
DECLARE_DEVICE_TYPE(MFD75W, mfd75w_device)
diff --git a/src/devices/machine/applefdintf.cpp b/src/devices/machine/applefdintf.cpp
index 8d859601c6b..be77f5d56b2 100755
--- a/src/devices/machine/applefdintf.cpp
+++ b/src/devices/machine/applefdintf.cpp
@@ -31,6 +31,7 @@ void applefdintf_device::floppies_525(device_slot_interface &device)
void applefdintf_device::floppies_35(device_slot_interface &device)
{
+ device.option_add("35sd", OAD34V);
device.option_add("35dd", MFD51W);
device.option_add("35hd", MFD75W);
}
diff --git a/src/devices/machine/fdc_pll.cpp b/src/devices/machine/fdc_pll.cpp
index 2e8694d2f01..4b7d746d87c 100644
--- a/src/devices/machine/fdc_pll.cpp
+++ b/src/devices/machine/fdc_pll.cpp
@@ -4,17 +4,6 @@
#include "fdc_pll.h"
#include "imagedev/floppy.h"
-std::string fdc_pll_t::tts(attotime t)
-{
- char buf[256];
- bool neg = t.seconds() < 0;
- if(neg)
- t = attotime::zero - t;
- int nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND;
- sprintf(buf, "%c%3d.%03d,%03d,%03d", neg ? '-' : ' ', int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000);
- return buf;
-}
-
void fdc_pll_t::set_clock(const attotime &_period)
{
period = _period;
@@ -74,7 +63,7 @@ int fdc_pll_t::feed_read_data(attotime &tm, const attotime& edge, const attotime
#if 0
if(!edge.is_never())
- fprintf(stderr, "ctime=%s, transition_time=%s, next=%s, pha=%s\n", tts(ctime).c_str(), tts(edge).c_str(), tts(next).c_str(), tts(phase_adjust).c_str());
+ fprintf(stderr, "%s\n", util::string_format("fdc pll ctime=%s, transition_time=%s, next=%s, pha=%s\n", ctime.to_string(), edge.to_string(), next.to_string(), phase_adjust.to_string()).c_str());
#endif
if(next > limit)
diff --git a/src/devices/machine/fdc_pll.h b/src/devices/machine/fdc_pll.h
index fb2bb35fe60..e232260162c 100644
--- a/src/devices/machine/fdc_pll.h
+++ b/src/devices/machine/fdc_pll.h
@@ -29,8 +29,6 @@ public:
void start_writing(const attotime &tm);
void commit(floppy_image_device *floppy, const attotime &tm);
void stop_writing(floppy_image_device *floppy, const attotime &tm);
-
- std::string tts(attotime tm);
};
#endif // MAME_MACHINE_FDC_PLL_H
diff --git a/src/devices/machine/swim2.cpp b/src/devices/machine/swim2.cpp
index 9b9ff9fac60..a7ea6d8162a 100644
--- a/src/devices/machine/swim2.cpp
+++ b/src/devices/machine/swim2.cpp
@@ -55,6 +55,8 @@ void swim2_device::device_reset()
m_devsel_cb(0);
m_sel35_cb(true);
m_hdsel_cb(false);
+ m_flux_write_start = 0;
+ m_flux_write_count = 0;
m_last_sync = machine().time().as_ticks(clock());
}
@@ -80,6 +82,9 @@ floppy_image_device *swim2_device::get_floppy() const
void swim2_device::flush_write(u64 when)
{
+ if(!m_flux_write_start)
+ return;
+
if(!when)
when = m_last_sync;
@@ -88,14 +93,13 @@ void swim2_device::flush_write(u64 when)
m_flux_write_count--;
attotime start = cycles_to_time(m_flux_write_start);
attotime end = cycles_to_time(when);
+ logerror("wbuf start %s\n", start.to_string());
std::vector<attotime> fluxes(m_flux_write_count);
- u32 i = 0;
- if(m_flux_write_count && m_flux_write[0] == m_flux_write_start)
- i++;
- while(i != m_flux_write_count) {
+ for(u32 i=0; i != m_flux_write_count; i++) {
fluxes[i] = cycles_to_time(m_flux_write[i]);
- i++;
+ logerror("wbuf flux %s\n", fluxes[i].to_string());
}
+ logerror("wbuf end %s\n", end.to_string());
m_floppy->write_flux(start, end, m_flux_write_count, m_flux_write_count ? &fluxes[0] : nullptr);
}
m_flux_write_count = 0;
@@ -172,23 +176,24 @@ u8 swim2_device::read(offs_t offset)
h |= 0x02;
}
// addata on 4
- if(m_floppy && !m_floppy->wpt_r())
+ if(!m_floppy || m_floppy->wpt_r())
h |= 0x08;
if(m_error)
h |= 0x20;
if(m_mode & 0x10) {
// write
if(m_fifo_pos == 0)
- h |= 0x40;
+ h |= 0xc0;
+ else if(m_fifo_pos == 1)
+ h |= 0x80;
} else {
// read
if(m_fifo_pos == 2)
- h |= 0x40;
+ h |= 0xc0;
+ else if(m_fifo_pos == 1)
+ h |= 0x80;
}
-
- if(!m_error && m_fifo_pos == 1)
- h |= 0x80;
- logerror("handshake %02x\n", h);
+ // logerror("handshake %02x\n", h);
return h;
}
@@ -209,6 +214,7 @@ void swim2_device::write(offs_t offset, u8 data)
"data", "mark", "crc", "param", "phases", "setup", "mode0", "mode1",
"?8", "?9", "?a", "?b", "?c", "?d", "?e", "?f"
};
+
switch(offset & 7) {
case 0:
if(fifo_push(data) && !m_error)
@@ -281,15 +287,38 @@ void swim2_device::write(offs_t offset, u8 data)
if((m_mode & 0x18) == 0x18 && ((prev_mode & 0x18) != 0x18)) {
// Entering write mode
m_current_bit = 0;
- logerror("%s write start\n", machine().time().to_string());
- machine().debug_break();
+ logerror("%s write start %s %s floppy=%p\n", machine().time().to_string(), m_setup & 0x40 ? "gcr" : "mfm", m_setup & 0x08 ? "fclk/2" : "fclk", m_floppy);
+ m_flux_write_start = m_last_sync;
+ m_flux_write_count = 0;
+
} else if((prev_mode & 0x18) == 0x18 && (m_mode & 0x18) != 0x18) {
// Exiting write mode
flush_write();
+ m_flux_write_start = 0;
m_current_bit = 0xff;
m_half_cycles_before_change = 0;
logerror("%s write end\n", machine().time().to_string());
}
+
+ if((m_mode & 0x18) == 0x08 && ((prev_mode & 0x18) != 0x08)) {
+ // Entering read mode
+ m_current_bit = 0;
+ m_sr = 0;
+ logerror("%s read start %s %s floppy=%p\n", machine().time().to_string(), m_setup & 0x04 ? "gcr" : "mfm", m_setup & 0x08 ? "fclk/2" : "fclk", m_floppy);
+
+ m_pll.reset(machine().time());
+ static const int cycles_per_cell[4] = { 16, 31, 31, 63 };
+
+ m_pll.set_clock(attotime::from_ticks(cycles_per_cell[(m_setup >> 2) & 3], clock()));
+ logerror("PLL read clock %s\n", attotime::from_ticks(cycles_per_cell[(m_setup >> 2) & 3], clock()).to_string());
+
+ } else if((prev_mode & 0x18) == 0x08 && (m_mode & 0x18) != 0x08) {
+ // Exiting read mode
+ flush_write();
+ m_current_bit = 0xff;
+ m_half_cycles_before_change = 0;
+ logerror("%s read end\n", machine().time().to_string());
+ }
}
u64 swim2_device::time_to_cycles(const attotime &tm) const
@@ -351,29 +380,26 @@ void swim2_device::sync()
return;
}
- // We count in half-cycles but only toggle write on full cycles
-
- u32 cycles = (next_sync - m_last_sync) << 1;
- logerror("ACTIVE %s %d-%d (%d)\n", m_mode & 0x10 ? "write" : "read", m_last_sync, next_sync, cycles);
-
- while(cycles) {
- // logerror("half cycles avail %d needed %d\n", cycles, m_half_cycles_before_change);
- if(m_half_cycles_before_change) {
- if(cycles >= m_half_cycles_before_change) {
- cycles -= m_half_cycles_before_change;
- m_half_cycles_before_change = 0;
- } else {
- m_half_cycles_before_change -= cycles;
- cycles = 0;
- break;
- }
- }
+ logerror("ACTIVE %s %d-%d\n", m_mode & 0x10 ? "write" : "read", m_last_sync, next_sync);
- if(m_flux_write_count > 32)
- flush_write(next_sync - (cycles >> 1));
+ if(m_mode & 0x10) {
+ // We count in half-cycles but only toggle write on full cycles
+ u32 cycles = (next_sync - m_last_sync) << 1;
- if(m_mode & 0x10) {
- // Write mode
+ // Write mode
+ while(cycles) {
+ // logerror("half cycles avail %d needed %d\n", cycles, m_half_cycles_before_change);
+ if(m_half_cycles_before_change) {
+ if(cycles >= m_half_cycles_before_change) {
+ cycles -= m_half_cycles_before_change;
+ m_half_cycles_before_change = 0;
+ } else {
+ m_half_cycles_before_change -= cycles;
+ cycles = 0;
+ break;
+ }
+ }
+
if(m_tss_output & 0xc) {
logerror("SR %03x.%d TSS %c%c\n", m_sr, m_current_bit, m_tss_output & 8 ? m_tss_output & 2 ? '1' : '0' : '.', m_tss_output & 4 ? m_tss_output & 1 ? '1' : '0' : '.');
@@ -386,6 +412,8 @@ void swim2_device::sync()
m_tss_output = 0;
}
if(bit) {
+ if(m_flux_write_count == 32)
+ flush_write(next_sync - (cycles >> 1));
m_flux_write[m_flux_write_count ++] = next_sync - (cycles >> 1);
m_half_cycles_before_change = 63;
} else
@@ -400,6 +428,8 @@ void swim2_device::sync()
if(m_current_bit == 0) {
u16 r = fifo_pop();
+ if(m_setup & 0x40)
+ logerror("DATAW %02x\n", r);
logerror("fifo pop %03x\n", r);
if(r == 0xffff && !m_error) {
m_error |= 0x01;
@@ -428,10 +458,39 @@ void swim2_device::sync()
else
m_tss_output = tss[m_tss_sr & 3];
}
+
continue;
+ }
+ } else {
+ attotime limit = machine().time();
+ if(m_setup & 0x04) {
+ // GCR mode
+ for(;;) {
+ attotime when;
+ int bit = m_pll.get_next_bit(when, m_floppy, limit);
+ if(bit == -1)
+ break;
+ m_sr = ((m_sr << 1) | bit) & 0xff;
+ logerror("%s: bit %d, sr=%02x\n", when.to_string(), bit, m_sr);
+ if(m_sr & 0x80) {
+ static u8 m1, m2, m3;
+ m1 = m2;
+ m2 = m3;
+ m3 = m_sr;
+ logerror("DATAR %02x\n", m_sr);
+ if(m1 == 0xd5 && m2 == 0xaa && m3 == 0xad)
+ machine().debug_break();
+ logerror("read byte %02x\n", m_sr);
+ if(fifo_push(m_sr) && !m_error)
+ m_error |= 0x01;
+ m_sr = 0;
+ }
+ }
} else {
- cycles = 0;
+ // MFM mode
}
+
}
+
m_last_sync = next_sync;
}
diff --git a/src/devices/machine/swim2.h b/src/devices/machine/swim2.h
index bbb9e0116cd..3045cd710ed 100644
--- a/src/devices/machine/swim2.h
+++ b/src/devices/machine/swim2.h
@@ -11,6 +11,7 @@
#pragma once
#include "applefdintf.h"
+#include "fdc_pll.h"
//**************************************************************************
@@ -53,9 +54,11 @@ private:
u64 m_last_sync;
u64 m_flux_write_start;
- std::array<u64, 36> m_flux_write;
+ std::array<u64, 32> m_flux_write;
u32 m_flux_write_count;
-
+
+ fdc_pll_t m_pll;
+
u64 time_to_cycles(const attotime &tm) const;
attotime cycles_to_time(u64 cycles) const;
diff --git a/src/lib/formats/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp
index c59d28a0a4b..73ce20bf8e7 100644
--- a/src/lib/formats/ap_dsk35.cpp
+++ b/src/lib/formats/ap_dsk35.cpp
@@ -1316,6 +1316,12 @@ bool dc42_format::load(io_generic *io, uint32_t form_factor, const std::vector<u
pos_tag += 12;
}
io_generic_read(io, data+12, pos_data, 512);
+ for(int kk0 = 0; kk0 != 512; kk0 += 16) {
+ printf("%02d %d %2d %03x:", track, head, i, kk0);
+ for(int kk1 = 0; kk1 != 16; kk1++)
+ printf(" %02x", data[12+kk0+kk1]);
+ printf("\n");
+ }
pos_data += 512;
si = (si + 2) % ns;
if(si == 0)
diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp
index cd0f83cbf5a..525cdcab7e5 100644
--- a/src/mame/machine/mac.cpp
+++ b/src/mame/machine/mac.cpp
@@ -1135,7 +1135,7 @@ void mac_state::machine_reset()
// Egret currently needs more dramatic VIA slowdowns. Need to determine what's realistic.
if (ADB_IS_EGRET)
{
- m_via_cycles *= 35;
+ m_via_cycles *= 2;
}
// default to 32-bit mode on LC