summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/ataintf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/ataintf.cpp')
-rw-r--r--src/devices/machine/ataintf.cpp34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/devices/machine/ataintf.cpp b/src/devices/machine/ataintf.cpp
index 0e377c5e0ed..8f2db0ba0d3 100644
--- a/src/devices/machine/ataintf.cpp
+++ b/src/devices/machine/ataintf.cpp
@@ -17,6 +17,23 @@
#include "debugger.h"
+void abstract_ata_interface_device::set_default_ata_devices(const char* _master, const char* _slave)
+{
+ for (size_t slot_index = 0; slot_index < SLOT_COUNT; slot_index++)
+ {
+ slot(slot_index).option_add("hdd", IDE_HARDDISK);
+ slot(slot_index).option_add("cdrom", ATAPI_CDROM);
+ }
+ slot(SLOT_MASTER).set_default_option(_master);
+ slot(SLOT_SLAVE).set_default_option(_slave);
+}
+
+ata_slot_device &abstract_ata_interface_device::slot(int index)
+{
+ assert(index < 2);
+ return *subdevice<ata_slot_device>(m_slot[index].finder_tag());
+}
+
void abstract_ata_interface_device::set_irq(int state)
{
// logerror( "%s: irq %d\n", machine().describe_context(), state );
@@ -212,9 +229,11 @@ void ata_devices(device_slot_interface &device)
abstract_ata_interface_device::abstract_ata_interface_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
+ m_slot(*this, "%u", 0U),
m_irq_handler(*this),
m_dmarq_handler(*this),
- m_dasp_handler(*this){
+ m_dasp_handler(*this)
+{
}
@@ -235,10 +254,6 @@ void abstract_ata_interface_device::device_start()
m_dmarq_handler.resolve_safe();
m_dasp_handler.resolve_safe();
- /* set MAME harddisk handle */
- m_slot[0] = subdevice<ata_slot_device>("0");
- m_slot[1] = subdevice<ata_slot_device>("1");
-
for (int i = 0; i < 2; i++)
{
m_irq[i] = 0;
@@ -274,10 +289,11 @@ void abstract_ata_interface_device::device_start()
// device_add_mconfig - add device configuration
//-------------------------------------------------
-MACHINE_CONFIG_START(abstract_ata_interface_device::device_add_mconfig)
- MCFG_DEVICE_ADD( "0", ATA_SLOT, 0 )
- MCFG_DEVICE_ADD( "1", ATA_SLOT, 0 )
-MACHINE_CONFIG_END
+void abstract_ata_interface_device::device_add_mconfig(machine_config &config)
+{
+ for (size_t slot = 0; slot < SLOT_COUNT; slot++)
+ ATA_SLOT(config, m_slot[slot]);
+}
//**************************************************************************