m92.cpp: Soundlatch modernization (nw)

This commit is contained in:
AJR 2018-02-22 23:43:02 -05:00
parent bde5305b2f
commit c07007300f
2 changed files with 14 additions and 58 deletions

View File

@ -206,6 +206,7 @@ psoldier dip locations still need verification.
#include "cpu/nec/nec.h"
#include "cpu/nec/v25.h"
#include "machine/gen_latch.h"
#include "machine/irem_cpu.h"
#include "sound/ym2151.h"
#include "sound/iremga20.h"
@ -214,11 +215,6 @@ psoldier dip locations still need verification.
/*****************************************************************************/
MACHINE_START_MEMBER(m92_state,m92)
{
save_item(NAME(m_sound_status));
}
MACHINE_RESET_MEMBER(m92_state,m92)
{
m_sprite_buffer_busy = 1;
@ -301,42 +297,6 @@ CUSTOM_INPUT_MEMBER(m92_state::m92_sprite_busy_r)
/*****************************************************************************/
WRITE16_MEMBER(m92_state::m92_soundlatch_w)
{
if (m_soundcpu)
m_soundcpu->set_input_line(NEC_INPUT_LINE_INTP1, ASSERT_LINE);
m_soundlatch->write(space, 0, data & 0xff);
}
READ16_MEMBER(m92_state::m92_sound_status_r)
{
//logerror("%06x: read sound status\n",m_maincpu->pc());
m_upd71059c->ir3_w(0);
return m_sound_status;
}
READ16_MEMBER(m92_state::m92_soundlatch_r)
{
if (m_soundcpu)
m_soundcpu->set_input_line(NEC_INPUT_LINE_INTP1, CLEAR_LINE);
return m_soundlatch->read(space, offset) | 0xff00;
}
WRITE16_MEMBER(m92_state::m92_sound_irq_ack_w)
{
if (m_soundcpu)
m_soundcpu->set_input_line(NEC_INPUT_LINE_INTP1, CLEAR_LINE);
}
WRITE16_MEMBER(m92_state::m92_sound_status_w)
{
COMBINE_DATA(&m_sound_status);
m_upd71059c->ir3_w(1);
}
WRITE16_MEMBER(m92_state::m92_sound_reset_w)
{
if (m_soundcpu)
@ -375,8 +335,8 @@ ADDRESS_MAP_START(m92_state::m92_portmap)
AM_RANGE(0x02, 0x03) AM_READ_PORT("COINS_DSW3")
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
AM_RANGE(0x06, 0x07) AM_READ_PORT("P3_P4")
AM_RANGE(0x08, 0x09) AM_READ(m92_sound_status_r) /* answer from sound CPU */
AM_RANGE(0x00, 0x01) AM_WRITE(m92_soundlatch_w)
AM_RANGE(0x08, 0x09) AM_DEVREAD8("soundlatch2", generic_latch_8_device, read, 0x00ff) // answer from sound CPU
AM_RANGE(0x00, 0x01) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0x02, 0x03) AM_WRITE(m92_coincounter_w)
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8("upd71059c", pic8259_device, read, write, 0x00ff)
AM_RANGE(0x80, 0x87) AM_WRITE(m92_pf1_control_w)
@ -396,7 +356,6 @@ ADDRESS_MAP_START(m92_state::ppan_portmap)
AM_RANGE(0x02, 0x03) AM_READ_PORT("COINS_DSW3")
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
AM_RANGE(0x06, 0x07) AM_READ_PORT("P3_P4")
AM_RANGE(0x08, 0x09) AM_READ(m92_sound_status_r) /* answer from sound CPU */
AM_RANGE(0x10, 0x11) AM_WRITE(oki_bank_w)
AM_RANGE(0x18, 0x19) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
AM_RANGE(0x02, 0x03) AM_WRITE(m92_coincounter_w)
@ -415,8 +374,8 @@ ADDRESS_MAP_START(m92_state::sound_map)
AM_RANGE(0xa0000, 0xa3fff) AM_RAM
AM_RANGE(0xa8000, 0xa803f) AM_DEVREADWRITE8("irem", iremga20_device, irem_ga20_r, irem_ga20_w, 0x00ff)
AM_RANGE(0xa8040, 0xa8043) AM_DEVREADWRITE8("ymsnd", ym2151_device, read, write, 0x00ff)
AM_RANGE(0xa8044, 0xa8045) AM_READWRITE(m92_soundlatch_r, m92_sound_irq_ack_w)
AM_RANGE(0xa8046, 0xa8047) AM_WRITE(m92_sound_status_w)
AM_RANGE(0xa8044, 0xa8045) AM_DEVREADWRITE8("soundlatch", generic_latch_8_device, read, acknowledge_w, 0x00ff)
AM_RANGE(0xa8046, 0xa8047) AM_DEVWRITE8("soundlatch2", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0xffff0, 0xfffff) AM_ROM AM_REGION("soundcpu", 0x1fff0)
ADDRESS_MAP_END
@ -941,7 +900,6 @@ MACHINE_CONFIG_START(m92_state::m92)
MCFG_DEVICE_ADD("upd71059c", PIC8259, 0)
MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0))
MCFG_MACHINE_START_OVERRIDE(m92_state,m92)
MCFG_MACHINE_RESET_OVERRIDE(m92_state,m92)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", m92_state, m92_scanline_interrupt, "screen", 0, 1)
@ -967,6 +925,11 @@ MACHINE_CONFIG_START(m92_state::m92)
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("soundcpu", NEC_INPUT_LINE_INTP1))
MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
MCFG_GENERIC_LATCH_8_ADD("soundlatch2")
MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("upd71059c", pic8259_device, ir3_w))
MCFG_YM2151_ADD("ymsnd", XTAL(14'318'181)/4)
MCFG_YM2151_IRQ_HANDLER(INPUTLINE("soundcpu", NEC_INPUT_LINE_INTP0))
@ -1029,6 +992,7 @@ MACHINE_CONFIG_START(m92_state::ppan)
MCFG_DEVICE_REMOVE("soundcpu")
MCFG_DEVICE_REMOVE("soundlatch")
MCFG_DEVICE_REMOVE("soundlatch2")
MCFG_DEVICE_REMOVE("ymsnd")
MCFG_DEVICE_REMOVE("irem")
@ -1072,6 +1036,8 @@ MACHINE_CONFIG_START(m92_state::nbbatman2bl)
/* 8951 MCU as sound CPU */
/* OKI6295 (AD-65) as sound */
MCFG_DEVICE_MODIFY("soundlatch")
MCFG_GENERIC_LATCH_DATA_PENDING_CB(NOOP)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(m92_state::psoldier)

View File

@ -8,7 +8,6 @@
#include "video/bufsprite.h"
#include "sound/okim6295.h"
#include "machine/gen_latch.h"
#include "machine/pic8259.h"
#include "machine/timer.h"
#include "screen.h"
@ -40,8 +39,7 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_upd71059c(*this, "upd71059c"),
m_soundlatch(*this, "soundlatch")
m_upd71059c(*this, "upd71059c")
{ }
required_device<buffered_spriteram16_device> m_spriteram;
@ -54,10 +52,8 @@ public:
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_device<pic8259_device> m_upd71059c;
optional_device<generic_latch_8_device> m_soundlatch;
emu_timer *m_spritebuffer_timer;
uint16_t m_sound_status;
uint32_t m_raster_irq_position;
uint16_t m_videocontrol;
uint8_t m_sprite_buffer_busy;
@ -71,11 +67,6 @@ public:
DECLARE_WRITE16_MEMBER(m92_eeprom_w);
DECLARE_WRITE16_MEMBER(m92_coincounter_w);
DECLARE_WRITE16_MEMBER(m92_bankswitch_w);
DECLARE_WRITE16_MEMBER(m92_soundlatch_w);
DECLARE_READ16_MEMBER(m92_sound_status_r);
DECLARE_READ16_MEMBER(m92_soundlatch_r);
DECLARE_WRITE16_MEMBER(m92_sound_irq_ack_w);
DECLARE_WRITE16_MEMBER(m92_sound_status_w);
DECLARE_WRITE16_MEMBER(m92_sound_reset_w);
DECLARE_WRITE16_MEMBER(m92_spritecontrol_w);
DECLARE_WRITE16_MEMBER(m92_videocontrol_w);
@ -94,7 +85,6 @@ public:
DECLARE_DRIVER_INIT(m92);
DECLARE_DRIVER_INIT(m92_bank);
TILE_GET_INFO_MEMBER(get_pf_tile_info);
DECLARE_MACHINE_START(m92);
DECLARE_MACHINE_RESET(m92);
DECLARE_VIDEO_START(m92);
DECLARE_VIDEO_START(ppan);