summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/flopdrv.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/imagedev/flopdrv.h')
-rw-r--r--src/devices/imagedev/flopdrv.h40
1 files changed, 33 insertions, 7 deletions
diff --git a/src/devices/imagedev/flopdrv.h b/src/devices/imagedev/flopdrv.h
index 5751365260d..cae694146b7 100644
--- a/src/devices/imagedev/flopdrv.h
+++ b/src/devices/imagedev/flopdrv.h
@@ -92,6 +92,9 @@ struct chrn_id
/* set if index has just occurred */
#define FLOPPY_DRIVE_INDEX 0x0020
+#define MCFG_LEGACY_FLOPPY_IDX_CB(_devcb) \
+ downcast<legacy_floppy_image_device &>(*device).set_out_idx_func(DEVCB_##_devcb);
+
class legacy_floppy_image_device : public device_t,
public device_image_interface
{
@@ -107,7 +110,7 @@ public:
~legacy_floppy_image_device();
void set_floppy_config(const floppy_interface *config) { m_config = config; }
- auto out_idx_cb() { return m_out_idx_func.bind(); }
+ template<class Object> devcb_base &set_out_idx_func(Object &&cb) { return m_out_idx_func.set_callback(std::forward<Object>(cb)); }
static void add_4drives(machine_config &mconfig, const floppy_interface *config)
{
@@ -117,12 +120,6 @@ public:
LEGACY_FLOPPY(mconfig, FLOPPY_3, 0, config);
}
- static void add_2drives(machine_config &mconfig, const floppy_interface *config)
- {
- LEGACY_FLOPPY(mconfig, FLOPPY_0, 0, config);
- LEGACY_FLOPPY(mconfig, FLOPPY_1, 0, config);
- }
-
virtual image_init_result call_load() override;
virtual const software_list_loader &get_software_list_loader() const override { return image_software_list_loader::instance(); }
virtual image_init_result call_create(int format_type, util::option_resolution *format_options) override;
@@ -253,4 +250,33 @@ legacy_floppy_image_device *floppy_get_device_by_type(running_machine &machine,i
int floppy_get_drive_by_type(legacy_floppy_image_device *image,int ftype);
int floppy_get_count(running_machine &machine);
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+
+#define MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ downcast<legacy_floppy_image_device &>(*device).set_floppy_config(&(_config));
+
+#define MCFG_LEGACY_FLOPPY_DRIVE_ADD(_tag, _config) \
+ MCFG_DEVICE_ADD(_tag, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config)
+
+#define MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_1, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_2, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_3, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config)
+
+#define MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_1, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config)
+
#endif // MAME_DEVICES_IMAGEDV_FLOPDRV_H