summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Patrick Mackinlay <pmackinlay@hotmail.com>2021-05-10 15:32:46 +0700
committer Patrick Mackinlay <pmackinlay@hotmail.com>2021-05-10 15:32:46 +0700
commit3d79c5d831c8cc35b0f59170c6a9581684ef9440 (patch)
tree0f3493ca85c9650f8cb425d9c724533435dae1d5
parent1c5d6a87e676ef006c7b079cd960222da372ee2e (diff)
wd1010: expand head selection
-rw-r--r--src/devices/bus/apricot/expansion/winchester.cpp1
-rw-r--r--src/devices/machine/wd1010.cpp9
-rw-r--r--src/devices/machine/wd1010.h8
-rw-r--r--src/mame/drivers/unixpc.cpp3
4 files changed, 19 insertions, 2 deletions
diff --git a/src/devices/bus/apricot/expansion/winchester.cpp b/src/devices/bus/apricot/expansion/winchester.cpp
index 5096cd7d4e0..e48751851fb 100644
--- a/src/devices/bus/apricot/expansion/winchester.cpp
+++ b/src/devices/bus/apricot/expansion/winchester.cpp
@@ -170,6 +170,7 @@ WRITE_LINE_MEMBER( apricot_winchester_device::head_w )
{
m_head = (m_head & ~(1 << N)) | (state << N);
LOGREGS("Select head: %d\n", m_head);
+ m_hdc->head_w(m_head);
}
template<int N>
diff --git a/src/devices/machine/wd1010.cpp b/src/devices/machine/wd1010.cpp
index a330d6c7671..4c77c88b215 100644
--- a/src/devices/machine/wd1010.cpp
+++ b/src/devices/machine/wd1010.cpp
@@ -112,6 +112,7 @@ void wd1010_device::device_start()
save_item(NAME(m_cylinder));
save_item(NAME(m_sdh));
save_item(NAME(m_status));
+ save_item(NAME(m_head));
}
//-------------------------------------------------
@@ -332,6 +333,14 @@ void wd1010_device::brdy_w(int state)
m_brdy = state;
}
+void wd1010_device::sc_w(int state)
+{
+ if (state)
+ m_status |= STATUS_SC;
+ else
+ m_status &= ~STATUS_SC;
+}
+
int wd1010_device::sc_r()
{
return m_status & STATUS_SC ? 1 : 0;
diff --git a/src/devices/machine/wd1010.h b/src/devices/machine/wd1010.h
index 268ab3a63ca..81607536f34 100644
--- a/src/devices/machine/wd1010.h
+++ b/src/devices/machine/wd1010.h
@@ -40,11 +40,16 @@ public:
void drdy_w(int state);
void brdy_w(int state);
+ void sc_w(int state);
// actually inputs to the controller from the drive
int sc_r();
int tk000_r();
+ // HACK: head selection is not actually controlled by the wd1010, but this emulation currently
+ // works as if it does; this function allows heads beyond the 3-bit range of the sdh register.
+ void head_w(uint8_t head) { m_head = head; }
+
protected:
// device-level overrides
virtual void device_start() override;
@@ -102,7 +107,7 @@ private:
int get_lbasector();
// extract values from sdh
- int head() { return (m_sdh >> 0) & 0x07; }
+ int head() { return m_head; }
int drive() { return (m_sdh >> 3) & 0x03; }
int sector_size()
{
@@ -151,6 +156,7 @@ private:
uint16_t m_cylinder;
uint8_t m_sdh;
uint8_t m_status;
+ uint8_t m_head;
};
// device type definition
diff --git a/src/mame/drivers/unixpc.cpp b/src/mame/drivers/unixpc.cpp
index 9d3518d71ac..4f9f3ebba4b 100644
--- a/src/mame/drivers/unixpc.cpp
+++ b/src/mame/drivers/unixpc.cpp
@@ -260,7 +260,8 @@ void unixpc_state::disk_control_w(uint8_t data)
{
logerror("disk_control_w: %02x\n", data);
- // TODO: bits 0-2 = head select
+ // bits 0-2 = head select
+ m_hdc->head_w(BIT(data, 0, 2));
m_hdc->drdy_w(BIT(data, 3) && m_hdr0->exists());