summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author ajrhacker <ajrhacker@users.noreply.github.com>2017-10-04 10:35:02 -0400
committer GitHub <noreply@github.com>2017-10-04 10:35:02 -0400
commit4e440057dce85475be4c237c1e1630940896b18a (patch)
tree5f3cbcd146dfdd07b477a0f9e2395796e8991e75
parent64ac8e474c56c552b37166139ead7e12b88cc1d8 (diff)
parentd7dc7f668b0cda9f1a9c0610a06f281bb4982238 (diff)
Merge pull request #2697 from pmackinlay/i82072
upd765: special case i82072 drive busy bit handling (nw)
-rw-r--r--src/devices/machine/upd765.cpp37
-rw-r--r--src/devices/machine/upd765.h3
2 files changed, 35 insertions, 5 deletions
diff --git a/src/devices/machine/upd765.cpp b/src/devices/machine/upd765.cpp
index 1b3e0b9bafe..474f8fb7fc3 100644
--- a/src/devices/machine/upd765.cpp
+++ b/src/devices/machine/upd765.cpp
@@ -1421,11 +1421,10 @@ void upd765_family_device::command_end(floppy_info &fi, bool data_completion)
for(int i=0; i != result_pos; i++)
LOG(" %02x", result[i]);
LOG("\n");
- fi.sub_state = IDLE;
- if(data_completion) {
- fi.main_state = IDLE;
+ fi.main_state = fi.sub_state = IDLE;
+ if(data_completion)
data_irq = true;
- } else {
+ else {
other_irq = true;
fi.st0_filled = true;
}
@@ -2602,6 +2601,36 @@ void i82072_device::execute_command(int cmd)
}
}
+/*
+ * The Intel datasheet says that the drive busy bits in the MSR are supposed to remain
+ * set after a seek or recalibrate until a sense interrupt status status command is
+ * executed. The InterPro 2000 diagnostic routine goes further, and tests the drive
+ * status bits before and after the first sense interrupt status result byte is read,
+ * and expects the drive busy bit to clear only after.
+ *
+ * The Amstrad CPC6128 uses a upd765a and seems to expect the busy bits to be cleared
+ * immediately after the seek/recalibrate interrupt is generated.
+ *
+ * Special casing the i82072 here seems the only way to reconcile this apparently
+ * different behaviour for now.
+ */
+void i82072_device::command_end(floppy_info &fi, bool data_completion)
+{
+ LOG("command done (%s) -", data_completion ? "data" : "seek");
+ for(int i=0; i != result_pos; i++)
+ LOG(" %02x", result[i]);
+ LOG("\n");
+ fi.sub_state = IDLE;
+ if(data_completion) {
+ fi.main_state = IDLE;
+ data_irq = true;
+ } else {
+ other_irq = true;
+ fi.st0_filled = true;
+ }
+ check_irq();
+}
+
void i82072_device::motor_control(int fid, bool start_motor)
{
// check if motor control is enabled
diff --git a/src/devices/machine/upd765.h b/src/devices/machine/upd765.h
index 149f956c38b..a920d7dd875 100644
--- a/src/devices/machine/upd765.h
+++ b/src/devices/machine/upd765.h
@@ -386,7 +386,7 @@ protected:
virtual int check_command();
virtual void start_command(int cmd);
virtual void execute_command(int cmd);
- void command_end(floppy_info &fi, bool data_completion);
+ virtual void command_end(floppy_info &fi, bool data_completion);
void recalibrate_start(floppy_info &fi);
void seek_start(floppy_info &fi);
@@ -469,6 +469,7 @@ protected:
virtual int check_command() override;
virtual void start_command(int cmd) override;
virtual void execute_command(int cmd) override;
+ virtual void command_end(floppy_info &fi, bool data_completion) override;
virtual void index_callback(floppy_image_device *floppy, int state) override;
void motor_control(int fid, bool start_motor);