From 0fe9e1defe81bcc45e249daa3a3197213513d2e3 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 2 Dec 2017 00:46:05 -0500 Subject: twinkle: many fixes to waveram banking + DMA. Most sets are semi-playable now. [R. Belmont, Sarah Purohit] --- src/devices/sound/rf5c400.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/devices/sound/rf5c400.cpp') diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp index 39440c66991..4fc6a364c7a 100644 --- a/src/devices/sound/rf5c400.cpp +++ b/src/devices/sound/rf5c400.cpp @@ -181,7 +181,7 @@ void rf5c400_device::device_start() m_stream = stream_alloc(0, 2, clock() / 384); - m_rommask = m_rom.length() - 1; + m_rommask = (m_rom.length()/2) - 1; } //------------------------------------------------- @@ -258,7 +258,7 @@ void rf5c400_device::sound_stream_update(sound_stream &stream, stream_sample_t * { env_phase = PHASE_DECAY; env_level = 1.0; - if (channel->decay & 0x0080) + if ((channel->decay & 0x0080) || (channel->decay == 0x100)) { env_step = 0.0; } -- cgit v1.2.3-70-g09d2 From 30a160d78295552c0ee3001def36d135fe12821d Mon Sep 17 00:00:00 2001 From: arbee Date: Mon, 4 Dec 2017 09:13:22 -0500 Subject: rf5c400: fix regression (nw) This fixes gradius4, and also fixes the dog whistling and other issues in the bmiidx games. --- src/devices/sound/rf5c400.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/devices/sound/rf5c400.cpp') diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp index 4fc6a364c7a..f354d358402 100644 --- a/src/devices/sound/rf5c400.cpp +++ b/src/devices/sound/rf5c400.cpp @@ -181,7 +181,7 @@ void rf5c400_device::device_start() m_stream = stream_alloc(0, 2, clock() / 384); - m_rommask = (m_rom.length()/2) - 1; + m_rommask = m_rom.length() - 1; } //------------------------------------------------- -- cgit v1.2.3-70-g09d2 From 9416c5cf80fb3db6649fdb6d3a3c53a84cec0079 Mon Sep 17 00:00:00 2001 From: smf- Date: Wed, 6 Dec 2017 14:02:03 +0000 Subject: 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(-) (limited to 'src/devices/sound/rf5c400.cpp') 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 -- cgit v1.2.3-70-g09d2 From d6601f04833115b0dfc10d24de62c27a30a2931c Mon Sep 17 00:00:00 2001 From: smf- Date: Thu, 7 Dec 2017 10:54:46 +0000 Subject: RF5C400: State save the external memory registers. Move static variable into device state. Fix the commented out osd_printf_debug. Fix "always values". Added skeleton for reading and writing channel register 0x0F (which is used by the beatmania IIDX games). [smf] --- src/devices/sound/rf5c400.cpp | 65 ++++++++++++++++++++++++++++++++----------- src/devices/sound/rf5c400.h | 1 + 2 files changed, 49 insertions(+), 17 deletions(-) (limited to 'src/devices/sound/rf5c400.cpp') diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp index c4bf56bc1b0..6c047935399 100644 --- a/src/devices/sound/rf5c400.cpp +++ b/src/devices/sound/rf5c400.cpp @@ -155,6 +155,10 @@ void rf5c400_device::device_start() chan.env_scale = 1.0; } + save_item(NAME(m_rf5c400_status)); + save_item(NAME(m_ext_mem_address)); + save_item(NAME(m_ext_mem_data)); + for (int i = 0; i < ARRAY_LENGTH(m_channels); i++) { save_item(NAME(m_channels[i].startH), i); @@ -314,28 +318,50 @@ void rf5c400_device::rom_bank_updated() /*****************************************************************************/ -static uint16_t rf5c400_status = 0; // a static one of these for all instances of the chip? how does that work? READ16_MEMBER( rf5c400_device::rf5c400_r ) { - switch(offset) + if (offset < 0x400) { - case 0x00: + //osd_printf_debug("%s:rf5c400_r: %08X, %08X\n", machine().describe_context().c_str(), offset, mem_mask); + + switch(offset) { - return rf5c400_status; + case 0x00: + { + return m_rf5c400_status; + } + + case 0x04: // unknown read + { + return 0; + } + + case 0x13: // memory read + { + return read_word(m_ext_mem_address<<1); + } + + default: + { + //osd_printf_debug("%s:rf5c400_r: %08X, %08X\n", machine().describe_context().c_str(), offset, mem_mask); + return 0; + } } + } + else + { + //int ch = (offset >> 5) & 0x1f; + int reg = (offset & 0x1f); - case 0x04: + switch (reg) { + case 0x0F: // unknown read return 0; - } - case 0x13: // memory read - { - return read_word(m_ext_mem_address<<1); + default: + return 0; } } - - return 0; } WRITE16_MEMBER( rf5c400_device::rf5c400_w ) @@ -346,7 +372,7 @@ WRITE16_MEMBER( rf5c400_device::rf5c400_w ) { case 0x00: { - rf5c400_status = data; + m_rf5c400_status = data; break; } @@ -432,11 +458,11 @@ WRITE16_MEMBER( rf5c400_device::rf5c400_w ) default: { - //osd_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", machine().describe_context(), data, offset, mem_mask); + //osd_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", machine().describe_context().c_str(), data, offset, mem_mask); break; } } - //osd_printf_debug("%s:rf5c400_w: %08X, %08X, %08X at %08X\n", machine().describe_context(), data, offset, mem_mask); + //osd_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", machine().describe_context().c_str(), data, offset, mem_mask); } else { @@ -505,12 +531,12 @@ WRITE16_MEMBER( rf5c400_device::rf5c400_w ) } case 0x0A: // relative to env attack ? { - // always 0x0100 + // always 0x0100/0x140 break; } case 0x0B: // relative to env decay ? { - // always 0x0100 + // always 0x0100/0x140/0x180 break; } case 0x0C: // env decay @@ -522,7 +548,7 @@ WRITE16_MEMBER( rf5c400_device::rf5c400_w ) } case 0x0D: // relative to env release ? { - // always 0x0100 + // always 0x0100/0x140 break; } case 0x0E: // env release @@ -531,6 +557,11 @@ WRITE16_MEMBER( rf5c400_device::rf5c400_w ) channel->release = data; break; } + case 0x0F: // unknown write + { + // always 0x0000 + break; + } case 0x10: // resonance, cutoff freq. { // bit 15-12: resonance diff --git a/src/devices/sound/rf5c400.h b/src/devices/sound/rf5c400.h index 3c365f76e3a..4d681db3a94 100644 --- a/src/devices/sound/rf5c400.h +++ b/src/devices/sound/rf5c400.h @@ -98,6 +98,7 @@ private: rf5c400_channel m_channels[32]; + uint16_t m_rf5c400_status; uint32_t m_ext_mem_address; uint16_t m_ext_mem_data; }; -- cgit v1.2.3-70-g09d2