mirror of
https://github.com/holub/mame
synced 2025-05-21 21:29:15 +03:00
amigafdc: Modernize, but don't change a thing (yet) [O. Galibert]
This commit is contained in:
parent
fcd0950265
commit
2831f2f9cd
@ -20,7 +20,6 @@ floppy_image_device::floppy_image_device(const machine_config &mconfig, const ch
|
|||||||
device_image_interface(mconfig, *this),
|
device_image_interface(mconfig, *this),
|
||||||
m_image(NULL)
|
m_image(NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -81,6 +80,21 @@ void floppy_image_device::device_config_complete()
|
|||||||
update_names();
|
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)
|
static TIMER_CALLBACK(floppy_drive_index_callback)
|
||||||
{
|
{
|
||||||
floppy_image_device *image = (floppy_image_device *) ptr;
|
floppy_image_device *image = (floppy_image_device *) ptr;
|
||||||
@ -123,10 +137,12 @@ bool floppy_image_device::call_load()
|
|||||||
format->load(m_image);
|
format->load(m_image);
|
||||||
if (m_load_func)
|
if (m_load_func)
|
||||||
return m_load_func(*this);
|
return m_load_func(*this);
|
||||||
|
if (!cur_load_cb.isnull())
|
||||||
|
return cur_load_cb(this);
|
||||||
|
return IMAGE_INIT_PASS;
|
||||||
} else {
|
} else {
|
||||||
return IMAGE_INIT_FAIL;
|
return IMAGE_INIT_FAIL;
|
||||||
}
|
}
|
||||||
return IMAGE_INIT_PASS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void floppy_image_device::call_unload()
|
void floppy_image_device::call_unload()
|
||||||
@ -137,6 +153,8 @@ void floppy_image_device::call_unload()
|
|||||||
global_free(m_image);
|
global_free(m_image);
|
||||||
if (m_unload_func)
|
if (m_unload_func)
|
||||||
m_unload_func(*this);
|
m_unload_func(*this);
|
||||||
|
if (!cur_unload_cb.isnull())
|
||||||
|
cur_unload_cb(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* motor on, active low */
|
/* motor on, active low */
|
||||||
@ -177,6 +195,8 @@ void floppy_image_device::index_func()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_out_idx_func(m_idx);
|
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()
|
int floppy_image_device::ready_r()
|
||||||
|
@ -32,6 +32,10 @@ class floppy_image_device : public device_t,
|
|||||||
public device_image_interface
|
public device_image_interface
|
||||||
{
|
{
|
||||||
public:
|
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
|
// construction/destruction
|
||||||
floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||||
virtual ~floppy_image_device();
|
virtual ~floppy_image_device();
|
||||||
@ -53,6 +57,10 @@ public:
|
|||||||
virtual const char *file_extensions() const { return m_extension_list; }
|
virtual const char *file_extensions() const { return m_extension_list; }
|
||||||
virtual const option_guide *create_option_guide() const { return NULL; }
|
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); }
|
UINT8* get_buffer() { return m_image->get_buffer(m_cyl,m_ss ^ 1); }
|
||||||
|
|
||||||
void mon_w(int state);
|
void mon_w(int state);
|
||||||
@ -100,6 +108,10 @@ protected:
|
|||||||
|
|
||||||
int m_cyl;
|
int m_cyl;
|
||||||
devcb_resolved_write_line m_out_idx_func;
|
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
|
// device type definition
|
||||||
|
Loading…
Reference in New Issue
Block a user