diff --git a/src/mame/drivers/taitosj.cpp b/src/mame/drivers/taitosj.cpp index 1aed6acf599..858800831b6 100644 --- a/src/mame/drivers/taitosj.cpp +++ b/src/mame/drivers/taitosj.cpp @@ -175,14 +175,22 @@ TODO: WRITE8_MEMBER(taitosj_state::taitosj_sndnmi_msk_w) { - m_sndnmi_disable = data & 0x01; + m_sndnmi_disable = (data & 1); + if ((m_sound_cmd_written && (!m_sndnmi_disable)) || m_sound_semaphore) + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + else + m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } WRITE8_MEMBER(taitosj_state::sound_command_w) { - m_sound_cmd_ack = true; + m_sound_cmd_written = true; m_soundlatch->write(space,0,data); - if (!m_sndnmi_disable) m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + // figure out NMI State + if ((m_sound_cmd_written && (!m_sndnmi_disable)) || m_sound_semaphore) + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + else + m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } @@ -192,9 +200,13 @@ WRITE8_MEMBER(taitosj_state::input_port_4_f0_w) } // EPORT2 -WRITE8_MEMBER(taitosj_state::sound_semaphore_assert_w) +WRITE8_MEMBER(taitosj_state::sound_semaphore_w) { - m_sound_semaphore = (data & 1) == 1; + m_sound_semaphore = (data & 1); + if ((m_sound_cmd_written && (!m_sndnmi_disable)) || m_sound_semaphore) + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + else + m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } CUSTOM_INPUT_MEMBER(taitosj_state::input_port_4_f0_r) @@ -233,7 +245,7 @@ static ADDRESS_MAP_START( taitosj_main_nomcu_map, AS_PROGRAM, 8, taitosj_state ) AM_RANGE(0xd508, 0xd508) AM_MIRROR(0x00f0) AM_WRITE(taitosj_collision_reg_clear_w) AM_RANGE(0xd509, 0xd50a) AM_MIRROR(0x00f0) AM_WRITEONLY AM_SHARE("gfxpointer") AM_RANGE(0xd50b, 0xd50b) AM_MIRROR(0x00f0) AM_WRITE(sound_command_w) - AM_RANGE(0xd50c, 0xd50c) AM_MIRROR(0x00f0) AM_WRITE(sound_semaphore_assert_w) + AM_RANGE(0xd50c, 0xd50c) AM_MIRROR(0x00f0) AM_WRITE(sound_semaphore_w) AM_RANGE(0xd50d, 0xd50d) AM_MIRROR(0x00f0) AM_WRITEONLY /*watchdog_reset_w*/ /* Bio Attack sometimes resets after you die */ AM_RANGE(0xd50e, 0xd50e) AM_MIRROR(0x00f0) AM_WRITE(taitosj_bankswitch_w) AM_RANGE(0xd50f, 0xd50f) AM_MIRROR(0x00f0) AM_WRITENOP @@ -305,7 +317,7 @@ static ADDRESS_MAP_START( kikstart_main_map, AS_PROGRAM, 8, taitosj_state ) AM_RANGE(0xd508, 0xd508) AM_WRITE(taitosj_collision_reg_clear_w) AM_RANGE(0xd509, 0xd50a) AM_WRITEONLY AM_SHARE("gfxpointer") AM_RANGE(0xd50b, 0xd50b) AM_WRITE(sound_command_w) - AM_RANGE(0xd50c, 0xd50c) AM_WRITE(sound_semaphore_assert_w) + AM_RANGE(0xd50c, 0xd50c) AM_WRITE(sound_semaphore_w) AM_RANGE(0xd50d, 0xd50d) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) AM_RANGE(0xd50e, 0xd50e) AM_WRITE(taitosj_bankswitch_w) AM_RANGE(0xd600, 0xd600) AM_WRITEONLY AM_SHARE("video_mode") @@ -316,14 +328,14 @@ ADDRESS_MAP_END // RD5000 READ8_MEMBER(taitosj_state::sound_command_r) { - m_sound_cmd_ack = false; + m_sound_cmd_written = false; return m_soundlatch->read(space,0); } // RD5001 READ8_MEMBER(taitosj_state::sound_status_r) { - return (m_sound_cmd_ack == true ? 8 : 0) | (m_sound_semaphore == true ? 4 : 0) | 3; + return (m_sound_cmd_written == true ? 8 : 0) | (m_sound_semaphore == true ? 4 : 0) | 3; } // WR5000 @@ -336,6 +348,10 @@ WRITE8_MEMBER(taitosj_state::sound_command_ack_w) WRITE8_MEMBER(taitosj_state::sound_semaphore_clear_w) { m_sound_semaphore = false; + if ((m_sound_cmd_written && (!m_sndnmi_disable)) || m_sound_semaphore) + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + else + m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } @@ -1798,6 +1814,12 @@ static MACHINE_CONFIG_START( nomcu, taitosj_state ) MCFG_SOUND_ADD("ay4", AY8910, XTAL_6MHz/4) // 6mhz/4 on GAME board, AY-3-8910 @ IC50 MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + /* TODO: Implement ay4 Port A bits 0 and 1 which connect to a 7416 open + collector inverter, to selectively tie none, either or both of two + capacitors between the ay4 audio output signal and ground, or between + audio output signal and high-z (i.e. do nothing). + Bio Attack uses this? + */ MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(taitosj_state, taitosj_sndnmi_msk_w)) /* port Bwrite */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) @@ -2703,7 +2725,8 @@ ROM_END void taitosj_state::reset_common() { - m_sndnmi_disable = 1; + m_sndnmi_disable = false; // ay-3-8910 resets all registers to 0 on reset + m_sound_semaphore = false; m_input_port_4_f0 = 0; /* start in 1st gear */ m_kikstart_gears[0] = 0x02; @@ -2715,6 +2738,8 @@ void taitosj_state::reset_common() void taitosj_state::init_common() { save_item(NAME(m_sndnmi_disable)); + save_item(NAME(m_sound_cmd_written)); + save_item(NAME(m_sound_semaphore)); save_item(NAME(m_input_port_4_f0)); save_item(NAME(m_kikstart_gears)); save_item(NAME(m_dac_out)); diff --git a/src/mame/includes/taitosj.h b/src/mame/includes/taitosj.h index 5ce51b8e0f3..9ebb3dd5f11 100644 --- a/src/mame/includes/taitosj.h +++ b/src/mame/includes/taitosj.h @@ -34,7 +34,6 @@ public: typedef void (taitosj_state::*copy_layer_func_t)(bitmap_ind16 &, const rectangle &, int, int *, rectangle *); - UINT8 m_sndnmi_disable; UINT8 m_input_port_4_f0; UINT8 m_kikstart_gears[2]; INT8 m_dac_out; @@ -63,8 +62,9 @@ public: UINT8 m_spacecr_prot_value; UINT8 m_protection_value; UINT32 m_address; - bool m_sound_cmd_ack; - bool m_sound_semaphore; + bool m_sndnmi_disable; // AKA "CIOB0" on schematic + bool m_sound_cmd_written; // 74ls74 1/2 @ GAME BOARD IC42 + bool m_sound_semaphore; // 74ls74 2/2 @ GAME BOARD IC42 bitmap_ind16 m_layer_bitmap[3]; bitmap_ind16 m_sprite_sprite_collbitmap1; bitmap_ind16 m_sprite_sprite_collbitmap2; @@ -75,7 +75,7 @@ public: DECLARE_WRITE8_MEMBER(sound_command_w); DECLARE_READ8_MEMBER(sound_command_r); DECLARE_READ8_MEMBER(sound_status_r); - DECLARE_WRITE8_MEMBER(sound_semaphore_assert_w); + DECLARE_WRITE8_MEMBER(sound_semaphore_w); DECLARE_WRITE8_MEMBER(sound_semaphore_clear_w); DECLARE_WRITE8_MEMBER(taitosj_bankswitch_w); DECLARE_READ8_MEMBER(taitosj_fake_data_r);