summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2019-03-16 19:07:24 +0100
committer couriersud <couriersud@gmx.org>2019-03-16 19:07:33 +0100
commita5d6b7c5b8590d37737803c052a0edf8283769fc (patch)
tree340dbd4932cd0a22deeaac2d35ac0d29e9105883
parentbfd8b4108a208566b1b171639f2f319ec4452915 (diff)
gamemachine: add netlist audio. [Couriersud]
-rw-r--r--scripts/target/mame/nl.lua7
-rw-r--r--src/lib/netlist/macro/nlm_base.cpp2
-rw-r--r--src/mame/drivers/gamemachine.cpp150
-rw-r--r--src/mame/nl.lst3
4 files changed, 146 insertions, 16 deletions
diff --git a/scripts/target/mame/nl.lua b/scripts/target/mame/nl.lua
index d5d82b4b04f..48375dfe2ca 100644
--- a/scripts/target/mame/nl.lua
+++ b/scripts/target/mame/nl.lua
@@ -29,6 +29,7 @@ CPUS["I8085"] = true
--CPUS["M680X0"] = true
--CPUS["TMS9900"] = true
--CPUS["COP400"] = true
+CPUS["F8"] = true
--------------------------------------------------
-- Specify all the sound cores necessary for the
@@ -47,7 +48,9 @@ SOUNDS["TMS5220"] = true
--SOUNDS["YM3812"] = true
--SOUNDS["CEM3394"] = true
--SOUNDS["VOTRAX"] = true
+SOUNDS["BEEP"] = true
SOUNDS["VOLT_REG"] = true
+SOUNDS["SPEAKER"] = true
--------------------------------------------------
-- specify available video cores
@@ -84,7 +87,7 @@ MACHINES["EEPROMDEV"] = true
--MACHINES["Z80CTC"] = true
--MACHINES["68681"] = true
--MACHINES["BANKDEV"] = true
-
+MACHINES["F3853"] = true
--------------------------------------------------
-- specify available bus cores
@@ -149,6 +152,8 @@ files{
MAME_DIR .. "src/mame/includes/1942.h",
MAME_DIR .. "src/mame/video/1942.cpp",
+ MAME_DIR .. "src/mame/drivers/gamemachine.cpp",
+
MAME_DIR .. "src/mame/drivers/popeye.cpp",
MAME_DIR .. "src/mame/includes/popeye.h",
MAME_DIR .. "src/mame/video/popeye.cpp",
diff --git a/src/lib/netlist/macro/nlm_base.cpp b/src/lib/netlist/macro/nlm_base.cpp
index 4c823157680..86f5a2f941c 100644
--- a/src/lib/netlist/macro/nlm_base.cpp
+++ b/src/lib/netlist/macro/nlm_base.cpp
@@ -51,6 +51,8 @@ static NETLIST_START(bjt_models)
NET_MODEL("BC556B PNP(IS=3.83E-14 NF=1.008 ISE=1.22E-14 NE=1.528 BF=344.4 IKF=0.08039 VAF=21.11 NR=1.005 ISC=2.85E-13 NC=1.28 BR=14.84 IKR=0.047 VAR=32.02 RB=1 IRB=1.00E-06 RBM=1 RE=0.6202 RC=0.5713 XTB=0 EG=1.11 XTI=3 CJE=1.23E-11 VJE=0.6106 MJE=0.378 TF=5.60E-10 XTF=3.414 VTF=5.23 ITF=0.1483 PTF=0 CJC=1.08E-11 VJC=0.1022 MJC=0.3563 XCJC=0.6288 TR=1.00E-32 CJS=0 VJS=0.75 MJS=0.333 FC=0.8027 Vceo=65 Icrating=100m mfg=Philips)")
NET_MODEL("BC548C NPN(IS=1.95E-14 ISE=1.31E-15 ISC=1.0E-13 XTI=3 BF=466 BR=2.42 IKF=0.18 IKR=1 XTB=1.5 VAF=91.7 VAR=24.7 VJE=0.632 VJC=0.339 RE=1 RC=1.73 RB=26.5 RBM=10 IRB=10 CJE=1.33E-11 CJC=5.17E-12 XCJC=1 FC=0.9 NF=0.993 NR=1.2 NE=1.32 NC=2.00 MJE=0.326 MJC=0.319 TF=6.52E-10 TR=0 PTF=0 ITF=1.03 VTF=1.65 XTF=100 EG=1.11 KF=1E-9 AF=1 VCEO=40 ICrating=800M MFG=Siemens)")
NET_MODEL("BC817-25 NPN(IS=9.198E-14 NF=1.003 ISE=4.468E-16 NE=1.65 BF=338.8 IKF=0.4913 VAF=107.9 NR=1.002 ISC=5.109E-15 NC=1.071 BR=29.48 IKR=0.193 VAR=25 RB=1 IRB=1000 RBM=1 RE=0.2126 RC=0.143 XTB=0 EG=1.11 XTI=3 CJE=3.825E-11 VJE=0.7004 MJE=0.364 TF=5.229E-10 XTF=219.7 VTF=3.502 ITF=7.257 PTF=0 CJC=1.27E-11 VJC=0.4431 MJC=0.3983 XCJC=0.4555 TR=7E-11 CJS=0 VJS=0.75 MJS=0.333 FC=0.905 Vceo=45 Icrating=500m mfg=Philips)")
+
+ NET_MODEL("9013 NPN(IS=3.40675E-14 BF=166 VAF=67 IKF=1.164 ISE=12.37e-15 NE=2 BR=15.17 VAR=40.84 IKR=0.261352 ISC=1.905E-15 NC=1.066 RB=63.2 IRB=5.62E-6 RBM=22.1 RE=0.02 RC=0.7426 CJE=3.53E-11 VJE=0.808 MJE=0.372 CJC=1.74E-11 VJC=0.614 MJC=0.388 XCJC=0.349 XTB=1.4025 EG=1.0999 XTI=3 VC=0.5 VCEO=20)")
NETLIST_END()
/* ----------------------------------------------------------------------------
diff --git a/src/mame/drivers/gamemachine.cpp b/src/mame/drivers/gamemachine.cpp
index 5a06a242196..f41ef738e1a 100644
--- a/src/mame/drivers/gamemachine.cpp
+++ b/src/mame/drivers/gamemachine.cpp
@@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:hap
-// thanks-to:Sean Riddle
+// thanks-to:Sean Riddle, Couriersud
/******************************************************************************
Waddingtons 2001: The Game Machine
@@ -27,7 +27,6 @@ hardware notes:
http://seanriddle.com/gamemachineaudio.JPG
TODO:
-- discrete sound, currently it's emulated crudely, just enough to make it beep when supposed to
- MCU frequency was measured approx 2.1MHz on its XTL2 pin, but considering that
the MK3870 has an internal /2 divider, this is way too slow when compared to
video references of the game
@@ -40,9 +39,90 @@ TODO:
#include "machine/timer.h"
#include "sound/beep.h"
#include "speaker.h"
+#include "machine/netlist.h"
+#include "netlist/devices/net_lib.h"
#include "tgm.lh"
+/*
+ * Netlist below provided under Creative Commons CC0
+ */
+
+static NETLIST_START(nl_gamemachine)
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 480000)
+ PARAM(Solver.ACCURACY, 1e-7)
+ ANALOG_INPUT(V5, 5)
+
+ /* Schematics: http://seanriddle.com/gamemachineaudio.JPG
+ *
+ * 3870 datasheet: http://nice.kaze.com/MK3870.pdf
+ *
+ * The 3870 has mask-programmable outputs (page VIII-7 in datasheet).
+ *
+ * Given the schematics, in this case the OPENDRAIN configuration is the
+ * most probable.
+ *
+ */
+
+ NET_MODEL("OPENDRAIN FAMILY(OVL=0.05 OVH=0.05 ORL=1.0 ORH=1e10)")
+ NET_MODEL("TYPE6K FAMILY(OVL=0.05 OVH=4.95 ORL=1.0 ORH=6000)")
+ NET_MODEL("DIRECTDRIVE FAMILY(OVL=0.05 OVH=4.95 ORL=1.0 ORH=1000)")
+
+ LOGIC_INPUT(P08, 1, "OPENDRAIN")
+ LOGIC_INPUT(P09, 1, "OPENDRAIN")
+ LOGIC_INPUT(P10, 1, "OPENDRAIN")
+ LOGIC_INPUT(P11, 1, "OPENDRAIN")
+ LOGIC_INPUT(P12, 1, "OPENDRAIN")
+ LOGIC_INPUT(P13, 1, "OPENDRAIN")
+ LOGIC_INPUT(P14, 1, "OPENDRAIN")
+ LOGIC_INPUT(P15, 1, "OPENDRAIN")
+
+ RES(R1, RES_K(2.4))
+ RES(R2, RES_K(10))
+ RES(R3, RES_K(4.3))
+ RES(R4, RES_K(150))
+ RES(R5, RES_K(240))
+ RES(R6, RES_K(2.4))
+ RES(SPK1, 8)
+
+ CAP(C1, CAP_P(50))
+ CAP(C2, CAP_U(0.001))
+ CAP(C3, CAP_U(0.002)) // Schematics state this as 2pF, doesn't make sense, this looks like a ladder layout
+ CAP(C4, CAP_U(0.005))
+ CAP(C5, CAP_U(0.010))
+ CAP(C6, CAP_P(50))
+ CAP(C7, CAP_U(0.01))
+ CAP(C8, CAP_U(470))
+
+ QBJT_EB(Q1, "9013")
+
+ NE555_DIP(IC1)
+
+ NET_C(P08.Q, R2.2, IC1.4)
+ NET_C(P09.Q, C8.2)
+ NET_C(P15.Q, R1.2)
+
+ NET_C(C1.1, P10.Q)
+ NET_C(C2.1, P11.Q)
+ NET_C(C3.1, P12.Q)
+ NET_C(C4.1, P13.Q)
+ NET_C(C5.1, P14.Q)
+
+ NET_C(C1.2, C2.2, C3.2, C4.2, C5.2, C6.2, IC1.2, IC1.6, R5.2)
+ NET_C(GND, C6.1, IC1.1, Q1.E)
+ NET_C(R5.1, R4.2, IC1.7)
+ NET_C(V5, R4.1, R2.1, IC1.8, SPK1.1, R3.1)
+
+ NET_C(C7.1, R6.1, IC1.3)
+ NET_C(C7.2, R6.2, Q1.B)
+ NET_C(Q1.C, SPK1.2)
+
+ NET_C(C8.1, R1.1, R3.2, IC1.5)
+
+NETLIST_END()
namespace {
@@ -52,10 +132,21 @@ public:
tgm_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_beeper(*this, "beeper"),
+ m_audio_p08(*this, "snd_nl:p08"),
+ m_audio_p09(*this, "snd_nl:p09"),
+ m_audio_p10(*this, "snd_nl:p10"),
+ m_audio_p11(*this, "snd_nl:p11"),
+ m_audio_p12(*this, "snd_nl:p12"),
+ m_audio_p13(*this, "snd_nl:p13"),
+ m_audio_p14(*this, "snd_nl:p14"),
+ m_audio_p15(*this, "snd_nl:p15"),
m_keypad(*this, "IN.%u", 0),
m_delay_display(*this, "delay_display_%u", 0),
- m_out_digit(*this, "digit%u", 0U)
+ m_out_digit(*this, "digit%u", 0U),
+ m_inp_mux(0),
+ m_digit_select(0),
+ m_digit_data(0)
+
{ }
void tgm(machine_config &config);
@@ -66,7 +157,15 @@ protected:
private:
// devices/pointers
required_device<cpu_device> m_maincpu;
- required_device<beep_device> m_beeper;
+ required_device<netlist_mame_logic_input_device> m_audio_p08;
+ required_device<netlist_mame_logic_input_device> m_audio_p09;
+ required_device<netlist_mame_logic_input_device> m_audio_p10;
+ required_device<netlist_mame_logic_input_device> m_audio_p11;
+ required_device<netlist_mame_logic_input_device> m_audio_p12;
+ required_device<netlist_mame_logic_input_device> m_audio_p13;
+ required_device<netlist_mame_logic_input_device> m_audio_p14;
+ required_device<netlist_mame_logic_input_device> m_audio_p15;
+
required_ioport_array<10> m_keypad;
required_device_array<timer_device, 12> m_delay_display;
output_finder<12> m_out_digit;
@@ -180,16 +279,22 @@ READ8_MEMBER(tgm_state::input_r)
WRITE8_MEMBER(tgm_state::sound_w)
{
- // P40: 555 reset
- m_beeper->set_state(~data & 1);
- // P42-P46: through caps, then 555 trigger/treshold
- u8 pitch = 0x20 - bitswap<5>(data,6,5,2,3,4);
- m_beeper->set_clock(64 * pitch);
-
- // P41: polarized cap, then 555 ctrl
- // P47: resistor, then 555 ctrl
- //..
+ m_audio_p08->write_line(data & 0x01 ? 0 : 1);
+ m_audio_p09->write_line(data & 0x02 ? 0 : 1);
+ m_audio_p10->write_line(data & 0x04 ? 0 : 1);
+ m_audio_p11->write_line(data & 0x08 ? 0 : 1);
+ m_audio_p12->write_line(data & 0x10 ? 0 : 1);
+ m_audio_p13->write_line(data & 0x20 ? 0 : 1);
+ m_audio_p14->write_line(data & 0x40 ? 0 : 1);
+ m_audio_p15->write_line(data & 0x80 ? 0 : 1);
+
+#if 0
+ static int last = 0;
+ if (data != last)
+ printf("Data: 0x%03x\n", data);
+ last = data;
+#endif
}
@@ -284,7 +389,22 @@ void tgm_state::tgm(machine_config &config)
/* sound hardware */
SPEAKER(config, "speaker").front_center();
- BEEP(config, m_beeper, 0).add_route(ALL_OUTPUTS, "speaker", 0.25);
+ netlist_mame_sound_device &snd_nl(NETLIST_SOUND(config, "snd_nl", 48000));
+
+ snd_nl.set_constructor(netlist_nl_gamemachine);
+ snd_nl.add_route(ALL_OUTPUTS, "speaker", 1.0);
+
+ NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "SPK1.2").set_mult_offset(-10000.0, 10000.0 * 3.75);
+
+ NETLIST_LOGIC_INPUT(config, "snd_nl:p08", "P08.IN", 0);
+ NETLIST_LOGIC_INPUT(config, "snd_nl:p09", "P09.IN", 0);
+ NETLIST_LOGIC_INPUT(config, "snd_nl:p10", "P10.IN", 0);
+ NETLIST_LOGIC_INPUT(config, "snd_nl:p11", "P11.IN", 0);
+ NETLIST_LOGIC_INPUT(config, "snd_nl:p12", "P12.IN", 0);
+ NETLIST_LOGIC_INPUT(config, "snd_nl:p13", "P13.IN", 0);
+ NETLIST_LOGIC_INPUT(config, "snd_nl:p14", "P14.IN", 0);
+ NETLIST_LOGIC_INPUT(config, "snd_nl:p15", "P15.IN", 0);
+
}
diff --git a/src/mame/nl.lst b/src/mame/nl.lst
index f646ca9ee7a..63b48cbd058 100644
--- a/src/mame/nl.lst
+++ b/src/mame/nl.lst
@@ -20,6 +20,9 @@
1942p // prototype
1942h // hack (Two Bit Score?)
+@source:gamemachine.cpp
+2001tgm //
+
// hazeltin.cpp
hazl1500 // Hazeltine 1500 (c) 1977