minspacep: rename to minspace,

k051649: fix issue with sample reload
This commit is contained in:
hap 2023-07-07 19:38:11 +02:00
parent 82c3010dc5
commit 7d544e760d
5 changed files with 39 additions and 41 deletions

View File

@ -137,24 +137,22 @@ void k051649_device::sound_stream_update(sound_stream &stream, std::vector<read_
{
for (sound_channel &voice : m_channel_list)
{
if (--voice.clock < 0)
// channel is halted for freq < 9
if (voice.frequency > 8)
{
// channel is halted for freq < 9
if (voice.frequency < 9)
{
voice.clock = 0;
continue;
}
else
if (++voice.clock > voice.frequency)
{
voice.counter = (voice.counter + 1) & 0x1f;
voice.clock = voice.frequency;
voice.clock = 0;
}
if (voice.clock == 0)
{
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;
}

View File

@ -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<read_stream_view> const &inputs, std::vector<write_stream_view> &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)

View File

@ -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 )

View File

@ -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);
}
}

View File

@ -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