tms9914: added methods to read ACCRQ & CONT output lines

This commit is contained in:
fulivi 2018-05-04 14:11:27 +02:00
parent 1e76d5fd5e
commit 0f86f547c6
2 changed files with 39 additions and 1 deletions

View File

@ -187,7 +187,8 @@ tms9914_device::tms9914_device(const machine_config &mconfig, const char *tag, d
devcb_write_line(*this),
devcb_write_line(*this),
devcb_write_line(*this) },
m_int_write_func(*this)
m_int_write_func(*this),
m_accrq_write_func(*this)
{
// Silence compiler complaints about unused variables
(void)REG_INT0_RLC_BIT;
@ -284,6 +285,7 @@ WRITE8_MEMBER(tms9914_device::reg8_w)
case REG_W_DO:
m_reg_do = data;
set_accrq(false);
if (!m_swrst) {
BIT_CLR(m_reg_int0_status , REG_INT0_BO_BIT);
update_int();
@ -388,6 +390,9 @@ READ8_MEMBER(tms9914_device::reg8_r)
case REG_R_DI:
res = m_reg_di;
BIT_CLR(m_reg_int0_status , REG_INT0_BI_BIT);
update_int();
set_accrq(false);
if (!m_hdfa && m_ah_anhs) {
m_ah_anhs = false;
update_fsm();
@ -405,6 +410,11 @@ READ8_MEMBER(tms9914_device::reg8_r)
return res;
}
READ_LINE_MEMBER(tms9914_device::cont_r)
{
return m_c_state != FSM_C_CIDS && m_c_state != FSM_C_CADS;
}
// device-level overrides
void tms9914_device::device_start()
{
@ -414,6 +424,7 @@ void tms9914_device::device_start()
f.resolve_safe();
}
m_int_write_func.resolve_safe();
m_accrq_write_func.resolve_safe();
m_sh_dly_timer = timer_alloc(SH_DELAY_TMR_ID);
m_ah_dly_timer = timer_alloc(AH_DELAY_TMR_ID);
@ -435,6 +446,7 @@ void tms9914_device::device_reset()
m_stdl = false;
m_shdw = false;
m_vstdl = false;
m_accrq_line = true; // Ensure change is propagated
m_reg_serial_p = 0;
m_reg_parallel_p = 0;
@ -536,6 +548,7 @@ void tms9914_device::do_swrst()
m_c_state = FSM_C_CIDS;
update_int();
set_accrq(false);
}
bool tms9914_device::listener_reset() const
@ -1312,6 +1325,9 @@ void tms9914_device::set_int0_bit(unsigned bit_no)
{
BIT_SET(m_reg_int0_status , bit_no);
update_int();
if (bit_no == REG_INT0_BI_BIT || (bit_no == REG_INT0_BO_BIT && m_c_state != FSM_C_CACS)) {
set_accrq(true);
}
}
void tms9914_device::set_int1_bit(unsigned bit_no)
@ -1351,3 +1367,12 @@ void tms9914_device::update_ren()
{
set_signal(IEEE_488_REN , m_sre);
}
void tms9914_device::set_accrq(bool state)
{
if (state != m_accrq_line) {
LOG_INT("ACCRQ=%d\n" , state);
m_accrq_line = state;
m_accrq_write_func(m_accrq_line);
}
}

View File

@ -69,6 +69,10 @@
#define MCFG_TMS9914_INT_WRITE_CB(_write) \
downcast<tms9914_device &>(*device).set_int_write_cb(DEVCB_##_write);
// Set write callback for ACCRQ signal
#define MCFG_TMS9914_ACCRQ_WRITE_CB(_write) \
downcast<tms9914_device &>(*device).set_accrq_write_cb(DEVCB_##_write);
class tms9914_device : public device_t
{
public:
@ -100,6 +104,9 @@ public:
template <class Object> devcb_base& set_int_write_cb(Object &&cb)
{ return m_int_write_func.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base& set_accrq_write_cb(Object &&cb)
{ return m_accrq_write_func.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER(eoi_w);
DECLARE_WRITE_LINE_MEMBER(dav_w);
DECLARE_WRITE_LINE_MEMBER(nrfd_w);
@ -112,6 +119,9 @@ public:
DECLARE_WRITE8_MEMBER(reg8_w);
DECLARE_READ8_MEMBER(reg8_r);
// CONT output: true when 9914 is current controller-in-charge
DECLARE_READ_LINE_MEMBER(cont_r);
private:
// device-level overrides
virtual void device_start() override;
@ -122,7 +132,9 @@ private:
devcb_write8 m_dio_write_func;
devcb_write_line m_signal_wr_fns[ IEEE_488_SIGNAL_COUNT ];
devcb_write_line m_int_write_func;
devcb_write_line m_accrq_write_func;
bool m_int_line;
bool m_accrq_line;
uint8_t m_dio;
bool m_signals[ IEEE_488_SIGNAL_COUNT ];
@ -288,6 +300,7 @@ private:
void update_int();
void update_ifc();
void update_ren();
void set_accrq(bool state);
};
// device type definition