mirror of
https://github.com/holub/mame
synced 2025-05-15 02:18:16 +03:00
i8257: Cleanup (nw)
This commit is contained in:
parent
81f1918bf9
commit
d82064f05a
@ -141,10 +141,8 @@ inline void i8257_device::set_tc(int state)
|
||||
inline void i8257_device::set_dack()
|
||||
{
|
||||
LOG("%s\n", FUNCNAME);
|
||||
m_out_dack_0_cb(m_current_channel != 0);
|
||||
m_out_dack_1_cb(m_current_channel != 1);
|
||||
m_out_dack_2_cb(m_current_channel != 2);
|
||||
m_out_dack_3_cb(m_current_channel != 3);
|
||||
for (int ch = 0; ch < 4; ch++)
|
||||
m_out_dack_cb[ch](m_current_channel != ch);
|
||||
}
|
||||
|
||||
|
||||
@ -162,21 +160,7 @@ inline void i8257_device::dma_read()
|
||||
case MODE_TRANSFER_VERIFY:
|
||||
case MODE_TRANSFER_WRITE:
|
||||
LOGTFR(" - MODE TRANSFER VERIFY/WRITE");
|
||||
switch(m_current_channel)
|
||||
{
|
||||
case 0:
|
||||
m_temp = m_in_ior_0_cb(offset);
|
||||
break;
|
||||
case 1:
|
||||
m_temp = m_in_ior_1_cb(offset);
|
||||
break;
|
||||
case 2:
|
||||
m_temp = m_in_ior_2_cb(offset);
|
||||
break;
|
||||
case 3:
|
||||
m_temp = m_in_ior_3_cb(offset);
|
||||
break;
|
||||
}
|
||||
m_temp = m_in_ior_cb[m_current_channel](offset);
|
||||
break;
|
||||
|
||||
case MODE_TRANSFER_READ:
|
||||
@ -214,21 +198,7 @@ inline void i8257_device::dma_write()
|
||||
|
||||
case MODE_TRANSFER_READ:
|
||||
LOGTFR(" - MODE TRANSFER READ");
|
||||
switch(m_current_channel)
|
||||
{
|
||||
case 0:
|
||||
m_out_iow_0_cb(offset, m_temp);
|
||||
break;
|
||||
case 1:
|
||||
m_out_iow_1_cb(offset, m_temp);
|
||||
break;
|
||||
case 2:
|
||||
m_out_iow_2_cb(offset, m_temp);
|
||||
break;
|
||||
case 3:
|
||||
m_out_iow_3_cb(offset, m_temp);
|
||||
break;
|
||||
}
|
||||
m_out_iow_cb[m_current_channel](offset, m_temp);
|
||||
break;
|
||||
}
|
||||
LOGTFR(" channel %d Offset %04x: %02x %04x\n", m_current_channel, offset, m_temp, m_channel[m_current_channel].m_count);
|
||||
@ -301,18 +271,9 @@ i8257_device::i8257_device(const machine_config &mconfig, const char *tag, devic
|
||||
m_out_tc_cb(*this),
|
||||
m_in_memr_cb(*this),
|
||||
m_out_memw_cb(*this),
|
||||
m_in_ior_0_cb(*this),
|
||||
m_in_ior_1_cb(*this),
|
||||
m_in_ior_2_cb(*this),
|
||||
m_in_ior_3_cb(*this),
|
||||
m_out_iow_0_cb(*this),
|
||||
m_out_iow_1_cb(*this),
|
||||
m_out_iow_2_cb(*this),
|
||||
m_out_iow_3_cb(*this),
|
||||
m_out_dack_0_cb(*this),
|
||||
m_out_dack_1_cb(*this),
|
||||
m_out_dack_2_cb(*this),
|
||||
m_out_dack_3_cb(*this)
|
||||
m_in_ior_cb{{*this}, {*this}, {*this}, {*this}},
|
||||
m_out_iow_cb{{*this}, {*this}, {*this}, {*this}},
|
||||
m_out_dack_cb{{*this}, {*this}, {*this}, {*this}}
|
||||
{
|
||||
}
|
||||
|
||||
@ -332,18 +293,12 @@ void i8257_device::device_start()
|
||||
m_out_tc_cb.resolve_safe();
|
||||
m_in_memr_cb.resolve_safe(0);
|
||||
m_out_memw_cb.resolve_safe();
|
||||
m_in_ior_0_cb.resolve_safe(0);
|
||||
m_in_ior_1_cb.resolve_safe(0);
|
||||
m_in_ior_2_cb.resolve_safe(0);
|
||||
m_in_ior_3_cb.resolve_safe(0);
|
||||
m_out_iow_0_cb.resolve_safe();
|
||||
m_out_iow_1_cb.resolve_safe();
|
||||
m_out_iow_2_cb.resolve_safe();
|
||||
m_out_iow_3_cb.resolve_safe();
|
||||
m_out_dack_0_cb.resolve_safe();
|
||||
m_out_dack_1_cb.resolve_safe();
|
||||
m_out_dack_2_cb.resolve_safe();
|
||||
m_out_dack_3_cb.resolve_safe();
|
||||
for (auto &cb : m_in_ior_cb)
|
||||
cb.resolve_safe(0);
|
||||
for (auto &cb : m_out_iow_cb)
|
||||
cb.resolve_safe();
|
||||
for (auto &cb : m_out_dack_cb)
|
||||
cb.resolve_safe();
|
||||
|
||||
// state saving
|
||||
save_item(NAME(m_msb));
|
||||
|
@ -54,40 +54,40 @@
|
||||
devcb = &i8257_device::set_out_memw_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_IN_IOR_0_CB(_devcb) \
|
||||
devcb = &i8257_device::set_in_ior_0_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_in_ior_callback(*device, 0, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_IN_IOR_1_CB(_devcb) \
|
||||
devcb = &i8257_device::set_in_ior_1_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_in_ior_callback(*device, 1, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_IN_IOR_2_CB(_devcb) \
|
||||
devcb = &i8257_device::set_in_ior_2_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_in_ior_callback(*device, 2, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_IN_IOR_3_CB(_devcb) \
|
||||
devcb = &i8257_device::set_in_ior_3_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_in_ior_callback(*device, 3, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_OUT_IOW_0_CB(_devcb) \
|
||||
devcb = &i8257_device::set_out_iow_0_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_out_iow_callback(*device, 0, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_OUT_IOW_1_CB(_devcb) \
|
||||
devcb = &i8257_device::set_out_iow_1_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_out_iow_callback(*device, 1, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_OUT_IOW_2_CB(_devcb) \
|
||||
devcb = &i8257_device::set_out_iow_2_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_out_iow_callback(*device, 2, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_OUT_IOW_3_CB(_devcb) \
|
||||
devcb = &i8257_device::set_out_iow_3_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_out_iow_callback(*device, 3, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_OUT_DACK_0_CB(_devcb) \
|
||||
devcb = &i8257_device::set_out_dack_0_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_out_dack_callback(*device, 0, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_OUT_DACK_1_CB(_devcb) \
|
||||
devcb = &i8257_device::set_out_dack_1_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_out_dack_callback(*device, 1, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_OUT_DACK_2_CB(_devcb) \
|
||||
devcb = &i8257_device::set_out_dack_2_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_out_dack_callback(*device, 2, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_I8257_OUT_DACK_3_CB(_devcb) \
|
||||
devcb = &i8257_device::set_out_dack_3_callback(*device, DEVCB_##_devcb);
|
||||
devcb = &i8257_device::set_out_dack_callback(*device, 3, DEVCB_##_devcb);
|
||||
|
||||
// HACK: the radio86 and alikes require this, is it a bug in the soviet clone or is there something else happening?
|
||||
#define MCFG_I8257_REVERSE_RW_MODE(_flag) \
|
||||
@ -119,20 +119,10 @@ public:
|
||||
template <class Object> static devcb_base &set_in_memr_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_in_memr_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_memw_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_out_memw_cb.set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
template <class Object> static devcb_base &set_in_ior_0_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_in_ior_0_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_in_ior_1_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_in_ior_1_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_in_ior_2_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_in_ior_2_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_in_ior_3_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_in_ior_3_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_in_ior_callback(device_t &device, int ch, Object &&cb) { return downcast<i8257_device &>(device).m_in_ior_cb[ch].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_iow_callback(device_t &device, int ch, Object &&cb) { return downcast<i8257_device &>(device).m_out_iow_cb[ch].set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
template <class Object> static devcb_base &set_out_iow_0_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_out_iow_0_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_iow_1_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_out_iow_1_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_iow_2_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_out_iow_2_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_iow_3_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_out_iow_3_cb.set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
template <class Object> static devcb_base &set_out_dack_0_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_out_dack_0_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_dack_1_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_out_dack_1_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_dack_2_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_out_dack_2_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_dack_3_callback(device_t &device, Object &&cb) { return downcast<i8257_device &>(device).m_out_dack_3_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_dack_callback(device_t &device, int ch, Object &&cb) { return downcast<i8257_device &>(device).m_out_dack_cb[ch].set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
static void static_set_reverse_rw_mode(device_t &device, bool flag) { downcast<i8257_device &>(device).m_reverse_rw = flag; }
|
||||
|
||||
@ -177,18 +167,9 @@ private:
|
||||
devcb_write8 m_out_memw_cb;
|
||||
|
||||
/* channel accessors */
|
||||
devcb_read8 m_in_ior_0_cb;
|
||||
devcb_read8 m_in_ior_1_cb;
|
||||
devcb_read8 m_in_ior_2_cb;
|
||||
devcb_read8 m_in_ior_3_cb;
|
||||
devcb_write8 m_out_iow_0_cb;
|
||||
devcb_write8 m_out_iow_1_cb;
|
||||
devcb_write8 m_out_iow_2_cb;
|
||||
devcb_write8 m_out_iow_3_cb;
|
||||
devcb_write_line m_out_dack_0_cb;
|
||||
devcb_write_line m_out_dack_1_cb;
|
||||
devcb_write_line m_out_dack_2_cb;
|
||||
devcb_write_line m_out_dack_3_cb;
|
||||
devcb_read8 m_in_ior_cb[4];
|
||||
devcb_write8 m_out_iow_cb[4];
|
||||
devcb_write_line m_out_dack_cb[4];
|
||||
|
||||
struct
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user