From 7d544e760dde5f91517a149f3db4378423c1164b Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 7 Jul 2023 19:38:11 +0200 Subject: minspacep: rename to minspace, k051649: fix issue with sample reload --- src/devices/sound/k051649.cpp | 43 +++++++++++++++++++++-------------------- src/devices/sound/k051649.h | 21 +++++++++----------- src/mame/handheld/hh_cop400.cpp | 4 ++-- src/mame/konami/quickpick5.cpp | 6 +++--- src/mame/mame.lst | 2 +- 5 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/devices/sound/k051649.cpp b/src/devices/sound/k051649.cpp index 97fc9ca9298..b4fda78732e 100644 --- a/src/devices/sound/k051649.cpp +++ b/src/devices/sound/k051649.cpp @@ -137,24 +137,22 @@ void k051649_device::sound_stream_update(sound_stream &stream, std::vector 8) { - // channel is halted for freq < 9 - if (voice.frequency < 9) + if (++voice.clock > voice.frequency) { + voice.counter = (voice.counter + 1) & 0x1f; voice.clock = 0; - continue; } - else + if (voice.clock == 0) { - voice.counter = (voice.counter + 1) & 0x1f; - voice.clock = voice.frequency; + voice.sample = (voice.key ? voice.waveram[voice.counter] : 0) * voice.volume; } } // scale to 11 bit digital output on chip - if (voice.key) - outputs[0].add_int(i, (voice.waveram[voice.counter] * voice.volume) >> 4, 1024); + outputs[0].add_int(i, voice.sample >> 4, 1024); } } } @@ -228,7 +226,7 @@ u8 k051649_device::k052539_waveform_r(offs_t offset) void k051649_device::k051649_volume_w(offs_t offset, u8 data) { m_stream->update(); - m_channel_list[offset & 0x7].volume = data & 0xf; + m_channel_list[offset].volume = data & 0xf; } @@ -239,18 +237,18 @@ void k051649_device::k051649_frequency_w(offs_t offset, u8 data) m_stream->update(); - // test register bit 5 resets the internal counter - if (m_test & 0x20) - { - m_channel_list[offset].counter = 0x1f; - m_channel_list[offset].clock = 0; - } - // update frequency if (freq_hi) m_channel_list[offset].frequency = (m_channel_list[offset].frequency & 0x0ff) | (data << 8 & 0xf00); else m_channel_list[offset].frequency = (m_channel_list[offset].frequency & 0xf00) | data; + + // test register bit 5 resets the internal counter + if (m_test & 0x20) + m_channel_list[offset].counter = 0; + + // sample reload pending + m_channel_list[offset].clock = -1; } @@ -271,10 +269,13 @@ void k051649_device::k051649_test_w(u8 data) } -u8 k051649_device::k051649_test_r() +u8 k051649_device::k051649_test_r(address_space &space) { - // reading the test register sets it to $ff! + u8 data = space.unmap(); + + // reading the test register triggers a write if (!machine().side_effects_disabled()) - k051649_test_w(0xff); - return 0xff; + k051649_test_w(data); + + return data; } diff --git a/src/devices/sound/k051649.h b/src/devices/sound/k051649.h index 1613cdfcfd8..10be0f28bb5 100644 --- a/src/devices/sound/k051649.h +++ b/src/devices/sound/k051649.h @@ -19,15 +19,15 @@ public: k051649_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); void k051649_waveform_w(offs_t offset, u8 data); - u8 k051649_waveform_r(offs_t offset); + u8 k051649_waveform_r(offs_t offset); void k051649_volume_w(offs_t offset, u8 data); void k051649_frequency_w(offs_t offset, u8 data); void k051649_keyonoff_w(u8 data); void k051649_test_w(u8 data); - u8 k051649_test_r(); + u8 k051649_test_r(address_space &space); void k052539_waveform_w(offs_t offset, u8 data); - u8 k052539_waveform_r(offs_t offset); + u8 k052539_waveform_r(offs_t offset); void scc_map(address_map &map); @@ -42,7 +42,7 @@ protected: virtual void sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) override; private: - // Parameters for a channel + // parameters for a channel struct sound_channel { sound_channel() : @@ -50,28 +50,25 @@ private: clock(0), frequency(0), volume(0), + sample(0), key(false) { std::fill(std::begin(waveram), std::end(waveram), 0); } u8 counter; // address counter for wavetable - s16 clock; // internal clock + u16 clock; // internal clock u16 frequency; // frequency; result: (input clock / (32 * (frequency + 1))) - int volume; // volume + u8 volume; // volume + s16 sample; // latched sample data bool key; // keyon/off s8 waveram[32]; // 32 byte wavetable }; - void make_mixer_table(int voices); - sound_channel m_channel_list[5]; - /* global sound parameters */ sound_stream *m_stream; - - /* chip registers */ - u8 m_test; + u8 m_test; // test register }; DECLARE_DEVICE_TYPE(K051649, k051649_device) diff --git a/src/mame/handheld/hh_cop400.cpp b/src/mame/handheld/hh_cop400.cpp index bbab0436cc1..5383cea12d3 100644 --- a/src/mame/handheld/hh_cop400.cpp +++ b/src/mame/handheld/hh_cop400.cpp @@ -1663,7 +1663,7 @@ void minspace_state::minspace(machine_config &config) // roms -ROM_START( minspacep ) +ROM_START( minspace ) ROM_REGION( 0x0400, "maincpu", 0 ) ROM_LOAD( "cop421_us4345764", 0x0000, 0x0400, CRC(0068c3a3) SHA1(4e5fd566a5a26c066cc14623a9bd01e109ebf797) ) // typed in from patent US4345764, good print quality ROM_END @@ -2820,7 +2820,7 @@ SYST( 1979, msoccer2, 0, 0, msoccer2, msoccer2, mbaskb2_state SYST( 1980, lafootb, 0, 0, lafootb, lafootb, lafootb_state, empty_init, "Mattel Electronics", "Look Alive! Football", MACHINE_SUPPORTS_SAVE ) SYST( 1981, mdallas, 0, 0, mdallas, mdallas, mdallas_state, empty_init, "Mattel Electronics", "Dalla$ (J.R. handheld)", MACHINE_SUPPORTS_SAVE ) // *** -SYST( 1980, minspacep, 0, 0, minspace, minspace, minspace_state, empty_init, "Mego", "Invasion From Space (patent)", MACHINE_SUPPORTS_SAVE ) +SYST( 1980, minspace, 0, 0, minspace, minspace, minspace_state, empty_init, "Mego", "Invasion From Space (patent)", MACHINE_SUPPORTS_SAVE ) SYST( 1980, plus1, 0, 0, plus1, plus1, plus1_state, empty_init, "Milton Bradley", "Plus One", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_CONTROLS ) // *** SYST( 1981, lightfgt, 0, 0, lightfgt, lightfgt, lightfgt_state, empty_init, "Milton Bradley", "Electronic Lightfight: The Games of Dueling Lights", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/konami/quickpick5.cpp b/src/mame/konami/quickpick5.cpp index 7f063dfedfb..502c7548a04 100644 --- a/src/mame/konami/quickpick5.cpp +++ b/src/mame/konami/quickpick5.cpp @@ -88,7 +88,7 @@ private: m_control = data; } - u8 vram_r(offs_t offset); + u8 vram_r(address_space &space, offs_t offset); void vram_w(offs_t offset, u8 data); void serial_io_w(u8 data); @@ -190,7 +190,7 @@ void quickpick5_state::ccu_int_time_w(u8 data) m_ccu_int_time = data; } -u8 quickpick5_state::vram_r(offs_t offset) +u8 quickpick5_state::vram_r(address_space &space, offs_t offset) { if ((m_control & 0x10) == 0x10) { @@ -201,7 +201,7 @@ u8 quickpick5_state::vram_r(offs_t offset) } else if ((offset >= 0x8e0) && (offset <= 0x8ff)) { - return m_k051649->k051649_test_r(); + return m_k051649->k051649_test_r(space); } } diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 59da9359d5b..054145a6190 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -18672,7 +18672,7 @@ lightfgt // Milton Bradley lilcomp // Texas Instruments mbaskb2 // Mattel mdallas // Mattel -minspacep // Mego +minspace // Mego msoccer2 // Mattel plus1 // Milton Bradley qkracera // National Semiconductor -- cgit v1.2.3