seibu_sound: Interrupt modernization (nw)

This commit is contained in:
AJR 2018-06-30 16:44:09 -04:00
parent 834867ce58
commit 44946d0ba3
17 changed files with 46 additions and 18 deletions

View File

@ -75,9 +75,9 @@ DEFINE_DEVICE_TYPE(SEIBU_SOUND, seibu_sound_device, "seibu_sound", "Seibu Sound
seibu_sound_device::seibu_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SEIBU_SOUND, tag, owner, clock),
m_int_cb(*this),
m_ym_read_cb(*this),
m_ym_write_cb(*this),
m_sound_cpu(*this, finder_base::DUMMY_TAG),
m_sound_rom(*this, finder_base::DUMMY_TAG),
m_rom_bank(*this, finder_base::DUMMY_TAG),
m_main2sub_pending(0),
@ -93,6 +93,7 @@ seibu_sound_device::seibu_sound_device(const machine_config &mconfig, const char
void seibu_sound_device::device_start()
{
m_int_cb.resolve_safe();
m_ym_read_cb.resolve_safe(0);
m_ym_write_cb.resolve_safe();
@ -129,6 +130,11 @@ void seibu_sound_device::device_reset()
}
void seibu_sound_device::update_irq_lines(int param)
{
machine().scheduler().synchronize(timer_expired_delegate(FUNC(seibu_sound_device::update_irq_synced), this), param);
}
TIMER_CALLBACK_MEMBER(seibu_sound_device::update_irq_synced)
{
// note: we use 0xff here for inactive irqline
@ -155,15 +161,12 @@ void seibu_sound_device::update_irq_lines(int param)
break;
}
if (m_sound_cpu.found())
{
if ((m_rst10_irq & m_rst18_irq) == 0xff) /* no IRQs pending */
m_sound_cpu->set_input_line(0, CLEAR_LINE);
else /* IRQ pending */
m_sound_cpu->set_input_line_and_vector(0, ASSERT_LINE, m_rst10_irq & m_rst18_irq);
}
else
return;
m_int_cb((m_rst10_irq & m_rst18_irq) == 0xff ? CLEAR_LINE : ASSERT_LINE);
}
IRQ_CALLBACK_MEMBER(seibu_sound_device::im0_vector_cb)
{
return m_rst10_irq & m_rst18_irq;
}

View File

@ -45,12 +45,9 @@ public:
~seibu_sound_device() {}
// configuration
void set_cpu_tag(const char *tag)
{
m_sound_cpu.set_tag(tag);
m_sound_rom.set_tag(tag);
}
void set_rom_tag(const char *tag) { m_sound_rom.set_tag(tag); }
void set_rombank_tag(const char *tag) { m_rom_bank.set_tag(tag); }
template<class Object> devcb_base &set_int_callback(Object &&object) { return m_int_cb.set_callback(std::forward<Object>(object)); }
template<class Object> devcb_base &set_ym_read_callback(Object &&object) { return m_ym_read_cb.set_callback(std::forward<Object>(object)); }
template<class Object> devcb_base &set_ym_write_callback(Object &&object) { return m_ym_write_cb.set_callback(std::forward<Object>(object)); }
@ -70,7 +67,7 @@ public:
DECLARE_WRITE8_MEMBER( main_data_w );
DECLARE_WRITE8_MEMBER( pending_w );
void update_irq_lines(int param);
IRQ_CALLBACK_MEMBER(im0_vector_cb);
protected:
// device-level overrides
@ -78,12 +75,15 @@ protected:
virtual void device_reset() override;
private:
void update_irq_lines(int param);
TIMER_CALLBACK_MEMBER(update_irq_synced);
// device callbacks
devcb_write_line m_int_cb;
devcb_read8 m_ym_read_cb;
devcb_write8 m_ym_write_cb;
// internal state
required_device<cpu_device> m_sound_cpu;
optional_region_ptr<uint8_t> m_sound_rom;
optional_memory_bank m_rom_bank;
uint8_t m_main2sub[2];
@ -182,7 +182,8 @@ DECLARE_DEVICE_TYPE(SEIBU_ADPCM, seibu_adpcm_device)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
#define MCFG_SEIBU_SOUND_CPU(_audiocputag) \
downcast<seibu_sound_device &>(*device).set_cpu_tag(_audiocputag);
downcast<seibu_sound_device &>(*device).set_int_callback(DEVCB_INPUTLINE(_audiocputag, 0)); \
downcast<seibu_sound_device &>(*device).set_rom_tag(_audiocputag);
#define MCFG_SEIBU_SOUND_ROMBANK(_banktag) \
downcast<seibu_sound_device &>(*device).set_rombank_tag(_banktag);

View File

@ -396,6 +396,7 @@ MACHINE_CONFIG_START(airraid_state::airraid)
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(14'318'181)/4) /* verified on pcb */
MCFG_DEVICE_PROGRAM_MAP(airraid_sound_map)
MCFG_DEVICE_OPCODES_MAP(airraid_sound_decrypted_opcodes_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_QUANTUM_PERFECT_CPU("maincpu")

View File

@ -530,6 +530,7 @@ MACHINE_CONFIG_START(bloodbro_state::bloodbro)
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(7'159'090)/2) /* verified on pcb */
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
// video hardware
@ -577,6 +578,7 @@ MACHINE_CONFIG_START(bloodbro_state::weststry)
MCFG_DEVICE_MODIFY("audiocpu")
MCFG_DEVICE_CLOCK(XTAL(20'000'000)/4) /* 5MHz - verified on PCB */
MCFG_DEVICE_PROGRAM_MAP(weststry_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_REMOVE()
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_weststry)
MCFG_PALETTE_MODIFY("palette")

View File

@ -511,6 +511,7 @@ MACHINE_CONFIG_START(cabal_state::cabal)
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(3'579'545)) /* verified on pcb */
MCFG_DEVICE_PROGRAM_MAP(sound_map)
MCFG_DEVICE_OPCODES_MAP(sound_decrypted_opcodes_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("sei80bu", SEI80BU, 0)
MCFG_DEVICE_ROM("audiocpu")

View File

@ -284,6 +284,7 @@ MACHINE_CONFIG_START(dcon_state::dcon)
MCFG_DEVICE_ADD("audiocpu", Z80, 4000000) /* Perhaps 14318180/4? */
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@ -328,6 +329,7 @@ MACHINE_CONFIG_START(dcon_state::sdgndmps) /* PCB number is PB91008 */
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(14'318'181)/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)

View File

@ -358,6 +358,7 @@ MACHINE_CONFIG_START(deadang_state::deadang)
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(14'318'181)/4)
MCFG_DEVICE_PROGRAM_MAP(sound_map)
MCFG_DEVICE_OPCODES_MAP(sound_decrypted_opcodes_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("sei80bu", SEI80BU, 0)
MCFG_DEVICE_ROM("audiocpu")

View File

@ -325,6 +325,7 @@ MACHINE_CONFIG_START(dynduke_state::dynduke)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(sound_map)
MCFG_DEVICE_OPCODES_MAP(sound_decrypted_opcodes_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("sei80bu", SEI80BU, 0)
MCFG_DEVICE_PROGRAM_MAP(sei80bu_encrypted_full_map)

View File

@ -661,6 +661,7 @@ MACHINE_CONFIG_START(goodejan_state::goodejan)
MCFG_DEVICE_ADD("audiocpu", Z80, GOODEJAN_MHZ1/2)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)

View File

@ -1233,6 +1233,7 @@ MACHINE_CONFIG_START(legionna_state::legionna)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("raiden2cop", RAIDEN2COP, 0)
MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(*this, legionna_state, videowrite_cb_w))
@ -1286,6 +1287,7 @@ MACHINE_CONFIG_START(legionna_state::heatbrl)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("raiden2cop", RAIDEN2COP, 0)
MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(*this, legionna_state, videowrite_cb_w))
@ -1341,6 +1343,7 @@ MACHINE_CONFIG_START(legionna_state::godzilla)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IO_MAP(godzilla_sound_io_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("raiden2cop", RAIDEN2COP, 0)
MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(*this, legionna_state, videowrite_cb_w))
@ -1397,6 +1400,7 @@ MACHINE_CONFIG_START(legionna_state::denjinmk)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("raiden2cop", RAIDEN2COP, 0)
MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(*this, legionna_state, videowrite_cb_w))
@ -1452,6 +1456,7 @@ MACHINE_CONFIG_START(legionna_state::grainbow)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("raiden2cop", RAIDEN2COP, 0)
MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(*this, legionna_state, videowrite_cb_w))
@ -1508,6 +1513,7 @@ MACHINE_CONFIG_START(legionna_state::cupsoc)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("raiden2cop", RAIDEN2COP, 0)
MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(*this, legionna_state, videowrite_cb_w))

View File

@ -4051,6 +4051,7 @@ MACHINE_CONFIG_START(nmk16_state::mustangb)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
/* video hardware */
NMK_HACKY_SCREEN_LOWRES
@ -4237,6 +4238,7 @@ MACHINE_CONFIG_START(nmk16_state::tdragonb) /* bootleg using Raiden sound har
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
/* video hardware */
NMK_HACKY_SCREEN_LOWRES

View File

@ -835,6 +835,7 @@ MACHINE_CONFIG_START(r2dx_v33_state::nzerotea)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(zeroteam_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)

View File

@ -345,6 +345,7 @@ MACHINE_CONFIG_START(raiden_state::raiden)
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(14'318'181)/4) /* verified on pcb */
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_QUANTUM_TIME(attotime::from_hz(12000))

View File

@ -1444,6 +1444,7 @@ MACHINE_CONFIG_START(raiden2_state::raiden2)
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(28'636'363)/8)
MCFG_DEVICE_PROGRAM_MAP(raiden2_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@ -1519,6 +1520,7 @@ MACHINE_CONFIG_START(raiden2_state::zeroteam)
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(28'636'363)/8)
MCFG_DEVICE_PROGRAM_MAP(zeroteam_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)

View File

@ -582,6 +582,7 @@ MACHINE_CONFIG_START(sengokmj_state::sengokmj)
MCFG_DEVICE_ADD("audiocpu", Z80, 14318180/4)
MCFG_DEVICE_PROGRAM_MAP(seibu_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_NVRAM_ADD_0FILL("nvram")

View File

@ -476,6 +476,7 @@ MACHINE_CONFIG_START(shanghai_state::kothello)
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(16'000'000)/4)
MCFG_DEVICE_PROGRAM_MAP(kothello_sound_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_QUANTUM_TIME(attotime::from_hz(12000))

View File

@ -502,6 +502,7 @@ MACHINE_CONFIG_START(toki_state::toki) /* KOYO 20.000MHz near the cpu */
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(14'318'181)/4) // verified on pcb
MCFG_DEVICE_PROGRAM_MAP(toki_audio_map)
MCFG_DEVICE_OPCODES_MAP(toki_audio_opcodes_map)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("seibu_sound", seibu_sound_device, im0_vector_cb)
MCFG_DEVICE_ADD("sei80bu", SEI80BU, 0)
MCFG_DEVICE_ROM("audiocpu")