summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine
diff options
context:
space:
mode:
author tim lindner <tlindner@macmess.org>2022-11-12 02:55:35 -0800
committer GitHub <noreply@github.com>2022-11-12 11:55:35 +0100
commit0ec162cb1be0b87b67e2dded55e017a63cb35996 (patch)
treef7d14a129039973fe579312dfed5ceb61fa85e95 /src/devices/machine
parent1b0163f8d2cae5fe9ce8e9849b418a2ed68d96b6 (diff)
Add FDC Write Protect Delay (#10538)
Diffstat (limited to 'src/devices/machine')
-rw-r--r--src/devices/machine/wd_fdc.cpp36
-rw-r--r--src/devices/machine/wd_fdc.h3
2 files changed, 35 insertions, 4 deletions
diff --git a/src/devices/machine/wd_fdc.cpp b/src/devices/machine/wd_fdc.cpp
index 027d7c81ba8..12589fc9afc 100644
--- a/src/devices/machine/wd_fdc.cpp
+++ b/src/devices/machine/wd_fdc.cpp
@@ -98,6 +98,8 @@ static const char *const states[] =
"SPINUP_DONE",
"SETTLE_WAIT",
"SETTLE_DONE",
+ "WRITE_PROTECT_WAIT",
+ "WRITE_PROTECT_DONE",
"DATA_LOAD_WAIT",
"DATA_LOAD_WAIT_DONE",
"SEEK_MOVE",
@@ -871,8 +873,8 @@ void wd_fdc_device_base::write_track_continue()
LOGSTATE("SETTLE_DONE\n");
if (floppy && floppy->wpt_r()) {
LOGSTATE("WRITE_PROT\n");
- status |= S_WP;
- command_end();
+ sub_state = WRITE_PROTECT_WAIT;
+ delay_cycles(t_gen, 218);
return;
}
set_drq();
@@ -880,6 +882,16 @@ void wd_fdc_device_base::write_track_continue()
delay_cycles(t_gen, 192);
return;
+ case WRITE_PROTECT_WAIT:
+ LOGSTATE("WRITE_PROTECT_WAIT\n");
+ return;
+
+ case WRITE_PROTECT_DONE:
+ LOGSTATE("WRITE_PROTECT_DONE\n");
+ status |= S_WP;
+ command_end();
+ return;
+
case DATA_LOAD_WAIT:
LOGSTATE("DATA_LOAD_WAIT\n");
return;
@@ -983,8 +995,8 @@ void wd_fdc_device_base::write_sector_continue()
LOGSTATE("SETTLE_DONE\n");
if (floppy && floppy->wpt_r()) {
LOGSTATE("WRITE_PROT\n");
- status |= S_WP;
- command_end();
+ sub_state = WRITE_PROTECT_WAIT;
+ delay_cycles(t_gen, 218);
return;
}
sub_state = SCAN_ID;
@@ -992,6 +1004,16 @@ void wd_fdc_device_base::write_sector_continue()
live_start(SEARCH_ADDRESS_MARK_HEADER);
return;
+ case WRITE_PROTECT_WAIT:
+ LOGSTATE("WRITE_PROTECT_WAIT\n");
+ return;
+
+ case WRITE_PROTECT_DONE:
+ LOGSTATE("WRITE_PROTECT_DONE\n");
+ status |= S_WP;
+ command_end();
+ return;
+
case SCAN_ID:
LOGSTATE("SCAN_ID\n");
if(!sector_matches()) {
@@ -1141,6 +1163,10 @@ void wd_fdc_device_base::do_generic()
sub_state = SETTLE_DONE;
break;
+ case WRITE_PROTECT_WAIT:
+ sub_state = WRITE_PROTECT_DONE;
+ break;
+
case SEEK_WAIT_STEP_TIME:
sub_state = SEEK_WAIT_STEP_TIME_DONE;
break;
@@ -1518,6 +1544,8 @@ void wd_fdc_device_base::index_callback(floppy_image_device *floppy, int state)
case SPINUP_DONE:
case SETTLE_WAIT:
case SETTLE_DONE:
+ case WRITE_PROTECT_WAIT:
+ case WRITE_PROTECT_DONE:
case DATA_LOAD_WAIT:
case DATA_LOAD_WAIT_DONE:
case SEEK_MOVE:
diff --git a/src/devices/machine/wd_fdc.h b/src/devices/machine/wd_fdc.h
index e870542fcbc..32310e6b638 100644
--- a/src/devices/machine/wd_fdc.h
+++ b/src/devices/machine/wd_fdc.h
@@ -200,6 +200,9 @@ private:
SETTLE_WAIT,
SETTLE_DONE,
+ WRITE_PROTECT_WAIT,
+ WRITE_PROTECT_DONE,
+
DATA_LOAD_WAIT,
DATA_LOAD_WAIT_DONE,