magmax: Soundlatch modernization & various stuff from schematics (nw)

This commit is contained in:
AJR 2017-07-09 12:22:21 -04:00
parent 2491556b1f
commit f17a768ee4
2 changed files with 17 additions and 20 deletions

View File

@ -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

View File

@ -1,6 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Takahiro Nogi
#include "screen.h"
#include "machine/gen_latch.h"
class magmax_state : public driver_device
{
@ -14,6 +15,7 @@ public:
m_scroll_y(*this, "scroll_y"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_soundlatch(*this, "soundlatch"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette") { }
@ -32,8 +34,7 @@ public:
int m_flipscreen;
std::unique_ptr<uint32_t[]> m_prom_tab;
bitmap_ind16 m_bitmap;
DECLARE_WRITE16_MEMBER(magmax_sound_w);
DECLARE_READ8_MEMBER(magmax_sound_irq_ack);
DECLARE_WRITE16_MEMBER(cpu_irq_ack_w);
DECLARE_READ8_MEMBER(magmax_sound_r);
DECLARE_WRITE16_MEMBER(magmax_vreg_w);
DECLARE_WRITE8_MEMBER(ay8910_portB_0_w);
@ -46,6 +47,7 @@ public:
TIMER_CALLBACK_MEMBER(scanline_callback);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<generic_latch_8_device> m_soundlatch;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;