summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2019-05-16 18:39:51 +0200
committer hap <happppp@users.noreply.github.com>2019-05-16 18:40:07 +0200
commit205b580cbc61aaffc75ca6fece8b3d75751b1e28 (patch)
tree8d4859e4781a1a5ed1b183a56e12bd0c9f0caa08
parent3d640829af532856d193bc3a36baa66819b83637 (diff)
milton: added leds (nw)
-rw-r--r--src/mame/drivers/milton6805.cpp78
-rw-r--r--src/mame/layout/mchess.lay2
-rw-r--r--src/mame/layout/milton.lay4
3 files changed, 74 insertions, 10 deletions
diff --git a/src/mame/drivers/milton6805.cpp b/src/mame/drivers/milton6805.cpp
index 5c75ed68f99..d12a5b4ff58 100644
--- a/src/mame/drivers/milton6805.cpp
+++ b/src/mame/drivers/milton6805.cpp
@@ -15,9 +15,6 @@ Hardware is an odd combination: MC6805P2 MCU, GI SP0250 speech + 2*TMC0430 GROM.
See patent 4326710 for detailed information, except MC6805 clocked from SP0250 3.12MHz
and GROM clocked by 3.12MHz/8=390kHz.
-TODO:
-- 2 leds connected to audio out
-
******************************************************************************/
#include "emu.h"
@@ -30,8 +27,8 @@ TODO:
// internal artwork
#include "milton.lh" // clickable
+class milton_filter_device;
-namespace {
class milton_state : public driver_device
{
@@ -41,11 +38,14 @@ public:
m_maincpu(*this, "maincpu"),
m_grom(*this, "grom%u", 0),
m_speech(*this, "sp0250"),
+ m_filter(*this, "filter"),
m_inputs(*this, "IN.%u", 0)
{ }
void milton(machine_config &config);
+ DECLARE_INPUT_CHANGED_MEMBER(volume_changed);
+
protected:
virtual void machine_start() override;
@@ -53,6 +53,7 @@ private:
required_device<m6805_hmos_device> m_maincpu;
required_device_array<tmc0430_device, 2> m_grom;
required_device<sp0250_device> m_speech;
+ required_device<milton_filter_device> m_filter;
required_ioport_array<5> m_inputs;
u8 m_data;
@@ -77,6 +78,60 @@ void milton_state::machine_start()
}
+
+/******************************************************************************
+ LED Filter
+******************************************************************************/
+
+class milton_filter_device : public device_t, public device_sound_interface
+{
+public:
+ milton_filter_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+
+protected:
+ virtual void device_start() override;
+ virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+
+private:
+ sound_stream *m_stream;
+ output_finder<> m_led_out;
+};
+
+DEFINE_DEVICE_TYPE(MILTON_LED_FILTER, milton_filter_device, "milton_led_filter", "Milton LED Filter")
+
+
+milton_filter_device::milton_filter_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, MILTON_LED_FILTER, tag, owner, clock),
+ device_sound_interface(mconfig, *this),
+ m_led_out(*this, "led")
+{ }
+
+void milton_filter_device::device_start()
+{
+ m_stream = stream_alloc(1, 1, machine().sample_rate());
+ m_led_out.resolve();
+}
+
+void milton_filter_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+{
+ int level = 0;
+
+ for (int i = 0; i < samples; i++)
+ {
+ level += abs(inputs[0][i]);
+ outputs[0][i] = inputs[0][i];
+ }
+
+ if (samples > 0)
+ level /= samples;
+
+ // 2 leds connected to the audio circuit
+ const int threshold = 1500;
+ m_led_out = (level > threshold) ? 1 : 0;
+}
+
+
+
/******************************************************************************
I/O
******************************************************************************/
@@ -185,8 +240,18 @@ static INPUT_PORTS_START( milton )
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Yellow Button 5")
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_NAME("Yellow Button 6")
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_J) PORT_NAME("Yellow Button 7")
+
+ PORT_START("VOLUME")
+ PORT_CONFNAME( 0x01, 0x00, "Volume" ) PORT_CHANGED_MEMBER(DEVICE_SELF, milton_state, volume_changed, 0)
+ PORT_CONFSETTING( 0x01, "Low" )
+ PORT_CONFSETTING( 0x00, "High" )
INPUT_PORTS_END
+INPUT_CHANGED_MEMBER(milton_state::volume_changed)
+{
+ m_filter->set_output_gain(0, newval ? 0.25 : 1.0);
+}
+
/******************************************************************************
@@ -214,7 +279,8 @@ void milton_state::milton(machine_config &config)
/* sound hardware */
SPEAKER(config, "speaker").front_center();
- SP0250(config, m_speech, 3.12_MHz_XTAL).add_route(ALL_OUTPUTS, "speaker", 1.0);
+ SP0250(config, m_speech, 3.12_MHz_XTAL).add_route(0, m_filter, 1.0, 0);
+ MILTON_LED_FILTER(config, m_filter).add_route(0, "speaker", 1.0);
}
@@ -232,8 +298,6 @@ ROM_START( milton )
ROM_LOAD("4043-004", 0x2000, 0x1800, CRC(9ac929f7) SHA1(1a27d56fc49eb4e58ea3b5c58d7fbedc5a751592) )
ROM_END
-} // anonymous namespace
-
/******************************************************************************
diff --git a/src/mame/layout/mchess.lay b/src/mame/layout/mchess.lay
index a0e19824571..dc5911fe027 100644
--- a/src/mame/layout/mchess.lay
+++ b/src/mame/layout/mchess.lay
@@ -3,7 +3,7 @@
<!-- define elements -->
- <element name="white"><rect><color red="0.75" green="0.75" blue="0.77" /></rect></element>
+ <element name="white"><rect><color red="0.65" green="0.65" blue="0.65" /></rect></element>
<element name="blackb"><rect><color red="0" green="0" blue="0" /></rect></element>
<element name="cb_mask"><rect><color red="0.9" green="0.87" blue="0.9" /></rect></element>
<element name="cb_overlay"><rect><color red="0.65" green="0.70" blue="0.65" /></rect></element>
diff --git a/src/mame/layout/milton.lay b/src/mame/layout/milton.lay
index 6333d904428..7d5839977c4 100644
--- a/src/mame/layout/milton.lay
+++ b/src/mame/layout/milton.lay
@@ -41,8 +41,8 @@
</element>
<element name="led" defstate="0">
- <disk state="0"><color red="0.2" green="0.04" blue="0.05" /></disk>
- <disk state="1"><color red="1.0" green="0.2" blue="0.23" /></disk>
+ <disk state="0"><color red="0.2" green="0.02" blue="0.03" /></disk>
+ <disk state="1"><color red="1.0" green="0.1" blue="0.15" /></disk>
</element>