From ec446e6b46dcfe009e754fac76dcbe44f100cd9f Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 26 Jun 2017 23:27:23 -0400 Subject: vgmplay: Add YMF271 support --- src/mame/drivers/vgmplay.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index 1401cda9294..a70cad58327 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -26,6 +26,7 @@ #include "sound/sn76496.h" #include "sound/ym2151.h" #include "sound/ym2413.h" +#include "sound/ymf271.h" #include "debugger.h" #include "speaker.h" @@ -62,6 +63,7 @@ public: A_MULTIPCMB = 0x00013010, A_POKEYA = 0x00013020, A_POKEYB = 0x00013030, + A_YMF271 = 0x00013040 }; enum io16_t @@ -91,6 +93,7 @@ public: virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; READ8_MEMBER(segapcm_rom_r); + READ8_MEMBER(ymf271_rom_r); READ8_MEMBER(multipcma_rom_r); READ8_MEMBER(multipcmb_rom_r); READ8_MEMBER(k053260_rom_r); @@ -171,6 +174,7 @@ private: required_device m_pokeyb; required_device m_c352; required_device m_okim6295; + required_device m_ymf271; uint32_t m_multipcma_bank_l; uint32_t m_multipcma_bank_r; @@ -495,6 +499,15 @@ void vgmplay_device::execute_run() break; } + 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)); + m_pc += 4; + break; + } + case 0xe0: m_ym2612_stream_offset = m_file->read_dword(m_pc+1); m_pc += 5; @@ -876,6 +889,11 @@ READ8_MEMBER(vgmplay_device::segapcm_rom_r) return rom_r(0, 0x80, offset); } +READ8_MEMBER(vgmplay_device::ymf271_rom_r) +{ + return rom_r(0, 0x85, offset); +} + READ8_MEMBER(vgmplay_device::multipcma_rom_r) { return rom_r(0, 0x89, offset); @@ -927,6 +945,7 @@ vgmplay_state::vgmplay_state(const machine_config &mconfig, device_type type, co , m_pokeyb(*this, "pokeyb") , m_c352(*this, "c352") , m_okim6295(*this, "okim6295") + , m_ymf271(*this, "ymf271") { } @@ -1055,8 +1074,9 @@ void vgmplay_state::machine_start() logerror("Warning: file requests an unsupported YMF262\n"); if(version >= 0x151 && r32(0x60)) logerror("Warning: file requests an unsupported YMF278B\n"); - if(version >= 0x151 && r32(0x64)) - logerror("Warning: file requests an unsupported YMF271\n"); + 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(0x6c)) @@ -1251,6 +1271,7 @@ static ADDRESS_MAP_START( soundchips_map, AS_IO, 8, vgmplay_state ) AM_RANGE(vgmplay_device::A_MULTIPCMB+8, vgmplay_device::A_MULTIPCMB+11) AM_WRITE(multipcm_bank_lo_b_w) 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) ADDRESS_MAP_END static ADDRESS_MAP_START( segapcm_map, AS_0, 8, vgmplay_state ) @@ -1400,6 +1421,11 @@ static MACHINE_CONFIG_START( vgmplay ) MCFG_DEVICE_ADDRESS_MAP(AS_0, okim6295_map) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) + + MCFG_SOUND_ADD("ymf271", YMF271, 16934400) + MCFG_YMF271_EXT_READ_HANDLER(DEVREAD8("vgmplay", vgmplay_device, ymf271_rom_r)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1) + MCFG_SOUND_ROUTE(1, "rspeaker", 1) MACHINE_CONFIG_END ROM_START( vgmplay ) -- cgit v1.2.3