From f5493f86d9dfd6bae07849fe679d28fe5dd8ae1f Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 4 Dec 2022 15:41:15 +0100 Subject: exidy440_a: zerofill more class variables --- src/devices/cpu/m6502/rp2a03.cpp | 4 +-- src/mame/exidy/exidy440.cpp | 3 -- src/mame/exidy/exidy440_a.cpp | 72 ++++++++++++++++++---------------------- src/mame/exidy/exidy440_a.h | 2 -- 4 files changed, 34 insertions(+), 47 deletions(-) diff --git a/src/devices/cpu/m6502/rp2a03.cpp b/src/devices/cpu/m6502/rp2a03.cpp index 401a8f04b32..888c31f4c68 100644 --- a/src/devices/cpu/m6502/rp2a03.cpp +++ b/src/devices/cpu/m6502/rp2a03.cpp @@ -35,8 +35,8 @@ void rp2a03_device::rp2a03_map(address_map &map) map(0x4015, 0x4015).r(FUNC(rp2a03_device::apu_status_r)); // 0x4014 w -> NES sprite DMA (is this internal?) // 0x4016 w -> d0-d2: RP2A03 OUT0,OUT1,OUT2 - // 0x4016 r -> RP2A03 IN0 - // 0x4017 r -> RP2A03 IN1 + // 0x4016 r -> d0-d4: RP2A03 IN0 + // 0x4017 r -> d0-d4: RP2A03 IN1 } diff --git a/src/mame/exidy/exidy440.cpp b/src/mame/exidy/exidy440.cpp index 71ed6e69b0c..87517fd8493 100644 --- a/src/mame/exidy/exidy440.cpp +++ b/src/mame/exidy/exidy440.cpp @@ -247,9 +247,6 @@ Who Dunit 1988 6809 - - - /************************************* * * Coin handling diff --git a/src/mame/exidy/exidy440_a.cpp b/src/mame/exidy/exidy440_a.cpp index 5cdb884610c..82c5a225334 100644 --- a/src/mame/exidy/exidy440_a.cpp +++ b/src/mame/exidy/exidy440_a.cpp @@ -11,7 +11,6 @@ #include "emu.h" #include "exidy440_a.h" -#include "exidy440.h" #include "cpu/m6809/m6809.h" @@ -66,26 +65,12 @@ void exidy440_sound_device::exidy440_audio_map(address_map &map) DEFINE_DEVICE_TYPE(EXIDY440, exidy440_sound_device, "exidy440_sound", "Exidy 440 CVSD") -exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, EXIDY440, tag, owner, clock), - device_sound_interface(mconfig, *this), - m_audiocpu(*this, "audiocpu"), - m_samples(*this, "samples"), - m_sound_command(0), - m_sound_command_ack(0), - m_m6844_priority(0x00), - m_m6844_interrupt(0x00), - m_m6844_chain(0x00), - m_stream(nullptr) +exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, EXIDY440, tag, owner, clock), + device_sound_interface(mconfig, *this), + m_audiocpu(*this, "audiocpu"), + m_samples(*this, "samples") { - m_sound_banks[0] = m_sound_banks[1] = m_sound_banks[2] = m_sound_banks[3] = 0; - - for (auto & elem : m_sound_channel) - { - elem.base = nullptr; - elem.offset = 0; - elem.remaining = 0; - } } //------------------------------------------------- @@ -98,11 +83,8 @@ void exidy440_sound_device::device_add_mconfig(machine_config &config) m_audiocpu->set_addrmap(AS_PROGRAM, &exidy440_sound_device::exidy440_audio_map); // MC3418(config, "cvsd1", EXIDY440_MC3418_CLOCK).add_route(ALL_OUTPUTS, "lspeaker", 1.0); - // MC3418(config, "cvsd2", EXIDY440_MC3418_CLOCK).add_route(ALL_OUTPUTS, "rspeaker", 1.0); - // MC3417(config, "cvsd3", EXIDY440_MC3417_CLOCK).add_route(ALL_OUTPUTS, "lspeaker", 1.0); - // MC3417(config, "cvsd4", EXIDY440_MC3417_CLOCK).add_route(ALL_OUTPUTS, "rspeaker", 1.0); } @@ -112,24 +94,38 @@ void exidy440_sound_device::device_add_mconfig(machine_config &config) void exidy440_sound_device::device_start() { - int i; - /* reset the system */ m_sound_command = 0; m_sound_command_ack = 1; save_item(NAME(m_sound_command)); save_item(NAME(m_sound_command_ack)); + for (int i = 0; i < 4; i++) + { + m_sound_banks[i] = 0; + m_sound_channel[i].base = nullptr; + m_sound_channel[i].offset = 0; + m_sound_channel[i].remaining = 0; + } + + memset(m_sound_volume, 0, sizeof(m_sound_volume)); + save_item(NAME(m_sound_volume)); + save_item(NAME(m_sound_banks)); + /* reset the 6844 */ - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { m_m6844_channel[i].active = 0; - m_m6844_channel[i].control = 0x00; + m_m6844_channel[i].address = 0; + m_m6844_channel[i].counter = 0; + m_m6844_channel[i].control = 0; + m_m6844_channel[i].start_address = 0; + m_m6844_channel[i].start_counter = 0; } - m_m6844_priority = 0x00; - m_m6844_interrupt = 0x00; - m_m6844_chain = 0x00; + m_m6844_priority = 0; + m_m6844_interrupt = 0; + m_m6844_chain = 0; save_item(NAME(m_m6844_priority)); save_item(NAME(m_m6844_interrupt)); save_item(NAME(m_m6844_chain)); @@ -143,8 +139,8 @@ void exidy440_sound_device::device_start() m_stream = stream_alloc(0, 2, clock()); /* allocate the mixer buffer */ - m_mixer_buffer_left.resize(clock()/50); - m_mixer_buffer_right.resize(clock()/50); + m_mixer_buffer_left.resize(clock()); + m_mixer_buffer_right.resize(clock()); if (SOUND_LOG) m_debuglog = fopen("sound.log", "w"); @@ -170,7 +166,6 @@ void exidy440_sound_device::add_and_scale_samples(int ch, int32_t *dest, int sam { sound_channel_data *channel = &m_sound_channel[ch]; int16_t *srcdata; - int i; /* channels 2 and 3 are half-rate samples */ if (ch & 2) @@ -185,7 +180,7 @@ void exidy440_sound_device::add_and_scale_samples(int ch, int32_t *dest, int sam } /* copy 1 for 2 to the destination */ - for (i = 0; i < samples; i += 2) + for (int i = 0; i < samples; i += 2) { int16_t sample = *srcdata++ * volume / 256; *dest++ += sample; @@ -197,7 +192,7 @@ void exidy440_sound_device::add_and_scale_samples(int ch, int32_t *dest, int sam else { srcdata = &channel->base[channel->offset]; - for (i = 0; i < samples; i++) + for (int i = 0; i < samples; i++) *dest++ += *srcdata++ * volume / 256; } } @@ -425,7 +420,6 @@ uint8_t exidy440_sound_device::m6844_r(offs_t offset) void exidy440_sound_device::m6844_w(offs_t offset, uint8_t data) { m6844_channel_data *m6844_channel = m_m6844_channel; - int i; /* first update the current state of the DMA transfers */ m6844_update(); @@ -478,7 +472,7 @@ void exidy440_sound_device::m6844_w(offs_t offset, uint8_t data) m_m6844_priority = data; /* update the sound playback on each channel */ - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { /* if we're going active... */ if (!m6844_channel[i].active && (data & (1 << i))) @@ -797,14 +791,12 @@ void exidy440_sound_device::sound_banks_w(offs_t offset, uint8_t data) void exidy440_sound_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) { - int ch; - /* reset the mixer buffers */ std::fill_n(&m_mixer_buffer_left[0], outputs[0].samples(), 0); std::fill_n(&m_mixer_buffer_right[0], outputs[0].samples(), 0); /* loop over channels */ - for (ch = 0; ch < 4; ch++) + for (int ch = 0; ch < 4; ch++) { sound_channel_data *channel = &m_sound_channel[ch]; int length, volume, left = outputs[0].samples(); diff --git a/src/mame/exidy/exidy440_a.h b/src/mame/exidy/exidy440_a.h index 97f674a3471..05c456da79a 100644 --- a/src/mame/exidy/exidy440_a.h +++ b/src/mame/exidy/exidy440_a.h @@ -45,7 +45,6 @@ private: int start_counter; }; - /* channel_data structure holds info about each active sound channel */ struct sound_channel_data { @@ -54,7 +53,6 @@ private: int remaining; }; - /* sound_cache_entry structure contains info on each decoded sample */ struct sound_cache_entry { -- cgit v1.2.3