mirror of
https://github.com/holub/mame
synced 2025-05-06 22:35:43 +03:00
wd_fdc: Emulate writes to master reset line; allow read side effects to be disabled (nw)
This commit is contained in:
parent
9c41b55ac3
commit
af61dd9e97
@ -122,6 +122,7 @@ void wd_fdc_device_base::device_start()
|
|||||||
enmf = false;
|
enmf = false;
|
||||||
floppy = nullptr;
|
floppy = nullptr;
|
||||||
status = 0x00;
|
status = 0x00;
|
||||||
|
mr = true;
|
||||||
|
|
||||||
save_item(NAME(status));
|
save_item(NAME(status));
|
||||||
save_item(NAME(command));
|
save_item(NAME(command));
|
||||||
@ -136,6 +137,9 @@ void wd_fdc_device_base::device_start()
|
|||||||
save_item(NAME(counter));
|
save_item(NAME(counter));
|
||||||
save_item(NAME(status_type_1));
|
save_item(NAME(status_type_1));
|
||||||
save_item(NAME(last_dir));
|
save_item(NAME(last_dir));
|
||||||
|
if (!disable_mfm)
|
||||||
|
save_item(NAME(dden));
|
||||||
|
save_item(NAME(mr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wd_fdc_device_base::device_reset()
|
void wd_fdc_device_base::device_reset()
|
||||||
@ -145,40 +149,52 @@ void wd_fdc_device_base::device_reset()
|
|||||||
|
|
||||||
void wd_fdc_device_base::soft_reset()
|
void wd_fdc_device_base::soft_reset()
|
||||||
{
|
{
|
||||||
command = 0x00;
|
if(mr) {
|
||||||
main_state = IDLE;
|
mr_w(0);
|
||||||
sub_state = IDLE;
|
mr_w(1);
|
||||||
cur_live.state = IDLE;
|
|
||||||
track = 0x00;
|
|
||||||
sector = 0x01;
|
|
||||||
status = 0x00;
|
|
||||||
data = 0x00;
|
|
||||||
cmd_buffer = track_buffer = sector_buffer = -1;
|
|
||||||
counter = 0;
|
|
||||||
status_type_1 = true;
|
|
||||||
last_dir = 1;
|
|
||||||
|
|
||||||
// gnd == enmf enabled, otherwise disabled (default)
|
|
||||||
if (!enmf_cb.isnull() && has_enmf)
|
|
||||||
enmf = enmf_cb() ? false : true;
|
|
||||||
|
|
||||||
intrq = false;
|
|
||||||
if (!intrq_cb.isnull())
|
|
||||||
{
|
|
||||||
intrq_cb(intrq);
|
|
||||||
}
|
}
|
||||||
drq = false;
|
}
|
||||||
if (!drq_cb.isnull())
|
|
||||||
{
|
|
||||||
drq_cb(drq);
|
|
||||||
}
|
|
||||||
hld = false;
|
|
||||||
intrq_cond = 0;
|
|
||||||
live_abort();
|
|
||||||
|
|
||||||
// trigger a restore after everything else is reset too, in particular the floppy device itself
|
WRITE_LINE_MEMBER(wd_fdc_device_base::mr_w)
|
||||||
sub_state = INITIAL_RESTORE;
|
{
|
||||||
t_gen->adjust(attotime::zero);
|
if(mr && !state) {
|
||||||
|
command = 0x00;
|
||||||
|
main_state = IDLE;
|
||||||
|
sub_state = IDLE;
|
||||||
|
cur_live.state = IDLE;
|
||||||
|
track = 0x00;
|
||||||
|
sector = 0x01;
|
||||||
|
status = 0x00;
|
||||||
|
data = 0x00;
|
||||||
|
cmd_buffer = track_buffer = sector_buffer = -1;
|
||||||
|
counter = 0;
|
||||||
|
status_type_1 = true;
|
||||||
|
last_dir = 1;
|
||||||
|
mr = false;
|
||||||
|
|
||||||
|
// gnd == enmf enabled, otherwise disabled (default)
|
||||||
|
if (!enmf_cb.isnull() && has_enmf)
|
||||||
|
enmf = enmf_cb() ? false : true;
|
||||||
|
|
||||||
|
intrq = false;
|
||||||
|
if (!intrq_cb.isnull())
|
||||||
|
{
|
||||||
|
intrq_cb(intrq);
|
||||||
|
}
|
||||||
|
drq = false;
|
||||||
|
if (!drq_cb.isnull())
|
||||||
|
{
|
||||||
|
drq_cb(drq);
|
||||||
|
}
|
||||||
|
hld = false;
|
||||||
|
intrq_cond = 0;
|
||||||
|
live_abort();
|
||||||
|
} else if(state && !mr) {
|
||||||
|
// trigger a restore after everything else is reset too, in particular the floppy device itself
|
||||||
|
sub_state = INITIAL_RESTORE;
|
||||||
|
t_gen->adjust(attotime::zero);
|
||||||
|
mr = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wd_fdc_device_base::set_floppy(floppy_image_device *_floppy)
|
void wd_fdc_device_base::set_floppy(floppy_image_device *_floppy)
|
||||||
@ -1090,6 +1106,11 @@ void wd_fdc_device_base::do_cmd_w()
|
|||||||
void wd_fdc_device_base::cmd_w(uint8_t val)
|
void wd_fdc_device_base::cmd_w(uint8_t val)
|
||||||
{
|
{
|
||||||
if (inverted_bus) val ^= 0xff;
|
if (inverted_bus) val ^= 0xff;
|
||||||
|
if (!mr) {
|
||||||
|
logerror("Not initiating command %02x during master reset\n", val);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LOGCOMP("Initiating command %02x\n", val);
|
LOGCOMP("Initiating command %02x\n", val);
|
||||||
|
|
||||||
if(intrq && !(intrq_cond & I_IMM)) {
|
if(intrq && !(intrq_cond & I_IMM)) {
|
||||||
@ -1119,7 +1140,7 @@ void wd_fdc_device_base::cmd_w(uint8_t val)
|
|||||||
|
|
||||||
uint8_t wd_fdc_device_base::status_r()
|
uint8_t wd_fdc_device_base::status_r()
|
||||||
{
|
{
|
||||||
if(intrq && !(intrq_cond & I_IMM)) {
|
if(intrq && !(intrq_cond & I_IMM) && !machine().side_effects_disabled()) {
|
||||||
intrq = false;
|
intrq = false;
|
||||||
if(!intrq_cb.isnull())
|
if(!intrq_cb.isnull())
|
||||||
intrq_cb(intrq);
|
intrq_cb(intrq);
|
||||||
@ -1171,7 +1192,7 @@ void wd_fdc_device_base::track_w(uint8_t val)
|
|||||||
if (inverted_bus) val ^= 0xff;
|
if (inverted_bus) val ^= 0xff;
|
||||||
|
|
||||||
// No more than one write in flight
|
// No more than one write in flight
|
||||||
if(track_buffer != -1)
|
if(track_buffer != -1 || !mr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
track_buffer = val;
|
track_buffer = val;
|
||||||
@ -1194,6 +1215,8 @@ void wd_fdc_device_base::do_sector_w()
|
|||||||
|
|
||||||
void wd_fdc_device_base::sector_w(uint8_t val)
|
void wd_fdc_device_base::sector_w(uint8_t val)
|
||||||
{
|
{
|
||||||
|
if (!mr) return;
|
||||||
|
|
||||||
if (inverted_bus) val ^= 0xff;
|
if (inverted_bus) val ^= 0xff;
|
||||||
|
|
||||||
// No more than one write in flight
|
// No more than one write in flight
|
||||||
@ -1220,6 +1243,8 @@ uint8_t wd_fdc_device_base::sector_r()
|
|||||||
|
|
||||||
void wd_fdc_device_base::data_w(uint8_t val)
|
void wd_fdc_device_base::data_w(uint8_t val)
|
||||||
{
|
{
|
||||||
|
if (!mr) return;
|
||||||
|
|
||||||
if (inverted_bus) val ^= 0xff;
|
if (inverted_bus) val ^= 0xff;
|
||||||
|
|
||||||
data = val;
|
data = val;
|
||||||
@ -1228,7 +1253,8 @@ void wd_fdc_device_base::data_w(uint8_t val)
|
|||||||
|
|
||||||
uint8_t wd_fdc_device_base::data_r()
|
uint8_t wd_fdc_device_base::data_r()
|
||||||
{
|
{
|
||||||
drop_drq();
|
if (!machine().side_effects_disabled())
|
||||||
|
drop_drq();
|
||||||
|
|
||||||
uint8_t val = data;
|
uint8_t val = data;
|
||||||
if (inverted_bus) val ^= 0xff;
|
if (inverted_bus) val ^= 0xff;
|
||||||
|
@ -86,6 +86,8 @@ public:
|
|||||||
|
|
||||||
DECLARE_READ_LINE_MEMBER(enp_r);
|
DECLARE_READ_LINE_MEMBER(enp_r);
|
||||||
|
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(mr_w);
|
||||||
|
|
||||||
void index_callback(floppy_image_device *floppy, int state);
|
void index_callback(floppy_image_device *floppy, int state);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -277,7 +279,8 @@ private:
|
|||||||
|
|
||||||
emu_timer *t_gen, *t_cmd, *t_track, *t_sector;
|
emu_timer *t_gen, *t_cmd, *t_track, *t_sector;
|
||||||
|
|
||||||
bool dden, status_type_1, intrq, drq, hld, hlt, enp, force_ready, disable_motor_control;
|
bool dden, status_type_1, intrq, drq, hld, hlt, enp, mr;
|
||||||
|
bool force_ready, disable_motor_control;
|
||||||
int main_state, sub_state;
|
int main_state, sub_state;
|
||||||
uint8_t command, track, sector, data, status, intrq_cond;
|
uint8_t command, track, sector, data, status, intrq_cond;
|
||||||
int last_dir;
|
int last_dir;
|
||||||
|
Loading…
Reference in New Issue
Block a user