summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/magmax.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/magmax.cpp')
-rw-r--r--src/mame/drivers/magmax.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/mame/drivers/magmax.cpp b/src/mame/drivers/magmax.cpp
index 56952be50bb..2b5692d881f 100644
--- a/src/mame/drivers/magmax.cpp
+++ b/src/mame/drivers/magmax.cpp
@@ -34,24 +34,14 @@ Stephh's notes (based on the game M68000 code and some tests) :
#include "speaker.h"
-WRITE16_MEMBER(magmax_state::magmax_sound_w)
+WRITE16_MEMBER(magmax_state::cpu_irq_ack_w)
{
- if (ACCESSING_BITS_0_7)
- {
- m_sound_latch = (data & 0xff) << 1;
- m_audiocpu->set_input_line(0, ASSERT_LINE);
- }
-}
-
-READ8_MEMBER(magmax_state::magmax_sound_irq_ack)
-{
- m_audiocpu->set_input_line(0, CLEAR_LINE);
- return 0;
+ m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
}
READ8_MEMBER(magmax_state::magmax_sound_r)
{
- return (m_sound_latch | m_LS74_q);
+ return (m_soundlatch->read(space, 0) << 1) | m_LS74_q;
}
WRITE8_MEMBER(magmax_state::ay8910_portB_0_w)
@@ -212,14 +202,15 @@ static ADDRESS_MAP_START( magmax_map, AS_PROGRAM, 16, magmax_state )
AM_RANGE(0x030010, 0x030011) AM_WRITE(magmax_vreg_w) AM_SHARE("vreg")
AM_RANGE(0x030012, 0x030013) AM_WRITEONLY AM_SHARE("scroll_x")
AM_RANGE(0x030014, 0x030015) AM_WRITEONLY AM_SHARE("scroll_y")
- AM_RANGE(0x03001c, 0x03001d) AM_WRITE(magmax_sound_w)
- AM_RANGE(0x03001e, 0x03001f) AM_WRITENOP /* IRQ ack */
+ AM_RANGE(0x03001c, 0x03001d) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
+ AM_RANGE(0x03001e, 0x03001f) AM_WRITE(cpu_irq_ack_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( magmax_sound_map, AS_PROGRAM, 8, magmax_state )
+ ADDRESS_MAP_GLOBAL_MASK(0x7fff) // A15 not connected
AM_RANGE(0x0000, 0x3fff) AM_ROM
- AM_RANGE(0x4000, 0x4000) AM_READ(magmax_sound_irq_ack)
- AM_RANGE(0x6000, 0x67ff) AM_RAM
+ AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x1fff) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, acknowledge_r, acknowledge_w)
+ AM_RANGE(0x6000, 0x67ff) AM_MIRROR(0x1800) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( magmax_sound_io_map, AS_IO, 8, magmax_state )
@@ -339,7 +330,7 @@ static MACHINE_CONFIG_START( magmax )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz/2) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(magmax_map)
- MCFG_CPU_VBLANK_INT_DRIVER("screen", magmax_state, irq1_line_hold)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", magmax_state, irq1_line_assert)
MCFG_CPU_ADD("audiocpu", Z80,XTAL_20MHz/8) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(magmax_sound_map)
@@ -374,6 +365,10 @@ static MACHINE_CONFIG_START( magmax )
MCFG_SOUND_ADD("ay3", AY8910, XTAL_20MHz/16) /* verified on pcb */
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
+
+ MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", 0))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
MACHINE_CONFIG_END