From 2c63f0e4fe4969ce041f52d07a77cc0e4d8c7f90 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 14 Jun 2017 11:43:11 -0400 Subject: f1gp.cpp: Soundlatch modernization (nw) --- src/mame/drivers/f1gp.cpp | 24 ++++++------------------ src/mame/includes/f1gp.h | 5 ----- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/mame/drivers/f1gp.cpp b/src/mame/drivers/f1gp.cpp index 857299a4e14..8fe048c30ad 100644 --- a/src/mame/drivers/f1gp.cpp +++ b/src/mame/drivers/f1gp.cpp @@ -45,21 +45,9 @@ WRITE8_MEMBER(f1gp_state::f1gp_sh_bankswitch_w) } -WRITE8_MEMBER(f1gp_state::sound_command_w) -{ - m_pending_command = 1; - m_soundlatch->write(space, offset, data & 0xff); - m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - READ8_MEMBER(f1gp_state::command_pending_r) { - return (m_pending_command ? 0xff : 0); -} - -WRITE8_MEMBER(f1gp_state::pending_command_clear_w) -{ - m_pending_command = 0; + return (m_soundlatch->pending_r() ? 0xff : 0); } @@ -86,7 +74,7 @@ static ADDRESS_MAP_START( f1gp_cpu1_map, AS_PROGRAM, 16, f1gp_state ) AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW1") AM_RANGE(0xfff002, 0xfff005) AM_WRITE(f1gp_fgscroll_w) AM_RANGE(0xfff006, 0xfff007) AM_READ_PORT("DSW2") - AM_RANGE(0xfff008, 0xfff009) AM_READWRITE8(command_pending_r, sound_command_w, 0x00ff) + AM_RANGE(0xfff008, 0xfff009) AM_READ8(command_pending_r, 0x00ff) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) AM_RANGE(0xfff020, 0xfff023) AM_DEVWRITE8("gga", vsystem_gga_device, write, 0x00ff) AM_RANGE(0xfff040, 0xfff05f) AM_DEVWRITE("k053936", k053936_device, ctrl_w) AM_RANGE(0xfff050, 0xfff051) AM_READ_PORT("DSW3") @@ -106,7 +94,7 @@ static ADDRESS_MAP_START( f1gp2_cpu1_map, AS_PROGRAM, 16, f1gp_state ) // AM_RANGE(0xfff002, 0xfff003) analog wheel? AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW1") AM_RANGE(0xfff006, 0xfff007) AM_READ_PORT("DSW2") - AM_RANGE(0xfff008, 0xfff009) AM_READWRITE8(command_pending_r, sound_command_w, 0x00ff) + AM_RANGE(0xfff008, 0xfff009) AM_READ8(command_pending_r, 0x00ff) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) AM_RANGE(0xfff00a, 0xfff00b) AM_READ_PORT("DSW3") AM_RANGE(0xfff020, 0xfff03f) AM_DEVWRITE("k053936", k053936_device, ctrl_w) AM_RANGE(0xfff044, 0xfff047) AM_WRITE(f1gp_fgscroll_w) @@ -128,7 +116,7 @@ static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, f1gp_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_WRITE(f1gp_sh_bankswitch_w) // f1gp AM_RANGE(0x0c, 0x0c) AM_WRITE(f1gp_sh_bankswitch_w) // f1gp2 - AM_RANGE(0x14, 0x14) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITE(pending_command_clear_w) + AM_RANGE(0x14, 0x14) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, read, acknowledge_w) AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write) ADDRESS_MAP_END @@ -368,7 +356,6 @@ GFXDECODE_END MACHINE_START_MEMBER(f1gp_state,f1gpb) { - save_item(NAME(m_pending_command)); save_item(NAME(m_roz_bank)); save_item(NAME(m_flipscreen)); save_item(NAME(m_gfxctrl)); @@ -384,7 +371,6 @@ MACHINE_START_MEMBER(f1gp_state,f1gp) MACHINE_RESET_MEMBER(f1gp_state,f1gp) { - m_pending_command = 0; m_roz_bank = 0; m_flipscreen = 0; m_gfxctrl = 0; @@ -448,6 +434,8 @@ static MACHINE_CONFIG_START( f1gp ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true) MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_8MHz) MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) diff --git a/src/mame/includes/f1gp.h b/src/mame/includes/f1gp.h index ecc262d27cd..ebb815ff28a 100644 --- a/src/mame/includes/f1gp.h +++ b/src/mame/includes/f1gp.h @@ -63,9 +63,6 @@ public: uint32_t f1gp_old_tile_callback( uint32_t code ); uint32_t f1gp_ol2_tile_callback( uint32_t code ); - /* misc */ - int m_pending_command; - /* devices */ required_device m_maincpu; optional_device m_spr_old; // f1gp @@ -78,9 +75,7 @@ public: optional_device m_soundlatch; // not f1gpb DECLARE_WRITE8_MEMBER(f1gp_sh_bankswitch_w); - DECLARE_WRITE8_MEMBER(sound_command_w); DECLARE_READ8_MEMBER(command_pending_r); - DECLARE_WRITE8_MEMBER(pending_command_clear_w); DECLARE_WRITE16_MEMBER(f1gpb_misc_w); DECLARE_READ16_MEMBER(f1gp_zoomdata_r); DECLARE_WRITE16_MEMBER(f1gp_zoomdata_w); -- cgit v1.2.3