From 9416c5cf80fb3db6649fdb6d3a3c53a84cec0079 Mon Sep 17 00:00:00 2001 From: smf- Date: Wed, 6 Dec 2017 14:02:03 +0000 Subject: [PATCH] RF5C400: Converted to use device_rom_interface [smf] --- src/devices/sound/rf5c400.cpp | 17 +++++++++-------- src/devices/sound/rf5c400.h | 10 +++++----- src/mame/drivers/twinkle.cpp | 29 ++++++++++++++++------------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp index f354d358402..c4bf56bc1b0 100644 --- a/src/devices/sound/rf5c400.cpp +++ b/src/devices/sound/rf5c400.cpp @@ -129,7 +129,7 @@ void rf5c400_device::envelope_tables::init(uint32_t clock) rf5c400_device::rf5c400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, RF5C400, tag, owner, clock) , device_sound_interface(mconfig, *this) - , m_rom(*this, DEVICE_SELF) + , device_rom_interface(mconfig, *this, 25, ENDIANNESS_LITTLE, 16) , m_stream(nullptr) , m_env_tables() { @@ -180,8 +180,6 @@ void rf5c400_device::device_start() } m_stream = stream_alloc(0, 2, clock() / 384); - - m_rommask = m_rom.length() - 1; } //------------------------------------------------- @@ -191,7 +189,6 @@ void rf5c400_device::device_start() void rf5c400_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { int i, ch; - int16_t *rom = m_rom; uint32_t end, loop; uint64_t pos; uint8_t vol, lvol, rvol, type; @@ -228,7 +225,7 @@ void rf5c400_device::sound_stream_update(sound_stream &stream, stream_sample_t * if (env_phase == PHASE_NONE) break; - tmp = rom[(pos>>16) & m_rommask]; + tmp = read_word((pos>>16)<<1); switch ( type ) { case TYPE_16: @@ -295,7 +292,7 @@ void rf5c400_device::sound_stream_update(sound_stream &stream, stream_sample_t * *buf1++ += sample * pan_table[rvol]; pos += channel->step; - if ( (pos>>16) > m_rom.length() || (pos>>16) > end) + if ((pos>>16) > end) { pos -= loop<<16; pos &= 0xFFFFFF0000U; @@ -310,6 +307,10 @@ void rf5c400_device::sound_stream_update(sound_stream &stream, stream_sample_t * } } +void rf5c400_device::rom_bank_updated() +{ + m_stream->update(); +} /*****************************************************************************/ @@ -330,7 +331,7 @@ READ16_MEMBER( rf5c400_device::rf5c400_r ) case 0x13: // memory read { - return m_rom[m_ext_mem_address]; + return read_word(m_ext_mem_address<<1); } } @@ -411,7 +412,7 @@ WRITE16_MEMBER( rf5c400_device::rf5c400_w ) { if ((data & 0x3) == 3) { - m_rom[m_ext_mem_address] = m_ext_mem_data; + this->space().write_word(m_ext_mem_address << 1, m_ext_mem_data); } break; } diff --git a/src/devices/sound/rf5c400.h b/src/devices/sound/rf5c400.h index 6fe27863f70..3c365f76e3a 100644 --- a/src/devices/sound/rf5c400.h +++ b/src/devices/sound/rf5c400.h @@ -25,7 +25,8 @@ // ======================> rf5c400_device class rf5c400_device : public device_t, - public device_sound_interface + public device_sound_interface, + public device_rom_interface { public: rf5c400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -40,6 +41,9 @@ protected: // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; + // device_rom_interface overrides + virtual void rom_bank_updated() override; + private: struct rf5c400_channel { @@ -88,10 +92,6 @@ private: uint8_t decode80(uint8_t val); - required_region_ptr m_rom; - - uint32_t m_rommask; - sound_stream *m_stream; envelope_tables m_env_tables; diff --git a/src/mame/drivers/twinkle.cpp b/src/mame/drivers/twinkle.cpp index 71abe917d83..85dbd059fea 100644 --- a/src/mame/drivers/twinkle.cpp +++ b/src/mame/drivers/twinkle.cpp @@ -9,7 +9,7 @@ driver by smf and R. Belmont TODO: dvd check for bmiidx, bmiidxa, bmiidxc & bmiidxca -remove dummy 8mb bank +The first 128k of RF5C400 bank 0 is uploaded by the 68000, the rest is unused. It may be using 16J & 18J emulate dvd player and video mixing 16seg led font @@ -28,14 +28,14 @@ beatmania IIDX + DDR Club Kit(newer) 1999 896 JA BBM *? * beatmania IIDX Substream 1999 *? GC983 A04 *? ? beatmania IIDX Club Version 2 1999 GE984 A01(BM) *? *984 A02 ? + GE984 A01(DDR) -beatmania IIDX 2nd Style 1999 GC985 A01 GC985 A04 * *985 HDD A01 -beatmania IIDX 3rd Style 2000 GC992-JA A01 GC992-JA A04 * *992 HDD A01 -beatmania IIDX 3rd Style(newer) 2000 GC992-JA C01 GC992-JA A04 * *992 HDD A01 -beatmania IIDX 4th Style 2000 A03 JA A01 A03 JA A02 *A03 A03 JA A03 -beatmania IIDX 5th Style 2001 A17 JA A01 A17 JA A02 * *A17 JA A03 -beatmania IIDX 6th Style 2001 B4U JA A01 B4U JA A02 * B4U JA A03 -beatmania IIDX 6th Style(newer) 2001 B4U JA B01 B4U JA A02 * B4U JA A03 -beatmania IIDX 7th Style 2002 B44 JA A01 B44 JA A02 * B44 JA A03 +beatmania IIDX 2nd Style 1999 GC985 A01 GC985 A04 *? *985 HDD A01 +beatmania IIDX 3rd Style 2000 GC992-JA A01 GC992-JA A04 *? *992 HDD A01 +beatmania IIDX 3rd Style(newer) 2000 GC992-JA C01 GC992-JA A04 *? *992 HDD A01 +beatmania IIDX 4th Style 2000 A03 JA A01 A03 JA A02 A03 A03 JA A03 +beatmania IIDX 5th Style 2001 A17 JA A01 A17 JA A02 A17 *A17 JA A03 +beatmania IIDX 6th Style 2001 B4U JA A01 B4U JA A02 *? B4U JA A03 +beatmania IIDX 6th Style(newer) 2001 B4U JA B01 B4U JA A02 *? B4U JA A03 +beatmania IIDX 7th Style 2002 B44 JA A01 B44 JA A02 *? B44 JA A03 beatmania IIDX 8th Style 2002 C44 JA A01 C44 JA A02 *C44 C44 JA A03 * = Not dumped. @@ -267,7 +267,7 @@ public: required_device m_am53cf96; required_device m_ata; - required_region_ptr m_waveram; + required_shared_ptr m_waveram; uint16_t m_spu_ctrl; // SPU board control register uint8_t m_spu_shared[0x400]; // SPU/PSX shared dual-ported RAM @@ -923,6 +923,10 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 16, twinkle_state ) AM_RANGE(0x800000, 0xffffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w) ADDRESS_MAP_END +static ADDRESS_MAP_START(rf5c400_map, 0, 16, twinkle_state) + AM_RANGE(0x0000000, 0x1ffffff) AM_RAM AM_SHARE("rfsnd") +ADDRESS_MAP_END + /* SCSI */ static void scsi_dma_read( twinkle_state *state, uint32_t *p_n_psxram, uint32_t n_address, int32_t n_size ) @@ -1069,6 +1073,7 @@ static MACHINE_CONFIG_START( twinkle ) MCFG_SOUND_ROUTE( 1, "speakerright", 0.75 ) MCFG_RF5C400_ADD("rfsnd", XTAL_33_8688MHz/2); + MCFG_DEVICE_ADDRESS_MAP(0, rf5c400_map) MCFG_SOUND_ROUTE(0, "speakerleft", 1.0) MCFG_SOUND_ROUTE(1, "speakerright", 1.0) MACHINE_CONFIG_END @@ -1170,9 +1175,7 @@ INPUT_PORTS_END ROM_LOAD( "863a03.7b", 0x000000, 0x080000, CRC(81498f73) SHA1(3599b40a5872eab3a00d345287635355fcb25a71) )\ \ ROM_REGION32_LE( 0x080000, "audiocpu", 0 )\ - ROM_LOAD16_WORD_SWAP( "863a05.2x", 0x000000, 0x080000, CRC(6f42a09e) SHA1(cab5209f90f47b9ee6e721479913ad74e3ba84b1) )\ -\ - ROM_REGION16_LE(0x2000000, "rfsnd", ROMREGION_ERASE00) // the first 8mb isn't populated + ROM_LOAD16_WORD_SWAP( "863a05.2x", 0x000000, 0x080000, CRC(6f42a09e) SHA1(cab5209f90f47b9ee6e721479913ad74e3ba84b1) ) ROM_START( gq863 ) TWINKLE_BIOS