summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/audio/seibu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/audio/seibu.cpp')
-rw-r--r--src/mame/audio/seibu.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp
index 9883e9b9a25..c6b4c6b654d 100644
--- a/src/mame/audio/seibu.cpp
+++ b/src/mame/audio/seibu.cpp
@@ -78,6 +78,7 @@ const device_type SEIBU_SOUND = &device_creator<seibu_sound_device>;
seibu_sound_device::seibu_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SEIBU_SOUND, "Seibu Sound System", tag, owner, clock, "seibu_sound", __FILE__),
+ m_sound_rom(*this, ":audiocpu"),
m_main2sub_pending(0),
m_sub2main_pending(0),
m_rst10_irq(0xff),
@@ -98,16 +99,14 @@ void seibu_sound_device::set_encryption(int mode)
void seibu_sound_device::device_start()
{
- int length = memregion(":audiocpu")->bytes();
- UINT8 *rom = memregion(":audiocpu")->base();
- if (length > 0x10000)
+ if (m_sound_rom.length() > 0x10000)
{
- membank(":seibu_bank1")->configure_entries(0, (length - 0x10000) / 0x8000, rom + 0x10000, 0x8000);
+ membank(":seibu_bank1")->configure_entries(0, (m_sound_rom.length() - 0x10000) / 0x8000, &m_sound_rom[0x10000], 0x8000);
/* Denjin Makai definitely needs this at start-up, it never writes to the bankswitch */
membank(":seibu_bank1")->set_entry(0);
} else
- membank(":seibu_bank1")->set_base(rom + 0x8000);
+ membank(":seibu_bank1")->set_base(&m_sound_rom[0x8000]);
switch(m_encryption_mode) {
case 0: break;
@@ -115,13 +114,13 @@ void seibu_sound_device::device_start()
case 1:
get_custom_decrypt();
- memcpy(m_decrypted_opcodes.get(), rom, length);
- apply_decrypt(rom, m_decrypted_opcodes.get(), 0x2000);
+ memcpy(m_decrypted_opcodes.get(), &m_sound_rom[0], m_sound_rom.length());
+ apply_decrypt(&m_sound_rom[0], m_decrypted_opcodes.get(), 0x2000);
break;
case 2:
get_custom_decrypt();
- apply_decrypt(rom, m_decrypted_opcodes.get(), length);
+ apply_decrypt(&m_sound_rom[0], m_decrypted_opcodes.get(), m_sound_rom.length());
break;
}
@@ -514,8 +513,7 @@ seibu_adpcm_device::seibu_adpcm_device(const machine_config &mconfig, const char
m_end(0),
m_nibble(0),
m_playing(0),
- m_rom_tag(nullptr),
- m_base(nullptr)
+ m_base(*this, DEVICE_SELF)
{
}
@@ -527,7 +525,6 @@ void seibu_adpcm_device::device_start()
{
m_playing = 0;
m_stream = machine().sound().stream_alloc(*this, 0, 1, clock());
- m_base = machine().root_device().memregion(m_rom_tag)->base();
m_adpcm.reset();
save_item(NAME(m_current));
@@ -540,14 +537,11 @@ void seibu_adpcm_device::device_start()
// simplify PCB layout/routing rather than intentional protection, but it
// still fits, especially since the Z80s for all these games are truly encrypted.
-void seibu_adpcm_device::decrypt(const char *region)
+void seibu_adpcm_device::decrypt()
{
- UINT8 *ROM = machine().root_device().memregion(region)->base();
- int len = machine().root_device().memregion(region)->bytes();
-
- for (int i = 0; i < len; i++)
+ for (int i = 0; i < m_base.length(); i++)
{
- ROM[i] = BITSWAP8(ROM[i], 7, 5, 3, 1, 6, 4, 2, 0);
+ m_base[i] = BITSWAP8(m_base[i], 7, 5, 3, 1, 6, 4, 2, 0);
}
}