mirror of
https://github.com/holub/mame
synced 2025-06-30 16:00:01 +03:00
2gs: Better floppy interaction
This commit is contained in:
parent
b88753794a
commit
5633b3a20c
@ -192,7 +192,7 @@ floppy_image_device::floppy_image_device(const machine_config &mconfig, device_t
|
|||||||
motor_always_on(false),
|
motor_always_on(false),
|
||||||
dskchg_writable(false),
|
dskchg_writable(false),
|
||||||
has_trk00_sensor(true),
|
has_trk00_sensor(true),
|
||||||
dir(0), stp(0), wtg(0), mon(0), ss(0), ds(-1), idx(0), wpt(0), rdy(0), dskchg(0),
|
dir(0), stp(0), wtg(0), mon(0), ss(0), ds(-1), idx(0), wpt(1), rdy(0), dskchg(0),
|
||||||
ready(false),
|
ready(false),
|
||||||
rpm(0),
|
rpm(0),
|
||||||
angular_speed(0),
|
angular_speed(0),
|
||||||
@ -340,7 +340,7 @@ void floppy_image_device::device_start()
|
|||||||
actual_ss = 0;
|
actual_ss = 0;
|
||||||
ds = -1;
|
ds = -1;
|
||||||
stp = 1;
|
stp = 1;
|
||||||
wpt = 0;
|
wpt = 1;
|
||||||
dskchg = exists() ? 1 : 0;
|
dskchg = exists() ? 1 : 0;
|
||||||
index_timer = timer_alloc(0);
|
index_timer = timer_alloc(0);
|
||||||
image_dirty = false;
|
image_dirty = false;
|
||||||
@ -438,10 +438,6 @@ void floppy_image_device::init_floppy_load(bool write_supported)
|
|||||||
|
|
||||||
index_resync();
|
index_resync();
|
||||||
|
|
||||||
wpt = 1; // disk sleeve is covering the sensor
|
|
||||||
if (!cur_wpt_cb.isnull())
|
|
||||||
cur_wpt_cb(this, wpt);
|
|
||||||
|
|
||||||
wpt = is_readonly() || (!write_supported);
|
wpt = is_readonly() || (!write_supported);
|
||||||
if (!cur_wpt_cb.isnull())
|
if (!cur_wpt_cb.isnull())
|
||||||
cur_wpt_cb(this, wpt);
|
cur_wpt_cb(this, wpt);
|
||||||
@ -508,11 +504,11 @@ void floppy_image_device::call_unload()
|
|||||||
image.reset();
|
image.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
wpt = 1; // disk sleeve is covering the sensor
|
wpt = 0;
|
||||||
if (!cur_wpt_cb.isnull())
|
if (!cur_wpt_cb.isnull())
|
||||||
cur_wpt_cb(this, wpt);
|
cur_wpt_cb(this, wpt);
|
||||||
|
|
||||||
wpt = 0; // sensor is uncovered
|
wpt = 1;
|
||||||
if (!cur_wpt_cb.isnull())
|
if (!cur_wpt_cb.isnull())
|
||||||
cur_wpt_cb(this, wpt);
|
cur_wpt_cb(this, wpt);
|
||||||
|
|
||||||
@ -2385,6 +2381,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)
|
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;
|
m_has_mfm = false;
|
||||||
|
dskchg_writable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mac_floppy_device::device_start()
|
void mac_floppy_device::device_start()
|
||||||
@ -2422,7 +2419,7 @@ bool mac_floppy_device::wpt_r()
|
|||||||
// actual_ss may have changed after the phases were set
|
// actual_ss may have changed after the phases were set
|
||||||
m_reg = (m_reg & 7) | (actual_ss ? 8 : 0);
|
m_reg = (m_reg & 7) | (actual_ss ? 8 : 0);
|
||||||
|
|
||||||
if(m_reg != 4 && m_reg != 12 && m_reg != 5 && m_reg != 13)
|
if(1 || (m_reg != 4 && m_reg != 12 && m_reg != 5 && m_reg != 13))
|
||||||
logerror("fdc disk sense reg %x %s %p\n", m_reg, regnames[m_reg], image.get());
|
logerror("fdc disk sense reg %x %s %p\n", m_reg, regnames[m_reg], image.get());
|
||||||
|
|
||||||
switch(m_reg) {
|
switch(m_reg) {
|
||||||
@ -2436,6 +2433,9 @@ bool mac_floppy_device::wpt_r()
|
|||||||
case 0x2: // Is the motor on?
|
case 0x2: // Is the motor on?
|
||||||
return mon;
|
return mon;
|
||||||
|
|
||||||
|
case 0x3: // Disk change signal
|
||||||
|
return dskchg;
|
||||||
|
|
||||||
case 0x4:
|
case 0x4:
|
||||||
case 0xc: // Index pulse, probably only on the superdrive though
|
case 0xc: // Index pulse, probably only on the superdrive though
|
||||||
return !m_has_mfm ? false : !image || mon ? true : idx;
|
return !m_has_mfm ? false : !image || mon ? true : idx;
|
||||||
@ -2458,6 +2458,16 @@ bool mac_floppy_device::wpt_r()
|
|||||||
case 0xa: // Not on track 0?
|
case 0xa: // Not on track 0?
|
||||||
return cyl != 0;
|
return cyl != 0;
|
||||||
|
|
||||||
|
case 0xb:{// Tachometer, 60 pulses/rotation
|
||||||
|
if(image.get() != nullptr && !mon) {
|
||||||
|
attotime base;
|
||||||
|
uint32_t pos = find_position(base, machine().time());
|
||||||
|
uint32_t subpos = pos % 3333334;
|
||||||
|
return subpos < 20000;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
case 0xd: // Is the current mode GCR or MFM?
|
case 0xd: // Is the current mode GCR or MFM?
|
||||||
return m_mfm;
|
return m_mfm;
|
||||||
|
|
||||||
@ -2478,7 +2488,7 @@ void mac_floppy_device::seek_phase_w(int phases)
|
|||||||
"DirNext", "StepOn", "MotorOn", "EjectOff",
|
"DirNext", "StepOn", "MotorOn", "EjectOff",
|
||||||
"DirPrev", "StepOff", "MotorOff", "EjectOn",
|
"DirPrev", "StepOff", "MotorOff", "EjectOn",
|
||||||
"-", "MFMModeOn", "-", "-",
|
"-", "MFMModeOn", "-", "-",
|
||||||
"-", "GCRModeOn", "-", "-"
|
"DskchgClear", "GCRModeOn", "-", "-"
|
||||||
};
|
};
|
||||||
|
|
||||||
bool prev_strb = m_strb;
|
bool prev_strb = m_strb;
|
||||||
@ -2532,6 +2542,11 @@ void mac_floppy_device::seek_phase_w(int phases)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0xc: // Clear dskchg
|
||||||
|
logerror("cmd clear dskchg\n");
|
||||||
|
dskchg = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
case 0xd: // GCR mode on
|
case 0xd: // GCR mode on
|
||||||
logerror("cmd gcr on\n");
|
logerror("cmd gcr on\n");
|
||||||
m_mfm = false;
|
m_mfm = false;
|
||||||
|
@ -250,7 +250,7 @@ u8 iwm_device::control(int offset, u8 data)
|
|||||||
|
|
||||||
switch(m_control & 0xc0) {
|
switch(m_control & 0xc0) {
|
||||||
case 0x00: return m_active ? m_data : 0xff;
|
case 0x00: return m_active ? m_data : 0xff;
|
||||||
case 0x40: return (m_status & 0x7f) | ((!m_floppy || m_floppy->wpt_r()) ? 0x80 : 0);;
|
case 0x40: return (m_status & 0x7f) | ((!m_floppy || m_floppy->wpt_r()) ? 0x80 : 0);
|
||||||
case 0x80: return m_whd;
|
case 0x80: return m_whd;
|
||||||
case 0xc0: if(offset & 1) { if(m_active) data_w(data); else mode_w(data); } return 0xff;
|
case 0xc0: if(offset & 1) { if(m_active) data_w(data); else mode_w(data); } return 0xff;
|
||||||
}
|
}
|
||||||
@ -382,8 +382,6 @@ void iwm_device::sync()
|
|||||||
if(is_sync()) {
|
if(is_sync()) {
|
||||||
if(m_rsh >= 0x80) {
|
if(m_rsh >= 0x80) {
|
||||||
m_data = m_rsh;
|
m_data = m_rsh;
|
||||||
if(m_data == 0xfc)
|
|
||||||
machine().debug_break();
|
|
||||||
m_rsh = 0;
|
m_rsh = 0;
|
||||||
} else if(m_rsh >= 0x04) {
|
} else if(m_rsh >= 0x04) {
|
||||||
m_data = m_rsh;
|
m_data = m_rsh;
|
||||||
@ -393,8 +391,7 @@ void iwm_device::sync()
|
|||||||
|
|
||||||
} else if(m_rsh >= 0x80) {
|
} else if(m_rsh >= 0x80) {
|
||||||
m_data = m_rsh;
|
m_data = m_rsh;
|
||||||
if(m_data == 0xfc)
|
// logerror("%s DATAR %02x\n", cycles_to_time(m_last_sync).to_string(), m_data);
|
||||||
machine().debug_break();
|
|
||||||
m_rsh = 0;
|
m_rsh = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user