i8257: Cleanup (nw)

This commit is contained in:
AJR 2018-02-27 16:02:02 -05:00
parent 81f1918bf9
commit d82064f05a
2 changed files with 31 additions and 95 deletions

View File

@ -141,10 +141,8 @@ inline void i8257_device::set_tc(int state)
inline void i8257_device::set_dack() inline void i8257_device::set_dack()
{ {
LOG("%s\n", FUNCNAME); LOG("%s\n", FUNCNAME);
m_out_dack_0_cb(m_current_channel != 0); for (int ch = 0; ch < 4; ch++)
m_out_dack_1_cb(m_current_channel != 1); m_out_dack_cb[ch](m_current_channel != ch);
m_out_dack_2_cb(m_current_channel != 2);
m_out_dack_3_cb(m_current_channel != 3);
} }
@ -162,21 +160,7 @@ inline void i8257_device::dma_read()
case MODE_TRANSFER_VERIFY: case MODE_TRANSFER_VERIFY:
case MODE_TRANSFER_WRITE: case MODE_TRANSFER_WRITE:
LOGTFR(" - MODE TRANSFER VERIFY/WRITE"); LOGTFR(" - MODE TRANSFER VERIFY/WRITE");
switch(m_current_channel) m_temp = m_in_ior_cb[m_current_channel](offset);
{
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;
}
break; break;
case MODE_TRANSFER_READ: case MODE_TRANSFER_READ:
@ -214,21 +198,7 @@ inline void i8257_device::dma_write()
case MODE_TRANSFER_READ: case MODE_TRANSFER_READ:
LOGTFR(" - MODE TRANSFER READ"); LOGTFR(" - MODE TRANSFER READ");
switch(m_current_channel) m_out_iow_cb[m_current_channel](offset, m_temp);
{
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;
}
break; break;
} }
LOGTFR(" channel %d Offset %04x: %02x %04x\n", m_current_channel, offset, m_temp, m_channel[m_current_channel].m_count); 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_out_tc_cb(*this),
m_in_memr_cb(*this), m_in_memr_cb(*this),
m_out_memw_cb(*this), m_out_memw_cb(*this),
m_in_ior_0_cb(*this), m_in_ior_cb{{*this}, {*this}, {*this}, {*this}},
m_in_ior_1_cb(*this), m_out_iow_cb{{*this}, {*this}, {*this}, {*this}},
m_in_ior_2_cb(*this), m_out_dack_cb{{*this}, {*this}, {*this}, {*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)
{ {
} }
@ -332,18 +293,12 @@ void i8257_device::device_start()
m_out_tc_cb.resolve_safe(); m_out_tc_cb.resolve_safe();
m_in_memr_cb.resolve_safe(0); m_in_memr_cb.resolve_safe(0);
m_out_memw_cb.resolve_safe(); m_out_memw_cb.resolve_safe();
m_in_ior_0_cb.resolve_safe(0); for (auto &cb : m_in_ior_cb)
m_in_ior_1_cb.resolve_safe(0); cb.resolve_safe(0);
m_in_ior_2_cb.resolve_safe(0); for (auto &cb : m_out_iow_cb)
m_in_ior_3_cb.resolve_safe(0); cb.resolve_safe();
m_out_iow_0_cb.resolve_safe(); for (auto &cb : m_out_dack_cb)
m_out_iow_1_cb.resolve_safe(); 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();
// state saving // state saving
save_item(NAME(m_msb)); save_item(NAME(m_msb));

View File

@ -54,40 +54,40 @@
devcb = &i8257_device::set_out_memw_callback(*device, DEVCB_##_devcb); devcb = &i8257_device::set_out_memw_callback(*device, DEVCB_##_devcb);
#define MCFG_I8257_IN_IOR_0_CB(_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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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? // 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) \ #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_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_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_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_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_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_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_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_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)); }
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)); }
static void static_set_reverse_rw_mode(device_t &device, bool flag) { downcast<i8257_device &>(device).m_reverse_rw = flag; } 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; devcb_write8 m_out_memw_cb;
/* channel accessors */ /* channel accessors */
devcb_read8 m_in_ior_0_cb; devcb_read8 m_in_ior_cb[4];
devcb_read8 m_in_ior_1_cb; devcb_write8 m_out_iow_cb[4];
devcb_read8 m_in_ior_2_cb; devcb_write_line m_out_dack_cb[4];
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;
struct struct
{ {