vgmplay: Add YMZ280B support

This commit is contained in:
AJR 2017-06-27 13:13:33 -04:00
parent 3387442694
commit d50ee393e2

View File

@ -27,6 +27,7 @@
#include "sound/ym2151.h"
#include "sound/ym2413.h"
#include "sound/ymf271.h"
#include "sound/ymz280b.h"
#include "debugger.h"
#include "speaker.h"
@ -63,7 +64,8 @@ public:
A_MULTIPCMB = 0x00013010,
A_POKEYA = 0x00013020,
A_POKEYB = 0x00013030,
A_YMF271 = 0x00013040
A_YMF271 = 0x00013040,
A_YMZ280B = 0x00013050
};
enum io16_t
@ -94,6 +96,7 @@ public:
READ8_MEMBER(segapcm_rom_r);
READ8_MEMBER(ymf271_rom_r);
READ8_MEMBER(ymz280b_rom_r);
READ8_MEMBER(multipcma_rom_r);
READ8_MEMBER(multipcmb_rom_r);
READ8_MEMBER(k053260_rom_r);
@ -175,6 +178,7 @@ private:
required_device<c352_device> m_c352;
required_device<okim6295_device> m_okim6295;
required_device<ymf271_device> m_ymf271;
required_device<ymz280b_device> m_ymz280b;
uint32_t m_multipcma_bank_l;
uint32_t m_multipcma_bank_r;
@ -359,6 +363,12 @@ void vgmplay_device::execute_run()
m_pc += 3;
break;
case 0x5d:
m_io->write_byte(A_YMZ280B+0, m_file->read_byte(m_pc+1));
m_io->write_byte(A_YMZ280B+1, m_file->read_byte(m_pc+2));
m_pc += 3;
break;
case 0x61: {
uint32_t duration = m_file->read_word(m_pc+1);
m_icount -= duration;
@ -501,9 +511,9 @@ void vgmplay_device::execute_run()
case 0xd1:
{
uint8_t offset = (m_file->read_byte(m_pc+1) & 7) << 1;
m_io->write_byte(A_YMF271 + offset, m_file->read_byte(m_pc+2));
m_io->write_byte(A_YMF271 + offset + 1, m_file->read_byte(m_pc+3));
uint8_t offset = m_file->read_byte(m_pc+1);
m_io->write_byte(A_YMF271 + (offset & 7) * 2, m_file->read_byte(m_pc+2));
m_io->write_byte(A_YMF271 + (offset & 7) * 2 + 1, m_file->read_byte(m_pc+3));
m_pc += 4;
break;
}
@ -894,6 +904,11 @@ READ8_MEMBER(vgmplay_device::ymf271_rom_r)
return rom_r(0, 0x85, offset);
}
READ8_MEMBER(vgmplay_device::ymz280b_rom_r)
{
return rom_r(0, 0x86, offset);
}
READ8_MEMBER(vgmplay_device::multipcma_rom_r)
{
return rom_r(0, 0x89, offset);
@ -946,6 +961,7 @@ vgmplay_state::vgmplay_state(const machine_config &mconfig, device_type type, co
, m_c352(*this, "c352")
, m_okim6295(*this, "okim6295")
, m_ymf271(*this, "ymf271")
, m_ymz280b(*this, "ymz280b")
{
}
@ -1077,8 +1093,9 @@ void vgmplay_state::machine_start()
if(version >= 0x151 && r32(0x64)) {
m_ymf271->set_unscaled_clock(r32(0x64));
}
if(version >= 0x151 && r32(0x68))
logerror("Warning: file requests an unsupported YMZ280B\n");
if(version >= 0x151 && r32(0x68)) {
m_ymz280b->set_unscaled_clock(r32(0x68));
}
if(version >= 0x151 && r32(0x6c))
logerror("Warning: file requests an unsupported RF5C164\n");
if(version >= 0x151 && r32(0x70))
@ -1272,6 +1289,7 @@ static ADDRESS_MAP_START( soundchips_map, AS_IO, 8, vgmplay_state )
AM_RANGE(vgmplay_device::A_POKEYA, vgmplay_device::A_POKEYA+0xf) AM_DEVWRITE ("pokeya", pokey_device, write)
AM_RANGE(vgmplay_device::A_POKEYB, vgmplay_device::A_POKEYB+0xf) AM_DEVWRITE ("pokeyb", pokey_device, write)
AM_RANGE(vgmplay_device::A_YMF271, vgmplay_device::A_YMF271+0xf) AM_DEVWRITE ("ymf271", ymf271_device, write)
AM_RANGE(vgmplay_device::A_YMZ280B, vgmplay_device::A_YMZ280B+0x1) AM_DEVWRITE ("ymz280b", ymz280b_device, write)
ADDRESS_MAP_END
static ADDRESS_MAP_START( segapcm_map, AS_0, 8, vgmplay_state )
@ -1426,6 +1444,11 @@ static MACHINE_CONFIG_START( vgmplay )
MCFG_YMF271_EXT_READ_HANDLER(DEVREAD8("vgmplay", vgmplay_device, ymf271_rom_r))
MCFG_SOUND_ROUTE(0, "lspeaker", 1)
MCFG_SOUND_ROUTE(1, "rspeaker", 1)
MCFG_SOUND_ADD("ymz280b", YMZ280B, 16934400)
MCFG_YMZ280B_EXT_READ_HANDLER(DEVREAD8("vgmplay", vgmplay_device, ymz280b_rom_r))
MCFG_SOUND_ROUTE(0, "lspeaker", 1)
MCFG_SOUND_ROUTE(1, "rspeaker", 1)
MACHINE_CONFIG_END
ROM_START( vgmplay )