Made anonymous timer non-anonymous in arkanoid.cpp, fixes savestates for the sets using the original Taito MCU code [Lord Nightmare]

This commit is contained in:
Lord-Nightmare 2016-02-02 15:44:09 -05:00
parent 45f84d902e
commit c9faa144ba
3 changed files with 10 additions and 5 deletions

View File

@ -1245,6 +1245,10 @@ GFXDECODE_END
void arkanoid_state::machine_start()
{
// allocate the MCU timer, even if we have no MCU, and set it to fire NEVER.
m_68705_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(arkanoid_state::timer_68705_increment),this));
m_68705_timer->adjust(attotime::never);
save_item(NAME(m_gfxbank));
save_item(NAME(m_palettebank));
@ -1284,6 +1288,7 @@ void arkanoid_state::machine_reset()
m_z80HasWritten = 0;
m_68705HasWritten = 0;
if (m_mcu.found()) m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE);
if (m_mcu.found()) m_68705_timer->adjust(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<7)));
m_port_a_in = 0;
m_port_a_out = 0;

View File

@ -62,7 +62,7 @@ public:
UINT8 m_ddr_c;
UINT8 m_tdr;
UINT8 m_tcr;
emu_timer *m_68705_timer;
/* hexaa */
UINT8 m_hexaa_from_main;

View File

@ -82,14 +82,14 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_68705_tcr_w)
if ((m_tcr^data)&0x20)// check if TIN state changed
{
/* logerror("timer enable state changed!\n"); */
if (data&0x20) timer_set(attotime::never, TIMER_68705_PRESCALER_EXPIRED);
else timer_set(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(data&0x7))), TIMER_68705_PRESCALER_EXPIRED);
if (data&0x20) m_68705_timer->adjust(attotime::never, TIMER_68705_PRESCALER_EXPIRED);
else m_68705_timer->adjust(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(data&0x7))), TIMER_68705_PRESCALER_EXPIRED);
}
// prescaler check: if timer prescaler has changed, or the PSC bit is set, adjust the timer length for the prescaler expired timer, but only if the timer would be running
if ( (((m_tcr&0x07)!=(data&0x07))||(data&0x08)) && ((data&0x20)==0) )
{
/* logerror("timer reset due to PSC or prescaler change!\n"); */
timer_set(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(data&0x7))), TIMER_68705_PRESCALER_EXPIRED);
m_68705_timer->adjust(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(data&0x7))), TIMER_68705_PRESCALER_EXPIRED);
}
m_tcr = data;
// if int state is set, and TIM is unmasked, assert an interrupt. otherwise clear it.
@ -120,7 +120,7 @@ TIMER_CALLBACK_MEMBER(arkanoid_state::timer_68705_increment)
m_mcu->set_input_line(M68705_INT_TIMER, ASSERT_LINE);
else
m_mcu->set_input_line(M68705_INT_TIMER, CLEAR_LINE);
timer_set(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(m_tcr&0x7))), TIMER_68705_PRESCALER_EXPIRED);
m_68705_timer->adjust(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(m_tcr&0x7))), TIMER_68705_PRESCALER_EXPIRED);
}
READ8_MEMBER(arkanoid_state::arkanoid_68705_port_c_r)