Skip to content

Commit 5636507

Browse files
committed
shared/wswansound.cpp: Minor emulation incorrection fixes
1 parent 66d102d commit 5636507

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

src/mame/shared/wswansound.cpp

+5-15
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ wswan_sound_device::wswan_sound_device(const machine_config &mconfig, const char
5050
m_sweep_time(8192),
5151
m_sweep_count(0),
5252
m_noise_type(0),
53-
m_noise_reset(0),
5453
m_noise_enable(0),
5554
m_noise_output(0),
5655
m_sample_address(0),
@@ -83,7 +82,6 @@ void wswan_sound_device::device_start()
8382
save_item(NAME(m_sweep_time));
8483
save_item(NAME(m_sweep_count));
8584
save_item(NAME(m_noise_type));
86-
save_item(NAME(m_noise_reset));
8785
save_item(NAME(m_noise_enable));
8886
save_item(NAME(m_sample_address));
8987
save_item(NAME(m_audio2_voice));
@@ -116,7 +114,6 @@ void wswan_sound_device::device_start()
116114
save_item(NAME(m_hypervoice.div));
117115
save_item(NAME(m_hypervoice.counter));
118116
save_item(NAME(m_hypervoice.enable));
119-
save_item(NAME(m_hypervoice.reset));
120117
save_item(NAME(m_hypervoice.channel_mode));
121118
}
122119

@@ -241,14 +238,7 @@ void wswan_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
241238

242239
m_audio[3].pos -= m_audio[3].period;
243240

244-
if (m_noise_reset)
245-
{
246-
m_noise_reset = 0;
247-
m_noise_shift = 0;
248-
m_noise_output = 0;
249-
}
250-
251-
if (m_noise_enable)
241+
if (m_audio4_noise && m_noise_enable)
252242
{
253243
static const int shift_bit[] = { 14, 10, 13, 4, 8, 6, 9, 11 };
254244

@@ -358,7 +348,6 @@ u16 wswan_sound_device::hypervoice_r(offs_t offset, u16 mem_mask)
358348
(m_hypervoice.scale_mode << 2) |
359349
(m_hypervoice.div << 4) |
360350
(m_hypervoice.enable ? 0x0080 : 0x0000) |
361-
(m_hypervoice.reset ? 0x1000 : 0x0000) |
362351
(m_hypervoice.channel_mode << 13);
363352
default:
364353
if (!machine().side_effects_disabled())
@@ -398,9 +387,8 @@ void wswan_sound_device::hypervoice_w(offs_t offset, u16 data, u16 mem_mask)
398387
}
399388
if (ACCESSING_BITS_8_15)
400389
{
401-
m_hypervoice.reset = BIT(data, 12);
402390
m_hypervoice.channel_mode = (data >> 13) & 3;
403-
if (m_hypervoice.reset)
391+
if (BIT(data, 12))
404392
m_hypervoice.input_channel = false;
405393
}
406394
break;
@@ -430,7 +418,7 @@ u16 wswan_sound_device::port_r(offs_t offset, u16 mem_mask)
430418
case 0x8c / 2:
431419
return m_sweep_step | (((m_sweep_time / 8192) - 1) << 8);
432420
case 0x8e / 2:
433-
return m_noise_type | (m_noise_reset ? 0x08 : 0x00) | (m_noise_enable ? 0x10 : 0x00) |
421+
return m_noise_type | (m_noise_enable ? 0x10 : 0x00) |
434422
((m_sample_address << 2) & 0xff00);
435423
case 0x90 / 2:
436424
return (m_audio[0].on ? 0x01 : 0x00) |
@@ -528,6 +516,8 @@ void wswan_sound_device::port_w(offs_t offset, u16 data, u16 mem_mask)
528516
m_noise_type = data & 0x07;
529517
m_noise_reset = BIT(data, 3);
530518
m_noise_enable = BIT(data, 4);
519+
if (BIT(data, 3))
520+
m_noise_shift = m_noise_output = 0;
531521
}
532522
// Sample location
533523
if (ACCESSING_BITS_8_15)

src/mame/shared/wswansound.h

-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ class wswan_sound_device : public device_t,
9494
u8 div;
9595
u8 counter;
9696
bool enable;
97-
bool reset;
9897
u8 channel_mode;
9998
} m_hypervoice;
10099

@@ -106,7 +105,6 @@ class wswan_sound_device : public device_t,
106105
u32 m_sweep_time;
107106
u32 m_sweep_count;
108107
u8 m_noise_type;
109-
u8 m_noise_reset;
110108
u8 m_noise_enable;
111109
u8 m_noise_output;
112110
u16 m_sample_address;

0 commit comments

Comments
 (0)