summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2016-01-19 12:21:01 +0100
committer hap <happppp@users.noreply.github.com>2016-01-19 12:21:34 +0100
commit74b9d95055a1a64fc8f3c949f781470fcb7740fe (patch)
tree4ef5c23f61aeaf53e90f8f735ee90ddfbd1d52a5 /src/devices/sound
parent4fc9eca8a81579f914bc280cebe1b3e69b79304c (diff)
s14001a_new_device: small update, savestates
Diffstat (limited to 'src/devices/sound')
-rw-r--r--src/devices/sound/s14001a_new.cpp61
-rw-r--r--src/devices/sound/s14001a_new.h13
2 files changed, 62 insertions, 12 deletions
diff --git a/src/devices/sound/s14001a_new.cpp b/src/devices/sound/s14001a_new.cpp
index 9e7f06a6626..efe9eb14892 100644
--- a/src/devices/sound/s14001a_new.cpp
+++ b/src/devices/sound/s14001a_new.cpp
@@ -24,6 +24,8 @@ s14001a_new_device::s14001a_new_device(const machine_config &mconfig, std::strin
// device_start - device-specific startup
//-------------------------------------------------
+ALLOW_SAVE_TYPE(s14001a_new_device::states); // allow save_item on a non-fundamental type
+
void s14001a_new_device::device_start()
{
m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() ? clock() : machine().sample_rate());
@@ -32,7 +34,51 @@ void s14001a_new_device::device_start()
m_ext_read_handler.resolve();
m_bsy_handler.resolve();
+ // note: zerofill is done already by MAME core
+ ClearStatistics();
m_uOutputP1 = m_uOutputP2 = 7;
+
+ // register for savestates
+ save_item(NAME(m_bPhase1));
+ save_item(NAME(m_uStateP1));
+ save_item(NAME(m_uStateP2));
+ save_item(NAME(m_uDAR13To05P1));
+ save_item(NAME(m_uDAR13To05P2));
+ save_item(NAME(m_uDAR04To00P1));
+ save_item(NAME(m_uDAR04To00P2));
+ save_item(NAME(m_uCWARP1));
+ save_item(NAME(m_uCWARP2));
+
+ save_item(NAME(m_bStopP1));
+ save_item(NAME(m_bStopP2));
+ save_item(NAME(m_bVoicedP1));
+ save_item(NAME(m_bVoicedP2));
+ save_item(NAME(m_bSilenceP1));
+ save_item(NAME(m_bSilenceP2));
+ save_item(NAME(m_uLengthP1));
+ save_item(NAME(m_uLengthP2));
+ save_item(NAME(m_uXRepeatP1));
+ save_item(NAME(m_uXRepeatP2));
+ save_item(NAME(m_uDeltaOldP1));
+ save_item(NAME(m_uDeltaOldP2));
+ save_item(NAME(m_uOutputP1));
+
+ save_item(NAME(m_bDAR04To00CarryP2));
+ save_item(NAME(m_bPPQCarryP2));
+ save_item(NAME(m_bRepeatCarryP2));
+ save_item(NAME(m_bLengthCarryP2));
+ save_item(NAME(m_RomAddrP1));
+
+ save_item(NAME(m_uOutputP2));
+ save_item(NAME(m_uRomAddrP2));
+ save_item(NAME(m_bBusyP1));
+ save_item(NAME(m_bStart));
+ save_item(NAME(m_uWord));
+
+ save_item(NAME(m_uNPitchPeriods));
+ save_item(NAME(m_uNVoiced));
+ save_item(NAME(m_uNControlWords));
+ save_item(NAME(m_uPrintLevel));
}
@@ -45,19 +91,22 @@ void s14001a_new_device::sound_stream_update(sound_stream &stream, stream_sample
for (int i = 0; i < samples; i++)
{
Clock();
- INT16 sample = INT16(m_uOutputP2) - 7;
- outputs[0][i] = sample * 0x4000;
+ INT16 sample = m_uOutputP2 - 7; // range -7..8
+ outputs[0][i] = sample * 0xf00;
}
}
+/**************************************************************************
+ External interface
+**************************************************************************/
void s14001a_new_device::force_update()
{
m_stream->update();
}
-READ_LINE_MEMBER(s14001a_new_device::romclock_r)
+READ_LINE_MEMBER(s14001a_new_device::romen_r)
{
m_stream->update();
return (m_bPhase1) ? 1 : 0;
@@ -82,14 +131,16 @@ WRITE_LINE_MEMBER(s14001a_new_device::start_w)
if (m_bStart) m_uStateP1 = WORDWAIT;
}
-void s14001a_new_device::set_clock(int clock)
+void s14001a_new_device::set_clock(UINT32 clock)
{
m_stream->update();
m_stream->set_sample_rate(clock);
}
-
+/**************************************************************************
+ Device emulation
+**************************************************************************/
UINT8 s14001a_new_device::readmem(UINT16 offset, bool phase)
{
diff --git a/src/devices/sound/s14001a_new.h b/src/devices/sound/s14001a_new.h
index 709573bd0bb..0860e34571b 100644
--- a/src/devices/sound/s14001a_new.h
+++ b/src/devices/sound/s14001a_new.h
@@ -22,14 +22,13 @@ public:
template<class _Object> static devcb_base &set_bsy_handler(device_t &device, _Object object) { return downcast<s14001a_new_device &>(device).m_bsy_handler.set_callback(object); }
template<class _Object> static devcb_base &set_ext_read_handler(device_t &device, _Object object) { return downcast<s14001a_new_device &>(device).m_ext_read_handler.set_callback(object); }
- DECLARE_READ_LINE_MEMBER(busy_r);
- DECLARE_READ_LINE_MEMBER(romclock_r);
- DECLARE_WRITE_LINE_MEMBER(start_w);
- DECLARE_WRITE8_MEMBER(data_w);
+ DECLARE_READ_LINE_MEMBER(busy_r); // /BUSY (pin 40)
+ DECLARE_READ_LINE_MEMBER(romen_r); // ROM /EN (pin 9)
+ DECLARE_WRITE_LINE_MEMBER(start_w); // START (pin 10)
+ DECLARE_WRITE8_MEMBER(data_w); // 6-bit word
- void set_clock(int clock); /* set VSU-1000 clock */
-// void set_volume(int volume); /* set VSU-1000 volume control */
- void force_update();
+ void set_clock(UINT32 clock); // set new CLK frequency
+ void force_update(); // update stream, eg. before external ROM bankswitch
protected:
// device-level overrides