mirror of
https://github.com/holub/mame
synced 2025-07-03 17:08:39 +03:00
nascom_fdc: proper support for single/double sided disk drives
This commit is contained in:
parent
611bb042f4
commit
a877bb053b
@ -10,6 +10,14 @@
|
||||
#include "formats/nascom_dsk.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// CONSTANTS/MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define VERBOSE 1
|
||||
#define VERBOSE_STATUS 0
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
@ -88,6 +96,22 @@ void nascom_fdc_device::device_reset()
|
||||
m_nasbus->m_io->install_read_handler(0xe5, 0xe5, read8_delegate(FUNC(nascom_fdc_device::status_r), this));
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset_after_children - device-specific reset after children
|
||||
//-------------------------------------------------
|
||||
|
||||
void nascom_fdc_device::device_reset_after_children()
|
||||
{
|
||||
// sanity check
|
||||
if (m_floppy0->get_device() && m_floppy1->get_device())
|
||||
if (m_floppy0->get_device()->get_sides() != m_floppy1->get_device()->get_sides())
|
||||
fatalerror("Floppy drive 0 and 1 need to be of the same type.\n");
|
||||
|
||||
if (m_floppy2->get_device() && m_floppy3->get_device())
|
||||
if (m_floppy2->get_device()->get_sides() != m_floppy3->get_device()->get_sides())
|
||||
fatalerror("Floppy drive 2 and 3 need to be of the same type.\n");
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// IMPLEMENTATION
|
||||
@ -95,11 +119,31 @@ void nascom_fdc_device::device_reset()
|
||||
|
||||
READ8_MEMBER( nascom_fdc_device::select_r )
|
||||
{
|
||||
return m_select | 0xa0;
|
||||
m_select |= (0x80 | 0x20);
|
||||
|
||||
// double sided drive for drive 0/1?
|
||||
if (m_floppy0->get_device() && (m_floppy0->get_device()->get_sides() == 2))
|
||||
m_select &= ~0x20;
|
||||
|
||||
if (m_floppy1->get_device() && (m_floppy1->get_device()->get_sides() == 2))
|
||||
m_select &= ~0x20;
|
||||
|
||||
// double sided drive for drive 2/3?
|
||||
if (m_floppy2->get_device() && (m_floppy2->get_device()->get_sides() == 2))
|
||||
m_select &= ~0x80;
|
||||
|
||||
if (m_floppy3->get_device() && (m_floppy3->get_device()->get_sides() == 2))
|
||||
m_select &= ~0x80;
|
||||
|
||||
if (VERBOSE)
|
||||
logerror("nascom_fdc_device::select_r: 0x%02x\n", m_select);
|
||||
|
||||
return m_select;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( nascom_fdc_device::select_w )
|
||||
{
|
||||
if (VERBOSE)
|
||||
logerror("nascom_fdc_device::select_w: 0x%02x\n", data);
|
||||
|
||||
m_floppy = NULL;
|
||||
@ -129,5 +173,8 @@ READ8_MEMBER( nascom_fdc_device::status_r )
|
||||
data |= m_fdc->intrq_r() << 0;
|
||||
data |= m_fdc->drq_r() << 7;
|
||||
|
||||
if (VERBOSE_STATUS)
|
||||
logerror("nascom_fdc_device::status_r: 0x%02x\n", data);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ public:
|
||||
// construction/destruction
|
||||
nascom_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
DECLARE_READ8_MEMBER( select_r );
|
||||
DECLARE_WRITE8_MEMBER( select_w );
|
||||
DECLARE_READ8_MEMBER( status_r );
|
||||
DECLARE_READ8_MEMBER(select_r);
|
||||
DECLARE_WRITE8_MEMBER(select_w);
|
||||
DECLARE_READ8_MEMBER(status_r);
|
||||
|
||||
DECLARE_FLOPPY_FORMATS(floppy_formats);
|
||||
|
||||
@ -38,6 +38,7 @@ protected:
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_reset_after_children();
|
||||
|
||||
private:
|
||||
required_device<fd1793_t> m_fdc;
|
||||
|
Loading…
Reference in New Issue
Block a user