mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
firetrap: Sound-related modernization (nw)
- Use callback for soundlatch interrupt - Use modern MSM5205 callback and LS157 selector, and eliminate an instance of HOLD_LINE - Clean up some names - Add placeholder 8751 device
This commit is contained in:
parent
0d1e514f64
commit
6d6ed7c989
@ -166,6 +166,11 @@ Stephh's notes (based on the games Z80 code and some tests) :
|
||||
- Bugs in test mode :
|
||||
* when lives are set to "2", it displays "1".
|
||||
|
||||
Many interrupt-related gates, flip-flops and connections are crossed out
|
||||
on the schematics. Coins were once supposed to trigger IRQs on the main
|
||||
CPU, and the YM3526 was intended to drive the 6502 IRQ line directly, with
|
||||
the MSM5205-derived interrupt assigned to the NMI line instead.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
@ -173,6 +178,7 @@ Stephh's notes (based on the games Z80 code and some tests) :
|
||||
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "cpu/m6502/m6502.h"
|
||||
#include "cpu/mcs51/mcs51.h"
|
||||
#include "sound/3526intf.h"
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
@ -305,36 +311,35 @@ WRITE8_MEMBER(firetrap_state::firetrap_8751_w)
|
||||
m_i8751_current_command=data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(firetrap_state::firetrap_sound_command_w)
|
||||
WRITE8_MEMBER(firetrap_state::sound_flip_flop_w)
|
||||
{
|
||||
m_soundlatch->write(space, offset, data);
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
|
||||
m_msm->reset_w(!BIT(data, 0));
|
||||
m_sound_irq_enable = BIT(data, 1);
|
||||
if (!m_sound_irq_enable)
|
||||
m_audiocpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(firetrap_state::firetrap_sound_2400_w)
|
||||
{
|
||||
m_msm->reset_w(~data & 0x01);
|
||||
m_sound_irq_enable = data & 0x02;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(firetrap_state::firetrap_sound_bankselect_w)
|
||||
WRITE8_MEMBER(firetrap_state::sound_bankselect_w)
|
||||
{
|
||||
membank("bank2")->set_entry(data & 0x01);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(firetrap_state::firetrap_adpcm_int)
|
||||
{
|
||||
m_msm->data_w(m_msm5205next >> 4);
|
||||
m_msm5205next <<= 4;
|
||||
if (state)
|
||||
{
|
||||
m_adpcm_toggle ^= 1;
|
||||
m_adpcm_select->select_w(m_adpcm_toggle);
|
||||
|
||||
m_adpcm_toggle ^= 1;
|
||||
if (m_sound_irq_enable && m_adpcm_toggle)
|
||||
m_audiocpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE);
|
||||
if (m_sound_irq_enable && m_adpcm_toggle)
|
||||
m_audiocpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(firetrap_state::firetrap_adpcm_data_w)
|
||||
WRITE8_MEMBER(firetrap_state::adpcm_data_w)
|
||||
{
|
||||
m_msm5205next = data;
|
||||
m_audiocpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
|
||||
m_adpcm_select->ba_w(data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(firetrap_state::flip_screen_w)
|
||||
@ -352,7 +357,7 @@ static ADDRESS_MAP_START( firetrap_map, AS_PROGRAM, 8, firetrap_state )
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(firetrap_fgvideoram_w) AM_SHARE("fgvideoram")
|
||||
AM_RANGE(0xe800, 0xe97f) AM_RAM AM_SHARE("spriteram")
|
||||
AM_RANGE(0xf000, 0xf000) AM_WRITENOP /* IRQ acknowledge */
|
||||
AM_RANGE(0xf001, 0xf001) AM_WRITE(firetrap_sound_command_w)
|
||||
AM_RANGE(0xf001, 0xf001) AM_DEVWRITE("soundlatch", generic_latch_8_device, write)
|
||||
AM_RANGE(0xf002, 0xf002) AM_WRITE(firetrap_bankselect_w)
|
||||
AM_RANGE(0xf003, 0xf003) AM_WRITE(flip_screen_w)
|
||||
AM_RANGE(0xf004, 0xf004) AM_WRITE(firetrap_nmi_disable_w)
|
||||
@ -378,7 +383,7 @@ static ADDRESS_MAP_START( firetrap_bootleg_map, AS_PROGRAM, 8, firetrap_state )
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(firetrap_fgvideoram_w) AM_SHARE("fgvideoram")
|
||||
AM_RANGE(0xe800, 0xe97f) AM_RAM AM_SHARE("spriteram")
|
||||
AM_RANGE(0xf000, 0xf000) AM_WRITENOP /* IRQ acknowledge */
|
||||
AM_RANGE(0xf001, 0xf001) AM_WRITE(firetrap_sound_command_w)
|
||||
AM_RANGE(0xf001, 0xf001) AM_DEVWRITE("soundlatch", generic_latch_8_device, write)
|
||||
AM_RANGE(0xf002, 0xf002) AM_WRITE(firetrap_bankselect_w)
|
||||
AM_RANGE(0xf003, 0xf003) AM_WRITE(flip_screen_w)
|
||||
AM_RANGE(0xf004, 0xf004) AM_WRITE(firetrap_nmi_disable_w)
|
||||
@ -399,9 +404,9 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, firetrap_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM
|
||||
AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ymsnd", ym3526_device, write)
|
||||
AM_RANGE(0x2000, 0x2000) AM_WRITE(firetrap_adpcm_data_w) /* ADPCM data for the MSM5205 chip */
|
||||
AM_RANGE(0x2400, 0x2400) AM_WRITE(firetrap_sound_2400_w)
|
||||
AM_RANGE(0x2800, 0x2800) AM_WRITE(firetrap_sound_bankselect_w)
|
||||
AM_RANGE(0x2000, 0x2000) AM_WRITE(adpcm_data_w)
|
||||
AM_RANGE(0x2400, 0x2400) AM_WRITE(sound_flip_flop_w)
|
||||
AM_RANGE(0x2800, 0x2800) AM_WRITE(sound_bankselect_w)
|
||||
AM_RANGE(0x3400, 0x3400) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
|
||||
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2")
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
@ -595,7 +600,6 @@ void firetrap_state::machine_start()
|
||||
save_item(NAME(m_nmi_enable));
|
||||
save_item(NAME(m_i8751_return));
|
||||
save_item(NAME(m_i8751_init_ptr));
|
||||
save_item(NAME(m_msm5205next));
|
||||
save_item(NAME(m_adpcm_toggle));
|
||||
save_item(NAME(m_coin_command_pending));
|
||||
save_item(NAME(m_scroll1_x));
|
||||
@ -621,7 +625,6 @@ void firetrap_state::machine_reset()
|
||||
m_nmi_enable = 0;
|
||||
m_i8751_return = 0;
|
||||
m_i8751_init_ptr = 0;
|
||||
m_msm5205next = 0xff;
|
||||
m_adpcm_toggle = 0;
|
||||
m_coin_command_pending = 0;
|
||||
}
|
||||
@ -638,6 +641,8 @@ static MACHINE_CONFIG_START( firetrap )
|
||||
/* IRQs are caused by the ADPCM chip */
|
||||
/* NMIs are caused by the main CPU */
|
||||
|
||||
MCFG_CPU_ADD("mcu", I8751, XTAL_8MHz)
|
||||
MCFG_DEVICE_DISABLE()
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
@ -656,12 +661,16 @@ static MACHINE_CONFIG_START( firetrap )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
|
||||
MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", INPUT_LINE_NMI))
|
||||
|
||||
MCFG_SOUND_ADD("ymsnd", YM3526, FIRETRAP_XTAL/4) // 3 MHz
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_DEVICE_ADD("adpcm_select", LS157, 0)
|
||||
MCFG_74157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
|
||||
|
||||
MCFG_SOUND_ADD("msm", MSM5205, FIRETRAP_XTAL/32) // 375 kHz
|
||||
MCFG_MSM5205_VCLK_CB(WRITELINE(firetrap_state, firetrap_adpcm_int)) /* interrupt function */
|
||||
MCFG_MSM5205_VCK_CALLBACK(WRITELINE(firetrap_state, firetrap_adpcm_int))
|
||||
MCFG_MSM5205_PRESCALER_SELECTOR(S48_4B) /* 7.8125kHz */
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
|
||||
MACHINE_CONFIG_END
|
||||
@ -678,7 +687,6 @@ static MACHINE_CONFIG_START( firetrapbl )
|
||||
/* IRQs are caused by the ADPCM chip */
|
||||
/* NMIs are caused by the main CPU */
|
||||
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(57.4034)
|
||||
@ -696,12 +704,16 @@ static MACHINE_CONFIG_START( firetrapbl )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
|
||||
MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", INPUT_LINE_NMI))
|
||||
|
||||
MCFG_SOUND_ADD("ymsnd", YM3526, FIRETRAP_XTAL/4) // 3 MHz
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_DEVICE_ADD("adpcm_select", LS157, 0)
|
||||
MCFG_74157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
|
||||
|
||||
MCFG_SOUND_ADD("msm", MSM5205, FIRETRAP_XTAL/32) // 375 kHz
|
||||
MCFG_MSM5205_VCLK_CB(WRITELINE(firetrap_state, firetrap_adpcm_int)) /* interrupt function */
|
||||
MCFG_MSM5205_VCK_CALLBACK(WRITELINE(firetrap_state, firetrap_adpcm_int))
|
||||
MCFG_MSM5205_PRESCALER_SELECTOR(S48_4B) /* 7.8125kHz */
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "machine/74157.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "sound/msm5205.h"
|
||||
|
||||
@ -21,6 +22,7 @@ public:
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_msm(*this, "msm"),
|
||||
m_adpcm_select(*this, "adpcm_select"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_soundlatch(*this, "soundlatch") { }
|
||||
@ -46,7 +48,6 @@ public:
|
||||
int m_i8751_return;
|
||||
int m_i8751_current_command;
|
||||
int m_i8751_init_ptr;
|
||||
int m_msm5205next;
|
||||
int m_adpcm_toggle;
|
||||
int m_coin_command_pending;
|
||||
|
||||
@ -54,6 +55,7 @@ public:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<msm5205_device> m_msm;
|
||||
required_device<ls157_device> m_adpcm_select;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<generic_latch_8_device> m_soundlatch;
|
||||
@ -63,10 +65,10 @@ public:
|
||||
DECLARE_READ8_MEMBER(firetrap_8751_bootleg_r);
|
||||
DECLARE_READ8_MEMBER(firetrap_8751_r);
|
||||
DECLARE_WRITE8_MEMBER(firetrap_8751_w);
|
||||
DECLARE_WRITE8_MEMBER(firetrap_sound_command_w);
|
||||
DECLARE_WRITE8_MEMBER(firetrap_sound_2400_w);
|
||||
DECLARE_WRITE8_MEMBER(firetrap_sound_bankselect_w);
|
||||
DECLARE_WRITE8_MEMBER(firetrap_adpcm_data_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_command_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_flip_flop_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_bankselect_w);
|
||||
DECLARE_WRITE8_MEMBER(adpcm_data_w);
|
||||
DECLARE_WRITE8_MEMBER(flip_screen_w);
|
||||
DECLARE_WRITE8_MEMBER(firetrap_fgvideoram_w);
|
||||
DECLARE_WRITE8_MEMBER(firetrap_bg1videoram_w);
|
||||
|
Loading…
Reference in New Issue
Block a user