summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2011-09-03 20:50:58 +0000
committer Olivier Galibert <galibert@pobox.com>2011-09-03 20:50:58 +0000
commit2831f2f9cd136823ffb4a153b4b8b5868bdf6e23 (patch)
treedacc3ff080bf4834f65a2dd1ace3ea42a974262f
parentfcd095026549b03f1f3f0c451227c4a2f0b97441 (diff)
amigafdc: Modernize, but don't change a thing (yet) [O. Galibert]
-rw-r--r--src/emu/imagedev/floppy.c24
-rw-r--r--src/emu/imagedev/floppy.h12
2 files changed, 34 insertions, 2 deletions
diff --git a/src/emu/imagedev/floppy.c b/src/emu/imagedev/floppy.c
index f4c2485cf6c..edac1c81caf 100644
--- a/src/emu/imagedev/floppy.c
+++ b/src/emu/imagedev/floppy.c
@@ -20,7 +20,6 @@ floppy_image_device::floppy_image_device(const machine_config &mconfig, const ch
device_image_interface(mconfig, *this),
m_image(NULL)
{
-
}
//-------------------------------------------------
@@ -81,6 +80,21 @@ void floppy_image_device::device_config_complete()
update_names();
}
+void floppy_image_device::setup_load_cb(load_cb cb)
+{
+ cur_load_cb = cb;
+}
+
+void floppy_image_device::setup_unload_cb(unload_cb cb)
+{
+ cur_unload_cb = cb;
+}
+
+void floppy_image_device::setup_index_pulse_cb(index_pulse_cb cb)
+{
+ cur_index_pulse_cb = cb;
+}
+
static TIMER_CALLBACK(floppy_drive_index_callback)
{
floppy_image_device *image = (floppy_image_device *) ptr;
@@ -123,10 +137,12 @@ bool floppy_image_device::call_load()
format->load(m_image);
if (m_load_func)
return m_load_func(*this);
+ if (!cur_load_cb.isnull())
+ return cur_load_cb(this);
+ return IMAGE_INIT_PASS;
} else {
return IMAGE_INIT_FAIL;
}
- return IMAGE_INIT_PASS;
}
void floppy_image_device::call_unload()
@@ -137,6 +153,8 @@ void floppy_image_device::call_unload()
global_free(m_image);
if (m_unload_func)
m_unload_func(*this);
+ if (!cur_unload_cb.isnull())
+ cur_unload_cb(this);
}
/* motor on, active low */
@@ -177,6 +195,8 @@ void floppy_image_device::index_func()
}
m_out_idx_func(m_idx);
+ if (!cur_index_pulse_cb.isnull())
+ cur_index_pulse_cb(this, m_idx);
}
int floppy_image_device::ready_r()
diff --git a/src/emu/imagedev/floppy.h b/src/emu/imagedev/floppy.h
index bfc93630611..487bfd47930 100644
--- a/src/emu/imagedev/floppy.h
+++ b/src/emu/imagedev/floppy.h
@@ -32,6 +32,10 @@ class floppy_image_device : public device_t,
public device_image_interface
{
public:
+ typedef delegate<int (floppy_image_device *)> load_cb;
+ typedef delegate<void (floppy_image_device *)> unload_cb;
+ typedef delegate<void (floppy_image_device *, int)> index_pulse_cb;
+
// construction/destruction
floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~floppy_image_device();
@@ -53,6 +57,10 @@ public:
virtual const char *file_extensions() const { return m_extension_list; }
virtual const option_guide *create_option_guide() const { return NULL; }
+ void setup_load_cb(load_cb cb);
+ void setup_unload_cb(unload_cb cb);
+ void setup_index_pulse_cb(index_pulse_cb cb);
+
UINT8* get_buffer() { return m_image->get_buffer(m_cyl,m_ss ^ 1); }
void mon_w(int state);
@@ -100,6 +108,10 @@ protected:
int m_cyl;
devcb_resolved_write_line m_out_idx_func;
+
+ load_cb cur_load_cb;
+ unload_cb cur_unload_cb;
+ index_pulse_cb cur_index_pulse_cb;
};
// device type definition