summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-02-18 17:44:39 -0500
committer AJR <ajrhacker@users.noreply.github.com>2018-02-18 17:44:39 -0500
commit49ee5197ff3fb6284ca547e73d16f9ba4e2e69b9 (patch)
treed5418a9896ce79f3ae78110dfc793be0402d7681
parent109e2dadb8d7a671d10790e87234b6649b758f2f (diff)
crgolf: Soundlatch modernization (nw)
-rw-r--r--src/mame/drivers/crgolf.cpp79
-rw-r--r--src/mame/includes/crgolf.h8
2 files changed, 15 insertions, 72 deletions
diff --git a/src/mame/drivers/crgolf.cpp b/src/mame/drivers/crgolf.cpp
index 6cee94a4f59..d1ad58e73ef 100644
--- a/src/mame/drivers/crgolf.cpp
+++ b/src/mame/drivers/crgolf.cpp
@@ -94,6 +94,7 @@ protected or a snippet should do the aforementioned string copy.
#include "cpu/z80/z80.h"
#include "machine/74259.h"
+#include "machine/gen_latch.h"
#include "sound/ay8910.h"
#include "sound/msm5205.h"
#include "screen.h"
@@ -125,8 +126,6 @@ void crgolf_state::machine_start()
/* register for save states */
save_item(NAME(m_port_select));
- save_item(NAME(m_main_to_sound_data));
- save_item(NAME(m_sound_to_main_data));
save_item(NAME(m_sample_offset));
save_item(NAME(m_sample_count));
save_item(NAME(m_color_select));
@@ -139,8 +138,6 @@ void crgolf_state::machine_start()
void crgolf_state::machine_reset()
{
m_port_select = 0;
- m_main_to_sound_data = 0;
- m_sound_to_main_data = 0;
m_sample_offset = 0;
m_sample_count = 0;
}
@@ -187,60 +184,6 @@ WRITE8_MEMBER(crgolf_state::unknown_w)
/*************************************
*
- * Main->Sound CPU communications
- *
- *************************************/
-
-TIMER_CALLBACK_MEMBER(crgolf_state::main_to_sound_callback)
-{
- m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- m_main_to_sound_data = param;
-}
-
-
-WRITE8_MEMBER(crgolf_state::main_to_sound_w)
-{
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(crgolf_state::main_to_sound_callback),this), data);
-}
-
-
-READ8_MEMBER(crgolf_state::main_to_sound_r)
-{
- m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
- return m_main_to_sound_data;
-}
-
-
-
-/*************************************
- *
- * Sound->Main CPU communications
- *
- *************************************/
-
-TIMER_CALLBACK_MEMBER(crgolf_state::sound_to_main_callback)
-{
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- m_sound_to_main_data = param;
-}
-
-
-WRITE8_MEMBER(crgolf_state::sound_to_main_w)
-{
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(crgolf_state::sound_to_main_callback),this), data);
-}
-
-
-READ8_MEMBER(crgolf_state::sound_to_main_r)
-{
- m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
- return m_sound_to_main_data;
-}
-
-
-
-/*************************************
- *
* Hawaii auto-sample player
*
*************************************/
@@ -338,7 +281,8 @@ ADDRESS_MAP_START(crgolf_state::main_map)
AM_RANGE(0x4000, 0x5fff) AM_RAM
AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1")
AM_RANGE(0x8000, 0x8007) AM_DEVWRITE("mainlatch", ls259_device, write_d0)
- AM_RANGE(0x8800, 0x8800) AM_READWRITE(sound_to_main_r, main_to_sound_w)
+ AM_RANGE(0x8800, 0x8800) AM_DEVREAD("soundlatch2", generic_latch_8_device, read)
+ AM_RANGE(0x8800, 0x8800) AM_DEVWRITE("soundlatch1", generic_latch_8_device, write)
AM_RANGE(0x9000, 0x9000) AM_WRITE(rom_bank_select_w)
AM_RANGE(0xa000, 0xffff) AM_DEVICE("vrambank", address_map_bank_device, amap8)
ADDRESS_MAP_END
@@ -362,7 +306,8 @@ ADDRESS_MAP_START(crgolf_state::sound_map)
AM_RANGE(0xc002, 0xc002) AM_WRITENOP
AM_RANGE(0xe000, 0xe000) AM_READWRITE(switch_input_r, switch_input_select_w)
AM_RANGE(0xe001, 0xe001) AM_READWRITE(analog_input_r, unknown_w)
- AM_RANGE(0xe003, 0xe003) AM_READWRITE(main_to_sound_r, sound_to_main_w)
+ AM_RANGE(0xe003, 0xe003) AM_DEVREAD("soundlatch1", generic_latch_8_device, read)
+ AM_RANGE(0xe003, 0xe003) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write)
ADDRESS_MAP_END
@@ -385,8 +330,8 @@ ADDRESS_MAP_START(crgolf_state::mastrglf_io)
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x07) AM_DEVWRITE("mainlatch", ls259_device, write_d0)
// AM_RANGE(0x20, 0x20) AM_WRITE(rom_bank_select_w)
- AM_RANGE(0x40, 0x40) AM_WRITE( main_to_sound_w )
- AM_RANGE(0xa0, 0xa0) AM_READ( sound_to_main_r )
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE("soundlatch1", generic_latch_8_device, write)
+ AM_RANGE(0xa0, 0xa0) AM_DEVREAD("soundlatch2", generic_latch_8_device, read)
ADDRESS_MAP_END
@@ -419,12 +364,12 @@ WRITE8_MEMBER(crgolf_state::unk_sub_0c_w)
ADDRESS_MAP_START(crgolf_state::mastrglf_subio)
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ(main_to_sound_r) AM_WRITENOP
+ AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch1", generic_latch_8_device, read) AM_WRITENOP
AM_RANGE(0x02, 0x02) AM_READ(unk_sub_02_r )
AM_RANGE(0x05, 0x05) AM_READ(unk_sub_05_r )
AM_RANGE(0x06, 0x06) AM_READNOP
AM_RANGE(0x07, 0x07) AM_READ(unk_sub_07_r )
- AM_RANGE(0x08, 0x08) AM_WRITE(sound_to_main_w)
+ AM_RANGE(0x08, 0x08) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write)
AM_RANGE(0x0c, 0x0c) AM_WRITE(unk_sub_0c_w)
AM_RANGE(0x10, 0x11) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
ADDRESS_MAP_END
@@ -533,6 +478,12 @@ MACHINE_CONFIG_START(crgolf_state::crgolf)
MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(crgolf_state, screenb_enable_w))
MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(crgolf_state, screena_enable_w))
+ MCFG_GENERIC_LATCH_8_ADD("soundlatch1")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", INPUT_LINE_NMI))
+
+ MCFG_GENERIC_LATCH_8_ADD("soundlatch2")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("maincpu", INPUT_LINE_NMI))
+
MCFG_DEVICE_ADD("vrambank", ADDRESS_MAP_BANK, 0)
MCFG_DEVICE_PROGRAM_MAP(vrambank_map)
MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE)
diff --git a/src/mame/includes/crgolf.h b/src/mame/includes/crgolf.h
index 74284034e89..04b5a10746b 100644
--- a/src/mame/includes/crgolf.h
+++ b/src/mame/includes/crgolf.h
@@ -39,8 +39,6 @@ public:
/* misc */
uint8_t m_port_select;
- uint8_t m_main_to_sound_data;
- uint8_t m_sound_to_main_data;
uint16_t m_sample_offset;
uint8_t m_sample_count;
@@ -55,10 +53,6 @@ public:
DECLARE_READ8_MEMBER(analog_input_r);
DECLARE_WRITE8_MEMBER(switch_input_select_w);
DECLARE_WRITE8_MEMBER(unknown_w);
- DECLARE_WRITE8_MEMBER(main_to_sound_w);
- DECLARE_READ8_MEMBER(main_to_sound_r);
- DECLARE_WRITE8_MEMBER(sound_to_main_w);
- DECLARE_READ8_MEMBER(sound_to_main_r);
DECLARE_WRITE_LINE_MEMBER(color_select_w);
DECLARE_WRITE_LINE_MEMBER(screen_flip_w);
DECLARE_WRITE_LINE_MEMBER(screen_select_w);
@@ -75,8 +69,6 @@ public:
DECLARE_PALETTE_INIT(crgolf);
DECLARE_PALETTE_INIT(mastrglf);
uint32_t screen_update_crgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_CALLBACK_MEMBER(main_to_sound_callback);
- TIMER_CALLBACK_MEMBER(sound_to_main_callback);
void get_pens( pen_t *pens );
DECLARE_WRITE_LINE_MEMBER(vck_callback);
void crgolfhi(machine_config &config);