diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2017-08-18 00:40:46 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2017-08-18 00:41:33 -0400 |
commit | 0733b3414bab8d7dab03a7bf77a2c70c5cd11dd7 (patch) | |
tree | 8991c37be9ce8149306d70c3c92b80a5dbc34355 | |
parent | 955c226a3a0eb626c95d6190fe3fc31133525ed7 (diff) |
nycaptor.cpp: Soundlatch modernization (nw)
-rw-r--r-- | src/mame/drivers/nycaptor.cpp | 81 | ||||
-rw-r--r-- | src/mame/includes/nycaptor.h | 16 |
2 files changed, 43 insertions, 54 deletions
diff --git a/src/mame/drivers/nycaptor.cpp b/src/mame/drivers/nycaptor.cpp index eb2c998645f..27b4d99600c 100644 --- a/src/mame/drivers/nycaptor.cpp +++ b/src/mame/drivers/nycaptor.cpp @@ -211,16 +211,6 @@ WRITE8_MEMBER(nycaptor_state::sub_cpu_halt_w) m_subcpu->set_input_line(INPUT_LINE_HALT, (data) ? ASSERT_LINE : CLEAR_LINE); } -READ8_MEMBER(nycaptor_state::from_snd_r) -{ - return m_snd_data; -} - -WRITE8_MEMBER(nycaptor_state::to_main_w) -{ - m_snd_data = data; -} - READ8_MEMBER(nycaptor_state::nycaptor_b_r) { return 1; @@ -259,6 +249,11 @@ READ8_MEMBER(nycaptor_state::nycaptor_mcu_status_r2) return (CLEAR_LINE != m_bmcu->host_semaphore_r()) ? 0 : 1; } +READ8_MEMBER(nycaptor_state::sound_status_r) +{ + return (m_soundlatch->pending_r() ? 1 : 0) | (m_soundlatch2->pending_r() ? 2 : 0); +} + MACHINE_RESET_MEMBER(nycaptor_state,ta7630) { @@ -277,34 +272,14 @@ MACHINE_RESET_MEMBER(nycaptor_state,ta7630) } } -TIMER_CALLBACK_MEMBER(nycaptor_state::nmi_callback) -{ - if (m_sound_nmi_enable) - m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - else - m_pending_nmi = 1; -} - -WRITE8_MEMBER(nycaptor_state::sound_command_w) -{ - m_soundlatch->write(space, 0, data); - machine().scheduler().synchronize(timer_expired_delegate(FUNC(nycaptor_state::nmi_callback),this), data); -} - WRITE8_MEMBER(nycaptor_state::nmi_disable_w) { - m_sound_nmi_enable = 0; + m_soundnmi->in_w<1>(0); } WRITE8_MEMBER(nycaptor_state::nmi_enable_w) { - m_sound_nmi_enable = 1; - - if (m_pending_nmi) - { - m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - m_pending_nmi = 0; - } + m_soundnmi->in_w<1>(1); } WRITE8_MEMBER(nycaptor_state::unk_w) @@ -329,7 +304,7 @@ static ADDRESS_MAP_START( nycaptor_master_map, AS_PROGRAM, 8, nycaptor_state ) AM_RANGE(0xd000, 0xd000) AM_DEVREADWRITE("bmcu", taito68705_mcu_device, data_r, data_w) AM_RANGE(0xd001, 0xd001) AM_WRITE(sub_cpu_halt_w) AM_RANGE(0xd002, 0xd002) AM_READWRITE(nycaptor_generic_control_r, nycaptor_generic_control_w) /* bit 3 - memory bank at 0x8000-0xbfff */ - AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w) + AM_RANGE(0xd400, 0xd400) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xd401, 0xd401) AM_READNOP AM_RANGE(0xd403, 0xd403) AM_WRITE(sound_cpu_reset_w) AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSWA") @@ -338,7 +313,7 @@ static ADDRESS_MAP_START( nycaptor_master_map, AS_PROGRAM, 8, nycaptor_state ) AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN0") AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1") AM_RANGE(0xd805, 0xd805) AM_READ(nycaptor_mcu_status_r1) - AM_RANGE(0xd806, 0xd806) AM_READNOP /* unknown ?sound? */ + AM_RANGE(0xd806, 0xd806) AM_READ(sound_status_r) AM_RANGE(0xd807, 0xd807) AM_READ(nycaptor_mcu_status_r2) AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(nycaptor_scrlram_w) AM_SHARE("scrlram") @@ -376,10 +351,10 @@ static ADDRESS_MAP_START( nycaptor_sound_map, AS_PROGRAM, 8, nycaptor_state ) AM_RANGE(0xca00, 0xca00) AM_WRITENOP AM_RANGE(0xcb00, 0xcb00) AM_WRITENOP AM_RANGE(0xcc00, 0xcc00) AM_WRITENOP - AM_RANGE(0xd000, 0xd000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITE(to_main_w) + AM_RANGE(0xd000, 0xd000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) AM_RANGE(0xd200, 0xd200) AM_READNOP AM_WRITE(nmi_enable_w) AM_RANGE(0xd400, 0xd400) AM_WRITE(nmi_disable_w) - AM_RANGE(0xd600, 0xd600) AM_WRITENOP + AM_RANGE(0xd600, 0xd600) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w) AM_RANGE(0xe000, 0xefff) AM_NOP ADDRESS_MAP_END @@ -424,7 +399,7 @@ static ADDRESS_MAP_START( cyclshtg_master_map, AS_PROGRAM, 8, nycaptor_state ) AM_RANGE(0xd000, 0xd000) AM_READWRITE(cyclshtg_mcu_r, cyclshtg_mcu_w) AM_RANGE(0xd001, 0xd001) AM_WRITE(sub_cpu_halt_w) AM_RANGE(0xd002, 0xd002) AM_READWRITE(nycaptor_generic_control_r, cyclshtg_generic_control_w) - AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w) + AM_RANGE(0xd400, 0xd400) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xd403, 0xd403) AM_WRITE(sound_cpu_reset_w) AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSWA") AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSWB") @@ -432,7 +407,7 @@ static ADDRESS_MAP_START( cyclshtg_master_map, AS_PROGRAM, 8, nycaptor_state ) AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN0") AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1") AM_RANGE(0xd805, 0xd805) AM_READ(cyclshtg_mcu_status_r) - AM_RANGE(0xd806, 0xd806) AM_READNOP + AM_RANGE(0xd806, 0xd806) AM_READ(sound_status_r) AM_RANGE(0xd807, 0xd807) AM_READ(cyclshtg_mcu_status_r) AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(nycaptor_scrlram_w) AM_SHARE("scrlram") @@ -478,7 +453,7 @@ static ADDRESS_MAP_START( bronx_master_map, AS_PROGRAM, 8, nycaptor_state ) AM_RANGE(0xd000, 0xd000) AM_READ(cyclshtg_mcu_r) AM_WRITENOP AM_RANGE(0xd001, 0xd001) AM_WRITE(sub_cpu_halt_w) AM_RANGE(0xd002, 0xd002) AM_READWRITE(nycaptor_generic_control_r, cyclshtg_generic_control_w) - AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w) + AM_RANGE(0xd400, 0xd400) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xd401, 0xd401) AM_READ(unk_r) AM_RANGE(0xd403, 0xd403) AM_WRITE(sound_cpu_reset_w) AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSWA") @@ -487,7 +462,7 @@ static ADDRESS_MAP_START( bronx_master_map, AS_PROGRAM, 8, nycaptor_state ) AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN0") AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1") AM_RANGE(0xd805, 0xd805) AM_READ(cyclshtg_mcu_status_r) - AM_RANGE(0xd806, 0xd806) AM_READNOP + AM_RANGE(0xd806, 0xd806) AM_READ(sound_status_r) AM_RANGE(0xd807, 0xd807) AM_READ(cyclshtg_mcu_status_r) AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(nycaptor_scrlram_w) AM_SHARE("scrlram") @@ -753,8 +728,6 @@ void nycaptor_state::machine_start() membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000); save_item(NAME(m_generic_control_reg)); - save_item(NAME(m_sound_nmi_enable)); - save_item(NAME(m_pending_nmi)); save_item(NAME(m_snd_data)); save_item(NAME(m_vol_ctrl)); @@ -762,7 +735,8 @@ void nycaptor_state::machine_start() save_item(NAME(m_palette_bank)); save_item(NAME(m_gfxctrl)); - + // hack to put input_merger in correct initial state + m_soundnmi->in_w<0>(0); } void nycaptor_state::machine_reset() @@ -770,15 +744,12 @@ void nycaptor_state::machine_reset() MACHINE_RESET_CALL_MEMBER(ta7630); m_generic_control_reg = 0; - m_sound_nmi_enable = 0; - m_pending_nmi = 0; m_snd_data = 0; m_char_bank = 0; m_palette_bank = 0; m_gfxctrl = 0; - memset(m_vol_ctrl, 0, sizeof(m_vol_ctrl)); } @@ -820,6 +791,12 @@ static MACHINE_CONFIG_START( nycaptor ) MCFG_SPEAKER_STANDARD_MONO("speaker") MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundnmi", input_merger_device, in_w<0>)) + + MCFG_INPUT_MERGER_ALL_HIGH("soundnmi") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") MCFG_SOUND_ADD("ay1", AY8910, 8000000/4) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(nycaptor_state, unk_w)) @@ -884,6 +861,12 @@ static MACHINE_CONFIG_START( cyclshtg ) MCFG_SPEAKER_STANDARD_MONO("speaker") MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundnmi", input_merger_device, in_w<0>)) + + MCFG_INPUT_MERGER_ALL_HIGH("soundnmi") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") MCFG_SOUND_ADD("ay1", AY8910, 8000000/4) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(nycaptor_state, unk_w)) @@ -947,6 +930,12 @@ static MACHINE_CONFIG_START( bronx ) MCFG_SPEAKER_STANDARD_MONO("speaker") MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundnmi", input_merger_device, in_w<0>)) + + MCFG_INPUT_MERGER_ALL_HIGH("soundnmi") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") MCFG_SOUND_ADD("ay1", AY8910, 8000000/4) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(nycaptor_state, unk_w)) diff --git a/src/mame/includes/nycaptor.h b/src/mame/includes/nycaptor.h index 25a12fdac26..c32aecbda2d 100644 --- a/src/mame/includes/nycaptor.h +++ b/src/mame/includes/nycaptor.h @@ -2,6 +2,7 @@ // copyright-holders:Tomasz Slanina #include "machine/gen_latch.h" +#include "machine/input_merger.h" #include "sound/msm5232.h" #include "machine/taito68705interface.h" @@ -21,7 +22,9 @@ public: m_msm(*this, "msm"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch"), + m_soundlatch2(*this, "soundlatch2"), + m_soundnmi(*this, "soundnmi") { } /* memory pointers */ required_shared_ptr<uint8_t> m_videoram; @@ -39,8 +42,6 @@ public: /* misc */ int m_generic_control_reg; - int m_sound_nmi_enable; - int m_pending_nmi; uint8_t m_snd_data; int m_vol_ctrl[16]; int m_gametype; @@ -54,16 +55,15 @@ public: required_device<msm5232_device> m_msm; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - optional_device<generic_latch_8_device> m_soundlatch; + required_device<generic_latch_8_device> m_soundlatch; + required_device<generic_latch_8_device> m_soundlatch2; + required_device<input_merger_device> m_soundnmi; DECLARE_WRITE8_MEMBER(sub_cpu_halt_w); - DECLARE_READ8_MEMBER(from_snd_r); - DECLARE_WRITE8_MEMBER(to_main_w); DECLARE_READ8_MEMBER(nycaptor_b_r); DECLARE_READ8_MEMBER(nycaptor_by_r); DECLARE_READ8_MEMBER(nycaptor_bx_r); DECLARE_WRITE8_MEMBER(sound_cpu_reset_w); - DECLARE_WRITE8_MEMBER(sound_command_w); DECLARE_WRITE8_MEMBER(nmi_disable_w); DECLARE_WRITE8_MEMBER(nmi_enable_w); DECLARE_READ8_MEMBER(nycaptor_generic_control_r); @@ -77,6 +77,7 @@ public: DECLARE_READ8_MEMBER(nycaptor_mcu_status_r1); DECLARE_READ8_MEMBER(nycaptor_mcu_status_r2); + DECLARE_READ8_MEMBER(sound_status_r); DECLARE_WRITE8_MEMBER(nycaptor_videoram_w); DECLARE_WRITE8_MEMBER(nycaptor_palette_w); DECLARE_READ8_MEMBER(nycaptor_palette_r); @@ -94,7 +95,6 @@ public: virtual void video_start() override; DECLARE_MACHINE_RESET(ta7630); uint32_t screen_update_nycaptor(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(nmi_callback); int nycaptor_spot( ); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ); }; |