arkanoid: confirm MCU reset also resets semaphore flags [Lord Nightmare, Vas Crabb]

This commit is contained in:
Vas Crabb 2017-01-13 17:31:06 +11:00
parent 35dd85a748
commit a90ccab72e
3 changed files with 17 additions and 9 deletions

View File

@ -393,7 +393,8 @@ READ8_MEMBER(arkanoid_mcu_device_base::data_r)
WRITE8_MEMBER(arkanoid_mcu_device_base::data_w)
{
// set host semaphore flag and latch data
m_host_flag = true;
if (!m_reset_input)
m_host_flag = true;
m_host_latch = data;
m_mcu->set_input_line(M68705_IRQ_LINE, ASSERT_LINE);
}
@ -406,8 +407,14 @@ CUSTOM_INPUT_MEMBER(arkanoid_mcu_device_base::semaphore_r)
WRITE_LINE_MEMBER(arkanoid_mcu_device_base::reset_w)
{
m_reset_input = ASSERT_LINE == state;
if (CLEAR_LINE != state)
{
m_host_flag = false;
m_mcu_flag = false;
m_semaphore_cb(CLEAR_LINE);
}
m_mcu->set_input_line(INPUT_LINE_RESET, state);
// TODO: determine whether host CPU controlled reset also clears the semaphore flags
}
READ8_MEMBER(arkanoid_mcu_device_base::mcu_pa_r)
@ -445,7 +452,8 @@ WRITE8_MEMBER(arkanoid_mcu_device_base::mcu_pc_w)
// PC3 sets the MCU semaphore when low
if (!BIT(data, 3))
{
m_mcu_flag = true;
if (!m_reset_input)
m_mcu_flag = true;
// data is latched on falling edge
if (BIT(m_pc_output, 3))
@ -470,6 +478,7 @@ arkanoid_mcu_device_base::arkanoid_mcu_device_base(
, m_mcu(*this, "mcu")
, m_semaphore_cb(*this)
, m_portb_r_cb(*this)
, m_reset_input(false)
, m_host_flag(false)
, m_mcu_flag(false)
, m_host_latch(0xff)
@ -484,6 +493,7 @@ void arkanoid_mcu_device_base::device_start()
m_semaphore_cb.resolve_safe();
m_portb_r_cb.resolve_safe(0xff);
save_item(NAME(m_reset_input));
save_item(NAME(m_host_flag));
save_item(NAME(m_mcu_flag));
save_item(NAME(m_host_latch));
@ -491,6 +501,7 @@ void arkanoid_mcu_device_base::device_start()
save_item(NAME(m_pa_output));
save_item(NAME(m_pc_output));
m_reset_input = false;
m_host_latch = 0xff;
m_mcu_latch = 0xff;
m_pa_output = 0xff;

View File

@ -135,6 +135,7 @@ protected:
devcb_write_line m_semaphore_cb;
devcb_read8 m_portb_r_cb;
bool m_reset_input;
bool m_host_flag;
bool m_mcu_flag;
u8 m_host_latch;

View File

@ -53,12 +53,8 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_d008_w)
m_bg_tilemap->mark_all_dirty();
}
/* BM: bit 7 is suspected to be MCU reset, the evidence for this is that
the games tilt mode reset sequence shows the main CPU must be able to
directly control the reset line of the MCU, else the game will crash
leaving the tilt screen (as the MCU is now out of sync with main CPU
which resets itself). This bit is the likely candidate as it is flipped
early in bootup just prior to accessing the MCU for the first time. */
// bit 7 resets the MCU and semaphore flipflops
// This bit is flipped early in bootup just prior to accessing the MCU for the first time.
if (m_mcuintf.found()) // Bootlegs don't have the MCU but still set this bit
m_mcuintf->reset_w(BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE);
}