summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-09-05 09:35:46 -0400
committer AJR <ajrhacker@users.noreply.github.com>2017-09-05 09:35:46 -0400
commit7b78594df3fa66387dbec88d98d308dc5dac1f04 (patch)
tree760cc08bf9bd3c6fc50c3a538127f211044d5dc8
parente13a1461d5b99d903671d79a94de5b728a32c079 (diff)
gaelco3d: Soundlatch modernization (nw)
-rw-r--r--src/mame/drivers/gaelco3d.cpp40
-rw-r--r--src/mame/includes/gaelco3d.h8
2 files changed, 12 insertions, 36 deletions
diff --git a/src/mame/drivers/gaelco3d.cpp b/src/mame/drivers/gaelco3d.cpp
index 309fdc5e489..2d8c43da0ad 100644
--- a/src/mame/drivers/gaelco3d.cpp
+++ b/src/mame/drivers/gaelco3d.cpp
@@ -176,7 +176,6 @@ WRITE_LINE_MEMBER(gaelco3d_state::ser_irq)
void gaelco3d_state::machine_start()
{
/* Save state support */
- save_item(NAME(m_sound_data));
save_item(NAME(m_sound_status));
save_item(NAME(m_analog_ports));
save_item(NAME(m_framenum));
@@ -228,6 +227,7 @@ void gaelco3d_state::machine_reset()
{
MACHINE_RESET_CALL_MEMBER( common );
m_tms_offset_xor = 0;
+ m_soundlatch->acknowledge_w(machine().dummy_space(), 0, 0);
}
@@ -294,33 +294,6 @@ READ16_MEMBER(gaelco3d_state::eeprom_data_r)
*
*************************************/
-TIMER_CALLBACK_MEMBER(gaelco3d_state::delayed_sound_w)
-{
- if (LOG)
- logerror("delayed_sound_w(%02X)\n", param);
- m_sound_data = param;
- m_adsp->set_input_line(ADSP2115_IRQ2, ASSERT_LINE);
-}
-
-
-WRITE16_MEMBER(gaelco3d_state::sound_data_w)
-{
- if (LOG)
- logerror("%06X:sound_data_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
- if (ACCESSING_BITS_0_7)
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(gaelco3d_state::delayed_sound_w),this), data & 0xff);
-}
-
-
-READ16_MEMBER(gaelco3d_state::sound_data_r)
-{
- if (LOG)
- logerror("sound_data_r(%02X)\n", m_sound_data);
- m_adsp->set_input_line(ADSP2115_IRQ2, CLEAR_LINE);
- return m_sound_data;
-}
-
-
READ16_MEMBER(gaelco3d_state::sound_status_r)
{
if (LOG)
@@ -334,7 +307,7 @@ READ16_MEMBER(gaelco3d_state::sound_status_r)
WRITE16_MEMBER(gaelco3d_state::sound_status_w)
{
if (LOG)
- logerror("sound_status_w(%02X)\n", m_sound_data);
+ logerror("sound_status_w(%02X)\n", m_sound_status);
m_sound_status = data;
}
@@ -704,7 +677,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, gaelco3d_state )
AM_RANGE(0x51001c, 0x51001d) AM_READ_PORT("IN1")
AM_RANGE(0x51002c, 0x51002d) AM_READ_PORT("IN2")
AM_RANGE(0x51003c, 0x51003d) AM_READ_PORT("IN3")
- AM_RANGE(0x510040, 0x510041) AM_WRITE(sound_data_w)
+ AM_RANGE(0x510040, 0x510041) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0x510042, 0x510043) AM_READ(sound_status_r)
AM_RANGE(0x510100, 0x510101) AM_READWRITE(eeprom_data_r, irq_ack_w)
AM_RANGE(0x510102, 0x510103) AM_DEVREAD8("serial", gaelco_serial_device, data_r, 0x00ff)
@@ -724,7 +697,7 @@ static ADDRESS_MAP_START( main020_map, AS_PROGRAM, 32, gaelco3d_state )
AM_RANGE(0x51002c, 0x51002f) AM_READ_PORT("IN2")
AM_RANGE(0x51003c, 0x51003f) AM_READ_PORT("IN3")
AM_RANGE(0x510040, 0x510043) AM_READ16(sound_status_r, 0x0000ffff)
- AM_RANGE(0x510040, 0x510043) AM_WRITE16(sound_data_w, 0xffff0000)
+ AM_RANGE(0x510040, 0x510043) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff0000)
AM_RANGE(0x510100, 0x510103) AM_READWRITE16(eeprom_data_r, irq_ack_w, 0xffff0000)
AM_RANGE(0x510100, 0x510103) AM_DEVREAD8("serial", gaelco_serial_device, data_r, 0x000000ff)
AM_RANGE(0x510100, 0x510103) AM_SELECT(0x000038) AM_DEVWRITE8_MOD("mainlatch", ls259_device, write_d0, rshift<1>, 0x000000ff)
@@ -749,7 +722,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( adsp_data_map, AS_DATA, 16, gaelco3d_state )
AM_RANGE(0x0000, 0x0001) AM_WRITE(adsp_rombank_w)
AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1")
- AM_RANGE(0x2000, 0x2000) AM_READWRITE(sound_data_r, sound_status_w)
+ AM_RANGE(0x2000, 0x2000) AM_DEVREAD8("soundlatch", generic_latch_8_device, read, 0x00ff) AM_WRITE(sound_status_w)
AM_RANGE(0x3800, 0x39ff) AM_RAM AM_SHARE("adsp_fastram") /* 512 words internal RAM */
AM_RANGE(0x3fe0, 0x3fff) AM_WRITE(adsp_control_w) AM_SHARE("adsp_regs")
ADDRESS_MAP_END
@@ -979,6 +952,9 @@ static MACHINE_CONFIG_START( gaelco3d )
MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(gaelco3d_state, analog_port_latch_w))
MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(DEVWRITELINE("serial", gaelco_serial_device, unknown_w))
+ MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("adsp", ADSP2115_IRQ2))
+
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
diff --git a/src/mame/includes/gaelco3d.h b/src/mame/includes/gaelco3d.h
index b0118a7f886..a214f470444 100644
--- a/src/mame/includes/gaelco3d.h
+++ b/src/mame/includes/gaelco3d.h
@@ -12,6 +12,7 @@
#include "video/poly.h"
#include "machine/eepromser.h"
#include "machine/gaelco3d.h"
+#include "machine/gen_latch.h"
#include "cpu/adsp2100/adsp2100.h"
#include "screen.h"
@@ -69,6 +70,7 @@ public:
m_tms(*this, "tms"),
m_serial(*this, "serial"),
m_screen(*this, "screen"),
+ m_soundlatch(*this, "soundlatch"),
m_paletteram16(*this, "paletteram"),
m_paletteram32(*this, "paletteram"),
m_analog(*this, {"ANALOG0", "ANALOG1", "ANALOG2", "ANALOG3"})
@@ -85,11 +87,12 @@ public:
required_device<cpu_device> m_tms;
required_device<gaelco_serial_device> m_serial;
required_device<screen_device> m_screen;
+ required_device<generic_latch_8_device> m_soundlatch;
+
optional_shared_ptr<uint16_t> m_paletteram16;
optional_shared_ptr<uint32_t> m_paletteram32;
optional_ioport_array<4> m_analog;
- uint16_t m_sound_data;
uint8_t m_sound_status;
offs_t m_tms_offset_xor;
uint8_t m_analog_ports[4];
@@ -111,8 +114,6 @@ public:
int m_video_changed;
std::unique_ptr<gaelco3d_renderer> m_poly;
DECLARE_WRITE16_MEMBER(irq_ack_w);
- DECLARE_WRITE16_MEMBER(sound_data_w);
- DECLARE_READ16_MEMBER(sound_data_r);
DECLARE_READ16_MEMBER(sound_status_r);
DECLARE_WRITE16_MEMBER(sound_status_w);
DECLARE_WRITE_LINE_MEMBER(analog_port_clock_w);
@@ -143,7 +144,6 @@ public:
DECLARE_MACHINE_RESET(common);
uint32_t screen_update_gaelco3d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_gen);
- TIMER_CALLBACK_MEMBER(delayed_sound_w);
TIMER_DEVICE_CALLBACK_MEMBER(adsp_autobuffer_irq);
void gaelco3d_render(screen_device &screen);
DECLARE_WRITE32_MEMBER(adsp_tx_callback);