mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +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),
|
||||
dskchg_writable(false),
|
||||
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),
|
||||
rpm(0),
|
||||
angular_speed(0),
|
||||
@ -340,7 +340,7 @@ void floppy_image_device::device_start()
|
||||
actual_ss = 0;
|
||||
ds = -1;
|
||||
stp = 1;
|
||||
wpt = 0;
|
||||
wpt = 1;
|
||||
dskchg = exists() ? 1 : 0;
|
||||
index_timer = timer_alloc(0);
|
||||
image_dirty = false;
|
||||
@ -438,10 +438,6 @@ void floppy_image_device::init_floppy_load(bool write_supported)
|
||||
|
||||
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);
|
||||
if (!cur_wpt_cb.isnull())
|
||||
cur_wpt_cb(this, wpt);
|
||||
@ -508,11 +504,11 @@ void floppy_image_device::call_unload()
|
||||
image.reset();
|
||||
}
|
||||
|
||||
wpt = 1; // disk sleeve is covering the sensor
|
||||
wpt = 0;
|
||||
if (!cur_wpt_cb.isnull())
|
||||
cur_wpt_cb(this, wpt);
|
||||
|
||||
wpt = 0; // sensor is uncovered
|
||||
wpt = 1;
|
||||
if (!cur_wpt_cb.isnull())
|
||||
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)
|
||||
{
|
||||
m_has_mfm = false;
|
||||
dskchg_writable = true;
|
||||
}
|
||||
|
||||
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
|
||||
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());
|
||||
|
||||
switch(m_reg) {
|
||||
@ -2436,6 +2433,9 @@ bool mac_floppy_device::wpt_r()
|
||||
case 0x2: // Is the motor on?
|
||||
return mon;
|
||||
|
||||
case 0x3: // Disk change signal
|
||||
return dskchg;
|
||||
|
||||
case 0x4:
|
||||
case 0xc: // Index pulse, probably only on the superdrive though
|
||||
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?
|
||||
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?
|
||||
return m_mfm;
|
||||
|
||||
@ -2478,7 +2488,7 @@ void mac_floppy_device::seek_phase_w(int phases)
|
||||
"DirNext", "StepOn", "MotorOn", "EjectOff",
|
||||
"DirPrev", "StepOff", "MotorOff", "EjectOn",
|
||||
"-", "MFMModeOn", "-", "-",
|
||||
"-", "GCRModeOn", "-", "-"
|
||||
"DskchgClear", "GCRModeOn", "-", "-"
|
||||
};
|
||||
|
||||
bool prev_strb = m_strb;
|
||||
@ -2532,6 +2542,11 @@ void mac_floppy_device::seek_phase_w(int phases)
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xc: // Clear dskchg
|
||||
logerror("cmd clear dskchg\n");
|
||||
dskchg = 0;
|
||||
break;
|
||||
|
||||
case 0xd: // GCR mode on
|
||||
logerror("cmd gcr on\n");
|
||||
m_mfm = false;
|
||||
|
@ -250,7 +250,7 @@ u8 iwm_device::control(int offset, u8 data)
|
||||
|
||||
switch(m_control & 0xc0) {
|
||||
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 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(m_rsh >= 0x80) {
|
||||
m_data = m_rsh;
|
||||
if(m_data == 0xfc)
|
||||
machine().debug_break();
|
||||
m_rsh = 0;
|
||||
} else if(m_rsh >= 0x04) {
|
||||
m_data = m_rsh;
|
||||
@ -393,8 +391,7 @@ void iwm_device::sync()
|
||||
|
||||
} else if(m_rsh >= 0x80) {
|
||||
m_data = m_rsh;
|
||||
if(m_data == 0xfc)
|
||||
machine().debug_break();
|
||||
// logerror("%s DATAR %02x\n", cycles_to_time(m_last_sync).to_string(), m_data);
|
||||
m_rsh = 0;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user