added z80 nmi enable/disable

**Can someone else please do the MESS side? ng_aes.c/neogeocd
This commit is contained in:
Michaël Banaan Ananas 2014-03-13 23:26:26 +00:00
parent 6d443824b0
commit dd6fcf5427
2 changed files with 37 additions and 18 deletions

View File

@ -304,14 +304,21 @@ void neogeo_state::start_interrupt_timers()
* *
*************************************/ *************************************/
void neogeo_state::audio_cpu_assert_nmi() void neogeo_state::audio_cpu_check_nmi()
{ {
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); m_audiocpu->set_input_line(INPUT_LINE_NMI, (m_audio_cpu_nmi_enabled && m_audio_cpu_nmi_pending) ? ASSERT_LINE : CLEAR_LINE );
} }
void neogeo_state::audio_cpu_clear_nmi() WRITE8_MEMBER(neogeo_state::audio_cpu_enable_nmi_w)
{ {
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); m_audio_cpu_nmi_enabled = true;
audio_cpu_check_nmi();
}
WRITE8_MEMBER(neogeo_state::audio_cpu_disable_nmi_w)
{
m_audio_cpu_nmi_enabled = false;
audio_cpu_check_nmi();
} }
@ -542,7 +549,8 @@ WRITE16_MEMBER(neogeo_state::audio_command_w)
{ {
soundlatch_write(data >> 8); soundlatch_write(data >> 8);
audio_cpu_assert_nmi(); m_audio_cpu_nmi_pending = true;
audio_cpu_check_nmi();
/* boost the interleave to let the audio CPU read the command */ /* boost the interleave to let the audio CPU read the command */
machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
@ -550,14 +558,12 @@ WRITE16_MEMBER(neogeo_state::audio_command_w)
} }
READ8_MEMBER(neogeo_state::audio_command_r) READ8_MEMBER(neogeo_state::audio_command_r)
{ {
UINT8 ret = soundlatch_read(); UINT8 ret = soundlatch_read();
audio_cpu_clear_nmi(); m_audio_cpu_nmi_pending = false;
audio_cpu_check_nmi();
return ret; return ret;
} }
@ -875,6 +881,8 @@ void neogeo_state::machine_start()
m_vblank_level = 1; m_vblank_level = 1;
m_raster_level = 2; m_raster_level = 2;
m_audio_cpu_nmi_pending = false;
/* start with an IRQ3 - but NOT on a reset */ /* start with an IRQ3 - but NOT on a reset */
m_irq3_pending = 1; m_irq3_pending = 1;
@ -884,6 +892,8 @@ void neogeo_state::machine_start()
save_item(NAME(m_vblank_interrupt_pending)); save_item(NAME(m_vblank_interrupt_pending));
save_item(NAME(m_display_position_interrupt_pending)); save_item(NAME(m_display_position_interrupt_pending));
save_item(NAME(m_irq3_pending)); save_item(NAME(m_irq3_pending));
save_item(NAME(m_audio_cpu_nmi_enabled));
save_item(NAME(m_audio_cpu_nmi_pending));
save_item(NAME(m_controller_select)); save_item(NAME(m_controller_select));
save_item(NAME(m_main_cpu_bank_address)); save_item(NAME(m_main_cpu_bank_address));
save_item(NAME(m_save_ram_unlocked)); save_item(NAME(m_save_ram_unlocked));
@ -914,6 +924,11 @@ void neogeo_state::machine_reset()
for (offs = 0; offs < 8; offs++) for (offs = 0; offs < 8; offs++)
system_control_w(space, offs, 0, 0x00ff); system_control_w(space, offs, 0, 0x00ff);
// disable audiocpu nmi
m_audio_cpu_nmi_enabled = false;
m_audio_cpu_nmi_pending = false;
audio_cpu_check_nmi();
m_maincpu->reset(); m_maincpu->reset();
// FIXME: this doesn't belong in the base system // FIXME: this doesn't belong in the base system
@ -990,10 +1005,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_io_map, AS_IO, 8, neogeo_state ) static ADDRESS_MAP_START( audio_io_map, AS_IO, 8, neogeo_state )
AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(audio_command_r, soundlatch_clear_byte_w) AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(audio_command_r, soundlatch_clear_byte_w)
AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write) AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write)
// AM_RANGE(0x08, 0x08) AM_MIRROR(0xff00) /* write - NMI enable / acknowledge? (the data written doesn't matter) */ AM_RANGE(0x08, 0x08) AM_MIRROR(0xff00) AM_WRITE(audio_cpu_enable_nmi_w)
AM_RANGE(0x08, 0x0b) AM_MIRROR(0xfff0) AM_MASK(0xff03) AM_READ(audio_cpu_bank_select_r) AM_RANGE(0x08, 0x0b) AM_MIRROR(0xfff0) AM_MASK(0xff03) AM_READ(audio_cpu_bank_select_r)
AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff00) AM_WRITE(soundlatch2_byte_w) AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff00) AM_WRITE(soundlatch2_byte_w)
// AM_RANGE(0x18, 0x18) AM_MIRROR(0xff00) /* write - NMI disable? (the data written doesn't matter) */ AM_RANGE(0x18, 0x18) AM_MIRROR(0xff00) AM_WRITE(audio_cpu_disable_nmi_w)
ADDRESS_MAP_END ADDRESS_MAP_END

View File

@ -40,7 +40,8 @@ public:
m_upd4990a(*this, "upd4990a"), m_upd4990a(*this, "upd4990a"),
m_save_ram(*this, "saveram"), m_save_ram(*this, "saveram"),
m_screen(*this, "screen"), m_screen(*this, "screen"),
m_palette(*this, "palette") { } m_palette(*this, "palette")
{ }
DECLARE_WRITE16_MEMBER(io_control_w); DECLARE_WRITE16_MEMBER(io_control_w);
DECLARE_READ16_MEMBER(memcard_r); DECLARE_READ16_MEMBER(memcard_r);
@ -49,6 +50,8 @@ public:
DECLARE_READ8_MEMBER(audio_command_r); DECLARE_READ8_MEMBER(audio_command_r);
DECLARE_WRITE16_MEMBER(main_cpu_bank_select_w); DECLARE_WRITE16_MEMBER(main_cpu_bank_select_w);
DECLARE_READ8_MEMBER(audio_cpu_bank_select_r); DECLARE_READ8_MEMBER(audio_cpu_bank_select_r);
DECLARE_WRITE8_MEMBER(audio_cpu_enable_nmi_w);
DECLARE_WRITE8_MEMBER(audio_cpu_disable_nmi_w);
DECLARE_WRITE16_MEMBER(system_control_w); DECLARE_WRITE16_MEMBER(system_control_w);
DECLARE_READ16_MEMBER(neogeo_unmapped_r); DECLARE_READ16_MEMBER(neogeo_unmapped_r);
DECLARE_READ16_MEMBER(neogeo_paletteram_r); DECLARE_READ16_MEMBER(neogeo_paletteram_r);
@ -188,8 +191,7 @@ protected:
void create_sprite_line_timer( ); void create_sprite_line_timer( );
void start_sprite_line_timer( ); void start_sprite_line_timer( );
UINT16 get_video_control( ); UINT16 get_video_control( );
void audio_cpu_assert_nmi(); void audio_cpu_check_nmi();
void audio_cpu_clear_nmi();
void select_controller( UINT8 data ); void select_controller( UINT8 data );
void set_save_ram_unlock( UINT8 data ); void set_save_ram_unlock( UINT8 data );
void set_outputs( ); void set_outputs( );
@ -345,6 +347,8 @@ protected:
UINT32 m_main_cpu_bank_address; UINT32 m_main_cpu_bank_address;
UINT8 m_controller_select; UINT8 m_controller_select;
bool m_recurse; bool m_recurse;
bool m_audio_cpu_nmi_enabled;
bool m_audio_cpu_nmi_pending;
// MVS-specific state // MVS-specific state
UINT8 m_save_ram_unlocked; UINT8 m_save_ram_unlocked;