wd1010: expand head selection

This commit is contained in:
Patrick Mackinlay 2021-05-10 15:32:46 +07:00
parent 1c5d6a87e6
commit 3d79c5d831
4 changed files with 19 additions and 2 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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

View File

@ -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());