mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
inder_sb.cpp: Bank the ROM in a somewhat less hacky way (nw)
This improves sound in Hammer Boy (whose sound program indeed reads different interrupt vectors, though from a table at the same addresses).
This commit is contained in:
parent
ac3f9079d2
commit
2d56e8c98e
@ -18,16 +18,20 @@ inder_sb_device::inder_sb_device(const machine_config &mconfig, const char *tag,
|
||||
, device_mixer_interface(mconfig, *this, 2)
|
||||
, m_audiocpu(*this, "audiocpu")
|
||||
, m_ctc(*this, "ctc")
|
||||
, m_audiocpu_rom(*this, "audiocpu")
|
||||
, m_sounddata_bank(*this, "snddata")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
// hacks for test purposes, these are installed over the program rom so we know when irqs are actually taken
|
||||
READ8_MEMBER(inder_sb_device::megaphx_02cc_hack_r) { /*logerror("%04x audicpu IRQ hack 0x02cc\n", machine().device("audiocpu")->safe_pc());*/ int bank = m_soundbank[0] & 7; membank("snddata")->set_entry(bank); return memregion("audiocpu")->base()[0x02cc]; }
|
||||
READ8_MEMBER(inder_sb_device::megaphx_02e6_hack_r) { /*logerror("%04x audicpu IRQ hack 0x02e6\n", machine().device("audiocpu")->safe_pc());*/ int bank = m_soundbank[1] & 7; membank("snddata")->set_entry(bank); return memregion("audiocpu")->base()[0x02e6]; }
|
||||
READ8_MEMBER(inder_sb_device::megaphx_0309_hack_r) { /*logerror("%04x audicpu IRQ hack 0x0309\n", machine().device("audiocpu")->safe_pc());*/ int bank = m_soundbank[2] & 7; membank("snddata")->set_entry(bank); return memregion("audiocpu")->base()[0x0309]; }
|
||||
READ8_MEMBER(inder_sb_device::megaphx_0323_hack_r) { /*logerror("%04x audicpu IRQ hack 0x0323\n", machine().device("audiocpu")->safe_pc());*/ int bank = m_soundbank[3] & 7; membank("snddata")->set_entry(bank); return memregion("audiocpu")->base()[0x0323]; }
|
||||
READ8_MEMBER(inder_sb_device::vec_bankswitch_r)
|
||||
{
|
||||
if (!machine().side_effect_disabled())
|
||||
m_sounddata_bank->set_entry(m_soundbank[(offset & 6) >> 1] & 7);
|
||||
return m_audiocpu_rom[offset + 0x0020];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,15 +56,6 @@ WRITE16_MEMBER(inder_sb_device::megaphx_0x050000_w)
|
||||
|
||||
}
|
||||
|
||||
void inder_sb_device::install_sound_hacks(void)
|
||||
{
|
||||
address_space &space = m_audiocpu->space(AS_PROGRAM);
|
||||
space.install_read_handler(0x02cc, 0x02cc, read8_delegate(FUNC(inder_sb_device::megaphx_02cc_hack_r), this));
|
||||
space.install_read_handler(0x02e6, 0x02e6, read8_delegate(FUNC(inder_sb_device::megaphx_02e6_hack_r), this));
|
||||
space.install_read_handler(0x0309, 0x0309, read8_delegate(FUNC(inder_sb_device::megaphx_0309_hack_r), this));
|
||||
space.install_read_handler(0x0323, 0x0323, read8_delegate(FUNC(inder_sb_device::megaphx_0323_hack_r), this));
|
||||
}
|
||||
|
||||
void inder_sb_device::update_sound_irqs(void)
|
||||
{
|
||||
if (m_soundirq) m_audiocpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
|
||||
@ -124,6 +119,7 @@ static const z80_daisy_config daisy_chain[] =
|
||||
|
||||
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, inder_sb_device )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_ROM
|
||||
AM_RANGE(0x0020, 0x0020) AM_SELECT(0x0006) AM_READ(vec_bankswitch_r)
|
||||
AM_RANGE(0x4000, 0x7fff) AM_RAM
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROMBANK("snddata")
|
||||
ADDRESS_MAP_END
|
||||
@ -239,10 +235,8 @@ MACHINE_CONFIG_END
|
||||
|
||||
void inder_sb_device::device_start()
|
||||
{
|
||||
membank("snddata")->configure_entries(0, 8, memregion("user2")->base(), 0x8000);
|
||||
membank("snddata")->set_entry(0);
|
||||
|
||||
install_sound_hacks();
|
||||
m_sounddata_bank->configure_entries(0, 8, memregion("user2")->base(), 0x8000);
|
||||
m_sounddata_bank->set_entry(0);
|
||||
}
|
||||
|
||||
void inder_sb_device::device_reset()
|
||||
|
@ -27,9 +27,6 @@ public:
|
||||
// construction/destruction
|
||||
inder_sb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<z80ctc_device> m_ctc;
|
||||
|
||||
DECLARE_READ8_MEMBER(megaphx_sound_sent_r);
|
||||
DECLARE_READ8_MEMBER(megaphx_sound_cmd_r);
|
||||
DECLARE_WRITE8_MEMBER(megaphx_sound_to_68k_w);
|
||||
@ -39,16 +36,12 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(dac2_rombank_write);
|
||||
DECLARE_WRITE8_MEMBER(dac3_rombank_write);
|
||||
|
||||
DECLARE_READ8_MEMBER(megaphx_02cc_hack_r);
|
||||
DECLARE_READ8_MEMBER(megaphx_02e6_hack_r);
|
||||
DECLARE_READ8_MEMBER(megaphx_0309_hack_r);
|
||||
DECLARE_READ8_MEMBER(megaphx_0323_hack_r);
|
||||
DECLARE_READ8_MEMBER(vec_bankswitch_r);
|
||||
|
||||
|
||||
DECLARE_READ16_MEMBER(megaphx_0x050002_r);
|
||||
DECLARE_WRITE16_MEMBER(megaphx_0x050000_w);
|
||||
|
||||
void install_sound_hacks(void);
|
||||
void update_sound_irqs(void);
|
||||
|
||||
protected:
|
||||
@ -57,6 +50,11 @@ protected:
|
||||
virtual void device_reset() override;
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<z80ctc_device> m_ctc;
|
||||
required_region_ptr<uint8_t> m_audiocpu_rom;
|
||||
required_memory_bank m_sounddata_bank;
|
||||
|
||||
uint8_t m_soundbank[4];
|
||||
|
||||
int m_soundsent;
|
||||
|
Loading…
Reference in New Issue
Block a user