exterm: Soundlatch modernization and save state support (nw)

This commit is contained in:
AJR 2017-09-09 15:36:29 -04:00
parent 0a3880730f
commit f4c7a53ac8
2 changed files with 28 additions and 38 deletions

View File

@ -76,6 +76,15 @@
#include "speaker.h" #include "speaker.h"
void exterm_state::machine_start()
{
save_item(NAME(m_aimpos));
save_item(NAME(m_trackball_old));
save_item(NAME(m_sound_control));
save_item(NAME(m_last));
}
/************************************* /*************************************
* *
* Master/slave communications * Master/slave communications
@ -175,19 +184,11 @@ WRITE16_MEMBER(exterm_state::exterm_output_port_0_w)
} }
TIMER_CALLBACK_MEMBER(exterm_state::sound_delayed_w) WRITE8_MEMBER(exterm_state::sound_latch_w)
{ {
/* data is latched independently for both sound CPUs */ // data is latched independently for both sound CPUs
m_master_sound_latch = m_slave_sound_latch = param; m_soundlatch[0]->write(space, 0, data);
m_audiocpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); m_soundlatch[1]->write(space, 0, data);
m_audioslave->set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
}
WRITE16_MEMBER(exterm_state::sound_latch_w)
{
if (ACCESSING_BITS_0_7)
machine().scheduler().synchronize(timer_expired_delegate(FUNC(exterm_state::sound_delayed_w),this), data & 0xff);
} }
@ -225,22 +226,6 @@ WRITE8_MEMBER(exterm_state::sound_nmi_rate_w)
} }
READ8_MEMBER(exterm_state::sound_master_latch_r)
{
/* read latch and clear interrupt */
m_audiocpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
return m_master_sound_latch;
}
READ8_MEMBER(exterm_state::sound_slave_latch_r)
{
/* read latch and clear interrupt */
m_audioslave->set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
return m_slave_sound_latch;
}
READ8_MEMBER(exterm_state::sound_nmi_to_slave_r) READ8_MEMBER(exterm_state::sound_nmi_to_slave_r)
{ {
/* a read from here triggers an NMI pulse to the slave */ /* a read from here triggers an NMI pulse to the slave */
@ -278,7 +263,7 @@ static ADDRESS_MAP_START( master_map, AS_PROGRAM, 16, exterm_state )
AM_RANGE(0x01440000, 0x0147ffff) AM_MIRROR(0xfc000000) AM_READ(exterm_input_port_1_r) AM_RANGE(0x01440000, 0x0147ffff) AM_MIRROR(0xfc000000) AM_READ(exterm_input_port_1_r)
AM_RANGE(0x01480000, 0x014bffff) AM_MIRROR(0xfc000000) AM_READ_PORT("DSW") AM_RANGE(0x01480000, 0x014bffff) AM_MIRROR(0xfc000000) AM_READ_PORT("DSW")
AM_RANGE(0x01500000, 0x0153ffff) AM_MIRROR(0xfc000000) AM_WRITE(exterm_output_port_0_w) AM_RANGE(0x01500000, 0x0153ffff) AM_MIRROR(0xfc000000) AM_WRITE(exterm_output_port_0_w)
AM_RANGE(0x01580000, 0x015bffff) AM_MIRROR(0xfc000000) AM_WRITE(sound_latch_w) AM_RANGE(0x01580000, 0x015bffff) AM_MIRROR(0xfc000000) AM_WRITE8(sound_latch_w, 0x00ff)
AM_RANGE(0x015c0000, 0x015fffff) AM_MIRROR(0xfc000000) AM_DEVWRITE("watchdog", watchdog_timer_device, reset16_w) AM_RANGE(0x015c0000, 0x015fffff) AM_MIRROR(0xfc000000) AM_DEVWRITE("watchdog", watchdog_timer_device, reset16_w)
AM_RANGE(0x01800000, 0x01807fff) AM_MIRROR(0xfc7f8000) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x01800000, 0x01807fff) AM_MIRROR(0xfc7f8000) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x02800000, 0x02807fff) AM_MIRROR(0xfc7f8000) AM_RAM AM_SHARE("nvram") AM_RANGE(0x02800000, 0x02807fff) AM_MIRROR(0xfc7f8000) AM_RAM AM_SHARE("nvram")
@ -304,7 +289,7 @@ static ADDRESS_MAP_START( sound_master_map, AS_PROGRAM, 8, exterm_state )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM
AM_RANGE(0x4000, 0x5fff) AM_WRITE(ym2151_data_latch_w) AM_RANGE(0x4000, 0x5fff) AM_WRITE(ym2151_data_latch_w)
AM_RANGE(0x6000, 0x67ff) AM_WRITE(sound_nmi_rate_w) AM_RANGE(0x6000, 0x67ff) AM_WRITE(sound_nmi_rate_w)
AM_RANGE(0x6800, 0x6fff) AM_READ(sound_master_latch_r) AM_RANGE(0x6800, 0x6fff) AM_DEVREAD("soundlatch1", generic_latch_8_device, read)
AM_RANGE(0x7000, 0x77ff) AM_READ(sound_nmi_to_slave_r) AM_RANGE(0x7000, 0x77ff) AM_READ(sound_nmi_to_slave_r)
/* AM_RANGE(0x7800, 0x7fff) unknown - to S4-13 */ /* AM_RANGE(0x7800, 0x7fff) unknown - to S4-13 */
AM_RANGE(0xa000, 0xbfff) AM_WRITE(sound_control_w) AM_RANGE(0xa000, 0xbfff) AM_WRITE(sound_control_w)
@ -314,7 +299,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_slave_map, AS_PROGRAM, 8, exterm_state ) static ADDRESS_MAP_START( sound_slave_map, AS_PROGRAM, 8, exterm_state )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x3800) AM_RAM AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x3800) AM_RAM
AM_RANGE(0x4000, 0x5fff) AM_READ(sound_slave_latch_r) AM_RANGE(0x4000, 0x5fff) AM_DEVREAD("soundlatch2", generic_latch_8_device, read)
AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x3ffe) AM_DEVWRITE("dacvol", dac_byte_interface, write) AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x3ffe) AM_DEVWRITE("dacvol", dac_byte_interface, write)
AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x3ffe) AM_DEVWRITE("dac", dac_byte_interface, write) AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x3ffe) AM_DEVWRITE("dac", dac_byte_interface, write)
AM_RANGE(0x8000, 0xffff) AM_ROM AM_RANGE(0x8000, 0xffff) AM_ROM
@ -423,6 +408,12 @@ static MACHINE_CONFIG_START( exterm )
MCFG_CPU_ADD("audioslave", M6502, 2000000) MCFG_CPU_ADD("audioslave", M6502, 2000000)
MCFG_CPU_PROGRAM_MAP(sound_slave_map) MCFG_CPU_PROGRAM_MAP(sound_slave_map)
MCFG_GENERIC_LATCH_8_ADD("soundlatch1")
MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", 0))
MCFG_GENERIC_LATCH_8_ADD("soundlatch2")
MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audioslave", 0))
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) MCFG_QUANTUM_TIME(attotime::from_hz(6000))
MCFG_NVRAM_ADD_0FILL("nvram") MCFG_NVRAM_ADD_0FILL("nvram")
@ -501,4 +492,4 @@ ROM_END
* *
*************************************/ *************************************/
GAME( 1989, exterm, 0, exterm, exterm, exterm_state, 0, ROT0, "Gottlieb / Premier Technology", "Exterminator", 0 ) GAME( 1989, exterm, 0, exterm, exterm, exterm_state, 0, ROT0, "Gottlieb / Premier Technology", "Exterminator", MACHINE_SUPPORTS_SAVE )

View File

@ -7,6 +7,7 @@
*************************************************************************/ *************************************************************************/
#include "cpu/tms32010/tms32010.h" #include "cpu/tms32010/tms32010.h"
#include "cpu/tms34010/tms34010.h" #include "cpu/tms34010/tms34010.h"
#include "machine/gen_latch.h"
class exterm_state : public driver_device class exterm_state : public driver_device
{ {
@ -16,6 +17,7 @@ public:
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_audioslave(*this, "audioslave"), m_audioslave(*this, "audioslave"),
m_soundlatch(*this, "soundlatch%u", 1),
m_slave(*this, "slave"), m_slave(*this, "slave"),
m_master_videoram(*this, "master_videoram"), m_master_videoram(*this, "master_videoram"),
m_slave_videoram(*this, "slave_videoram") { } m_slave_videoram(*this, "slave_videoram") { }
@ -23,6 +25,7 @@ public:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu; required_device<cpu_device> m_audiocpu;
required_device<cpu_device> m_audioslave; required_device<cpu_device> m_audioslave;
required_device_array<generic_latch_8_device, 2> m_soundlatch;
required_device<tms34010_device> m_slave; required_device<tms34010_device> m_slave;
required_shared_ptr<uint16_t> m_master_videoram; required_shared_ptr<uint16_t> m_master_videoram;
@ -30,25 +33,21 @@ public:
uint8_t m_aimpos[2]; uint8_t m_aimpos[2];
uint8_t m_trackball_old[2]; uint8_t m_trackball_old[2];
uint8_t m_master_sound_latch;
uint8_t m_slave_sound_latch;
uint8_t m_sound_control; uint8_t m_sound_control;
uint16_t m_last; uint16_t m_last;
virtual void machine_start() override;
DECLARE_WRITE16_MEMBER(exterm_host_data_w); DECLARE_WRITE16_MEMBER(exterm_host_data_w);
DECLARE_READ16_MEMBER(exterm_host_data_r); DECLARE_READ16_MEMBER(exterm_host_data_r);
DECLARE_READ16_MEMBER(exterm_input_port_0_r); DECLARE_READ16_MEMBER(exterm_input_port_0_r);
DECLARE_READ16_MEMBER(exterm_input_port_1_r); DECLARE_READ16_MEMBER(exterm_input_port_1_r);
DECLARE_WRITE16_MEMBER(exterm_output_port_0_w); DECLARE_WRITE16_MEMBER(exterm_output_port_0_w);
DECLARE_WRITE16_MEMBER(sound_latch_w); DECLARE_WRITE8_MEMBER(sound_latch_w);
DECLARE_WRITE8_MEMBER(sound_nmi_rate_w); DECLARE_WRITE8_MEMBER(sound_nmi_rate_w);
DECLARE_READ8_MEMBER(sound_master_latch_r);
DECLARE_READ8_MEMBER(sound_slave_latch_r);
DECLARE_READ8_MEMBER(sound_nmi_to_slave_r); DECLARE_READ8_MEMBER(sound_nmi_to_slave_r);
DECLARE_WRITE8_MEMBER(sound_control_w); DECLARE_WRITE8_MEMBER(sound_control_w);
DECLARE_WRITE8_MEMBER(ym2151_data_latch_w); DECLARE_WRITE8_MEMBER(ym2151_data_latch_w);
DECLARE_PALETTE_INIT(exterm); DECLARE_PALETTE_INIT(exterm);
TIMER_CALLBACK_MEMBER(sound_delayed_w);
TIMER_DEVICE_CALLBACK_MEMBER(master_sound_nmi_callback); TIMER_DEVICE_CALLBACK_MEMBER(master_sound_nmi_callback);
TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update); TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update);
TMS340X0_TO_SHIFTREG_CB_MEMBER(to_shiftreg_master); TMS340X0_TO_SHIFTREG_CB_MEMBER(to_shiftreg_master);