mirror of
https://github.com/holub/mame
synced 2025-07-03 09:06:08 +03:00
Partial netlist sound implementation for Mario Bros. Luigi sound is
missing. By default, the previous discrete.h based sound is compiled. Those curious can change OLD_SOUND to 0 in mario.h. [Couriersud]
This commit is contained in:
parent
18d5da6b0b
commit
49f121eae4
@ -2,7 +2,6 @@
|
|||||||
#include "cpu/z80/z80.h"
|
#include "cpu/z80/z80.h"
|
||||||
#include "cpu/mcs48/mcs48.h"
|
#include "cpu/mcs48/mcs48.h"
|
||||||
#include "sound/ay8910.h"
|
#include "sound/ay8910.h"
|
||||||
#include "sound/discrete.h"
|
|
||||||
|
|
||||||
#include "includes/mario.h"
|
#include "includes/mario.h"
|
||||||
|
|
||||||
@ -39,6 +38,252 @@
|
|||||||
#define I8035_P1_W_AH(M,B,D) I8035_P1_W(M,ACTIVEHIGH_PORT_BIT(I8035_P1_R(M),B,(D)))
|
#define I8035_P1_W_AH(M,B,D) I8035_P1_W(M,ACTIVEHIGH_PORT_BIT(I8035_P1_R(M),B,(D)))
|
||||||
#define I8035_P2_W_AH(M,B,D) I8035_P2_W(M,ACTIVEHIGH_PORT_BIT(I8035_P2_R(M),B,(D)))
|
#define I8035_P2_W_AH(M,B,D) I8035_P2_W(M,ACTIVEHIGH_PORT_BIT(I8035_P2_R(M),B,(D)))
|
||||||
|
|
||||||
|
|
||||||
|
#if !OLD_SOUND
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
/* mario sound */
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
static NETLIST_START(nl_mario_snd0)
|
||||||
|
|
||||||
|
RES(R17, RES_K(27)) /* 20 according to parts list */
|
||||||
|
/* 27 verified, 30K in schematics */
|
||||||
|
CAP(C14, CAP_U(4.7)) /* verified */
|
||||||
|
|
||||||
|
TTL_74123(2H_A)
|
||||||
|
NET_C(2H_A.VCC, V5)
|
||||||
|
NET_C(2H_A.GND, GND)
|
||||||
|
NET_C(SOUND0.Q, 2H_A.B)
|
||||||
|
NET_C(GND, 2H_A.A)
|
||||||
|
NET_C(2H_A.CLRQ, ttlhigh) /* NOT IN SCHEMATICS */
|
||||||
|
DIODE(D1, "1N4148") /* FIXME: try to identify */
|
||||||
|
TTL_7404_INVERT(1H_A, 2H_A.QQ)
|
||||||
|
NET_C(R17.1, V5)
|
||||||
|
NET_C(R17.2, D1.A, C14.1)
|
||||||
|
NET_C(D1.K, 2H_A.RC)
|
||||||
|
NET_C(C14.2, 2H_A.C)
|
||||||
|
|
||||||
|
RES(R6, RES_K(4.7)) /* verified */
|
||||||
|
CAP(C3, CAP_U(10)) /* verified */
|
||||||
|
|
||||||
|
NET_C(1H_A.Q, R6.1)
|
||||||
|
NET_C(R6.2, C3.1, 1J_A.FC)
|
||||||
|
NET_C(R6.2, 2J_A.FC)
|
||||||
|
NET_C(C3.2, GND)
|
||||||
|
|
||||||
|
//#define MR_C6 CAP_N(3.9) /* verified */
|
||||||
|
|
||||||
|
SN74LS629(1J_A, CAP_N(3.9))
|
||||||
|
NET_C(1J_A.RNG, V5)
|
||||||
|
NET_C(1J_A.ENQ, ttllow)
|
||||||
|
NET_C(GND, 1J_A.GND)
|
||||||
|
|
||||||
|
//#define MR_C17 CAP_N(22) /* verified */
|
||||||
|
|
||||||
|
SN74LS629(2J_A, CAP_N(22))
|
||||||
|
NET_C(2J_A.RNG, V5)
|
||||||
|
NET_C(2J_A.ENQ, ttllow)
|
||||||
|
NET_C(GND, 2J_A.GND)
|
||||||
|
|
||||||
|
TTL_7486_XOR(1K_A, 1J_A.Y, 2J_A.Y)
|
||||||
|
TTL_7408_AND(2K_A, 2H_A.Q, 1K_A)
|
||||||
|
NETLIST_END()
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
/* skid sound */
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
// FIXME: Diodes are 1S953
|
||||||
|
static NETLIST_START(nl_mario_snd7)
|
||||||
|
|
||||||
|
RES(R61, RES_K(47))
|
||||||
|
CAP(C41, CAP_U(4.7)) /* verified */
|
||||||
|
|
||||||
|
TTL_74123(4L_A)
|
||||||
|
NET_C(4L_A.VCC, V5)
|
||||||
|
NET_C(4L_A.GND, GND)
|
||||||
|
NET_C(SOUND7.Q, 4L_A.B)
|
||||||
|
NET_C(GND, 4L_A.A)
|
||||||
|
NET_C(4L_A.CLRQ, ttlhigh) /* NOT IN SCHEMATICS */
|
||||||
|
DIODE(D10, "1N4148") /* FIXME: try to identify */
|
||||||
|
TTL_7404_INVERT(4J_A, 4L_A.Q)
|
||||||
|
NET_C(R61.1, V5)
|
||||||
|
NET_C(R61.2, D10.A, C41.1)
|
||||||
|
NET_C(D10.K, 4L_A.RC)
|
||||||
|
NET_C(C41.2, 4L_A.C)
|
||||||
|
|
||||||
|
RES(R65, RES_K(10))
|
||||||
|
CAP(C44, CAP_U(3.3)) /* verified */
|
||||||
|
|
||||||
|
SN74LS629(4K_A, CAP_U(0.022))
|
||||||
|
NET_C(4K_A.RNG, V5)
|
||||||
|
NET_C(4K_A.ENQ, ttllow)
|
||||||
|
NET_C(GND, 4K_A.GND)
|
||||||
|
NET_C(R65.1, 4J_A.Q)
|
||||||
|
NET_C(R65.2, 4K_A.FC, C44.1)
|
||||||
|
NET_C(C44.2, GND)
|
||||||
|
|
||||||
|
CD_4020(3H, 4K_B.Y, ttllow, V5, GND)
|
||||||
|
TTL_7404_INVERT(4J_B, 3H.Q12)
|
||||||
|
|
||||||
|
RES(R64, RES_K(20))
|
||||||
|
CAP(C43, CAP_U(3.3)) /* verified */
|
||||||
|
|
||||||
|
SN74LS629(4K_B, CAP_U(0.0047))
|
||||||
|
NET_C(4K_B.RNG, V5)
|
||||||
|
NET_C(4K_B.ENQ, ttllow)
|
||||||
|
NET_C(GND, 4K_B.GND)
|
||||||
|
NET_C(R64.1, 4J_B.Q)
|
||||||
|
NET_C(R64.2, 4K_B.FC, C43.1)
|
||||||
|
NET_C(C43.2, GND)
|
||||||
|
|
||||||
|
TTL_7486_XOR(1K_C, 3H.Q4, 4K_A.Y)
|
||||||
|
TTL_7408_AND(2K_C, 4L_A.Q, 1K_C)
|
||||||
|
|
||||||
|
NETLIST_END()
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
/* DAC sound */
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
static NETLIST_START(nl_mario_dac)
|
||||||
|
RES(R34, RES_M(2))
|
||||||
|
RES(R35, RES_M(1))
|
||||||
|
RES(R36, RES_M(1.8))
|
||||||
|
LM3900(3M_1)
|
||||||
|
NET_C(3M_1.VM, GND)
|
||||||
|
NET_C(3M_1.VP, V5)
|
||||||
|
|
||||||
|
NET_C(DAC.VOUT, R34.1)
|
||||||
|
NET_C(3M_1.MINUS, R34.2, R35.2)
|
||||||
|
NET_C(3M_1.OUT, R35.1)
|
||||||
|
NET_C(3M_1.PLUS, R36.1)
|
||||||
|
NET_C(R36.2, GND)
|
||||||
|
|
||||||
|
RES(R21, RES_M(1.8))
|
||||||
|
RES(R23, RES_K(10))
|
||||||
|
RES(R25, RES_K(10))
|
||||||
|
RES(R37, RES_K(750))
|
||||||
|
RES(R38, RES_K(360))
|
||||||
|
RES(R39, RES_K(750))
|
||||||
|
|
||||||
|
CAP(C18, CAP_P(100))
|
||||||
|
CAP(C19, CAP_U(10))
|
||||||
|
CAP(C20, CAP_U(1))
|
||||||
|
CAP(C30, CAP_P(100))
|
||||||
|
|
||||||
|
LM3900(3M_2)
|
||||||
|
NET_C(3M_2.VM, GND)
|
||||||
|
NET_C(3M_2.VP, V5)
|
||||||
|
|
||||||
|
NET_C(R35.1, C20.1)
|
||||||
|
NET_C(C20.2, R37.1)
|
||||||
|
NET_C(R37.2, R38.2, C18.1, R39.2)
|
||||||
|
|
||||||
|
NET_C(C18.2, GND)
|
||||||
|
NET_C(R38.1, C30.2, 3M_2.MINUS)
|
||||||
|
NET_C(3M_2.OUT, R39.1, C30.1)
|
||||||
|
|
||||||
|
NET_C(R21.1, 3M_2.PLUS)
|
||||||
|
NET_C(R21.2, C19.1, R25.2, R23.1)
|
||||||
|
NET_C(C19.2, R23.2, GND)
|
||||||
|
NET_C(R25.1, V5)
|
||||||
|
NETLIST_END()
|
||||||
|
|
||||||
|
static NETLIST_START(nl_mario)
|
||||||
|
|
||||||
|
/* Standard stuff */
|
||||||
|
|
||||||
|
SOLVER(Solver, 48000)
|
||||||
|
PARAM(Solver.ACCURACY, 1e-8)
|
||||||
|
PARAM(Solver.SOR_FACTOR, 1.0)
|
||||||
|
PARAM(Solver.GS_THRESHOLD, 5)
|
||||||
|
PARAM(Solver.GS_LOOPS, 4)
|
||||||
|
//PARAM(Solver.LTE, 5e-2) // Default is not enough for paddle control
|
||||||
|
PARAM(Solver.DYNAMIC_TS, 0)
|
||||||
|
ANALOG_INPUT(V5, 5)
|
||||||
|
|
||||||
|
TTL_INPUT(SOUND0, 1)
|
||||||
|
INCLUDE(nl_mario_snd0)
|
||||||
|
|
||||||
|
TTL_INPUT(SOUND7, 1)
|
||||||
|
INCLUDE(nl_mario_snd7)
|
||||||
|
|
||||||
|
R2R_DAC(DAC, 3.4, 10000.0, 8)
|
||||||
|
NET_C(DAC.VGND, GND)
|
||||||
|
|
||||||
|
INCLUDE(nl_mario_dac)
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
/* mixing */
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
RES(R20, RES_K(22)) /* verified */
|
||||||
|
RES(R19, RES_K(22)) /* verified */
|
||||||
|
RES(R40, RES_K(22)) /* verified */
|
||||||
|
RES(R41, RES_K(100)) /* verified */
|
||||||
|
CAP(C31, CAP_U(0.022)) /* */
|
||||||
|
|
||||||
|
NET_C(2K_A.Q, R20.1)
|
||||||
|
NET_C(GND, R19.1) //FIXME
|
||||||
|
NET_C(2K_C.Q, R41.1)
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
RES(DUM, RES_K(22))
|
||||||
|
NET_C(R39.1, DUM.1)
|
||||||
|
NET_C(DUM.2, GND)
|
||||||
|
FRONTIER(front1, R39.1, R40.1)
|
||||||
|
#else
|
||||||
|
NET_C(R39.1, R40.1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NET_C(R20.2, R19.2, R40.2, R41.2, C31.1)
|
||||||
|
NET_C(C31.2, GND)
|
||||||
|
|
||||||
|
CAP(C32, CAP_U(1)) /* verified */
|
||||||
|
RES(R42, RES_K(43)) /* verified */
|
||||||
|
RES(R43, RES_K(100)) /* verified */
|
||||||
|
|
||||||
|
NET_C(C31.1, C32.1)
|
||||||
|
NET_C(C32.2, R42.1, R43.2, Q10.B)
|
||||||
|
//NET_C(C32.2, R42.1, R43.2)
|
||||||
|
NET_C(R43.1, V5)
|
||||||
|
NET_C(R42.2, GND)
|
||||||
|
#if 1
|
||||||
|
RES(R63, RES_K(1)) /* */
|
||||||
|
RES(R62, 150) /* */
|
||||||
|
|
||||||
|
QBJT_EB(Q10, "2SC1815")
|
||||||
|
|
||||||
|
NET_C(R62.2, GND)
|
||||||
|
NET_C(R62.1, Q10.E)
|
||||||
|
|
||||||
|
NET_C(R63.1, V5)
|
||||||
|
NET_C(R63.2, Q10.C)
|
||||||
|
|
||||||
|
CAP(C42, CAP_U(0.1))
|
||||||
|
CAP(C47, CAP_U(4.7))
|
||||||
|
RES(VR1, RES_K(10))
|
||||||
|
|
||||||
|
NET_C(C42.1, C47.1, R62.1)
|
||||||
|
NET_C(C42.2, GND)
|
||||||
|
NET_C(C47.2, VR1.1)
|
||||||
|
NET_C(VR1.2, GND)
|
||||||
|
#endif
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
/* Output */
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
RES(ROUT, 1000000)
|
||||||
|
|
||||||
|
//NET_C(Q10.C, ROUT.1)
|
||||||
|
//NET_C(R43.2, ROUT.1)
|
||||||
|
NET_C(VR1.1, ROUT.1)
|
||||||
|
|
||||||
|
NET_C(GND, ROUT.2)
|
||||||
|
|
||||||
|
NETLIST_END()
|
||||||
|
|
||||||
|
#else
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
*
|
*
|
||||||
* Discrete Sound defines
|
* Discrete Sound defines
|
||||||
@ -390,7 +635,7 @@ static DISCRETE_SOUND_START(mario)
|
|||||||
DISCRETE_TASK_END()
|
DISCRETE_TASK_END()
|
||||||
|
|
||||||
DISCRETE_SOUND_END
|
DISCRETE_SOUND_END
|
||||||
|
#endif
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
*
|
*
|
||||||
* EA / Banking
|
* EA / Banking
|
||||||
@ -498,7 +743,11 @@ READ8_MEMBER(mario_state::mario_sh_tune_r)
|
|||||||
|
|
||||||
WRITE8_MEMBER(mario_state::mario_sh_sound_w)
|
WRITE8_MEMBER(mario_state::mario_sh_sound_w)
|
||||||
{
|
{
|
||||||
|
#if OLD_SOUND
|
||||||
m_discrete->write(space, DS_DAC, data);
|
m_discrete->write(space, DS_DAC, data);
|
||||||
|
#else
|
||||||
|
m_audio_dac->write(data);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_MEMBER(mario_state::mario_sh_p1_w)
|
WRITE8_MEMBER(mario_state::mario_sh_p1_w)
|
||||||
@ -538,13 +787,19 @@ WRITE8_MEMBER(mario_state::mario_sh_tuneselect_w)
|
|||||||
/* Mario running sample */
|
/* Mario running sample */
|
||||||
WRITE8_MEMBER(mario_state::mario_sh1_w)
|
WRITE8_MEMBER(mario_state::mario_sh1_w)
|
||||||
{
|
{
|
||||||
|
#if OLD_SOUND
|
||||||
m_discrete->write(space, DS_SOUND0_INP, 0);
|
m_discrete->write(space, DS_SOUND0_INP, 0);
|
||||||
|
#else
|
||||||
|
m_audio_snd0->write(data);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Luigi running sample */
|
/* Luigi running sample */
|
||||||
WRITE8_MEMBER(mario_state::mario_sh2_w)
|
WRITE8_MEMBER(mario_state::mario_sh2_w)
|
||||||
{
|
{
|
||||||
|
#if OLD_SOUND
|
||||||
m_discrete->write(space, DS_SOUND1_INP, 0);
|
m_discrete->write(space, DS_SOUND1_INP, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Misc samples */
|
/* Misc samples */
|
||||||
@ -577,7 +832,11 @@ WRITE8_MEMBER(mario_state::mario_sh3_w)
|
|||||||
I8035_P1_W_AH(space, 3, data & 1);
|
I8035_P1_W_AH(space, 3, data & 1);
|
||||||
break;
|
break;
|
||||||
case 7: /* skid */
|
case 7: /* skid */
|
||||||
|
#if OLD_SOUND
|
||||||
machine().device<discrete_device>("discrete")->write(space, DS_SOUND7_INP, data & 1);
|
machine().device<discrete_device>("discrete")->write(space, DS_SOUND7_INP, data & 1);
|
||||||
|
#else
|
||||||
|
m_audio_snd7->write((data & 1) ^ 1);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -626,9 +885,23 @@ MACHINE_CONFIG_FRAGMENT( mario_audio )
|
|||||||
MCFG_CPU_IO_MAP(mario_sound_io_map)
|
MCFG_CPU_IO_MAP(mario_sound_io_map)
|
||||||
|
|
||||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||||
|
|
||||||
|
#if OLD_SOUND
|
||||||
MCFG_SOUND_ADD("discrete", DISCRETE, 0)
|
MCFG_SOUND_ADD("discrete", DISCRETE, 0)
|
||||||
MCFG_DISCRETE_INTF(mario)
|
MCFG_DISCRETE_INTF(mario)
|
||||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1)
|
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1)
|
||||||
|
#else
|
||||||
|
MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000)
|
||||||
|
MCFG_NETLIST_SETUP(nl_mario)
|
||||||
|
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||||
|
|
||||||
|
MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd0", "SOUND0.IN", 0, 1)
|
||||||
|
MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd7", "SOUND7.IN", 0, 1)
|
||||||
|
MCFG_NETLIST_LOGIC_INPUT("snd_nl", "dac", "DAC.VAL", 0, 255)
|
||||||
|
|
||||||
|
MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "ROUT.1")
|
||||||
|
MCFG_NETLIST_ANALOG_MULT_OFFSET(150000.0, 0.0)
|
||||||
|
#endif
|
||||||
|
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
#ifndef MARIO_H_
|
#ifndef MARIO_H_
|
||||||
#define MARIO_H_
|
#define MARIO_H_
|
||||||
|
|
||||||
#include "sound/discrete.h"
|
|
||||||
#include "machine/z80dma.h"
|
#include "machine/z80dma.h"
|
||||||
|
|
||||||
|
#define OLD_SOUND (1)
|
||||||
|
|
||||||
|
#if !OLD_SOUND
|
||||||
|
#include "machine/netlist.h"
|
||||||
|
#include "netlist/devices/net_lib.h"
|
||||||
|
#else
|
||||||
|
#include "sound/discrete.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* From the schematics:
|
* From the schematics:
|
||||||
*
|
*
|
||||||
@ -42,7 +50,13 @@ public:
|
|||||||
m_gfxdecode(*this, "gfxdecode"),
|
m_gfxdecode(*this, "gfxdecode"),
|
||||||
m_palette(*this, "palette"),
|
m_palette(*this, "palette"),
|
||||||
m_z80dma(*this, "z80dma"),
|
m_z80dma(*this, "z80dma"),
|
||||||
|
#if OLD_SOUND
|
||||||
m_discrete(*this, "discrete"),
|
m_discrete(*this, "discrete"),
|
||||||
|
#else
|
||||||
|
m_audio_snd0(*this, "snd_nl:snd0"),
|
||||||
|
m_audio_snd7(*this, "snd_nl:snd7"),
|
||||||
|
m_audio_dac(*this, "snd_nl:dac"),
|
||||||
|
#endif
|
||||||
m_spriteram(*this, "spriteram"),
|
m_spriteram(*this, "spriteram"),
|
||||||
m_videoram(*this, "videoram"),
|
m_videoram(*this, "videoram"),
|
||||||
m_monitor(0) { }
|
m_monitor(0) { }
|
||||||
@ -53,7 +67,13 @@ public:
|
|||||||
required_device<gfxdecode_device> m_gfxdecode;
|
required_device<gfxdecode_device> m_gfxdecode;
|
||||||
required_device<palette_device> m_palette;
|
required_device<palette_device> m_palette;
|
||||||
optional_device<z80dma_device> m_z80dma;
|
optional_device<z80dma_device> m_z80dma;
|
||||||
|
#if OLD_SOUND
|
||||||
optional_device<discrete_device> m_discrete;
|
optional_device<discrete_device> m_discrete;
|
||||||
|
#else
|
||||||
|
optional_device<netlist_mame_logic_input_t> m_audio_snd0;
|
||||||
|
optional_device<netlist_mame_logic_input_t> m_audio_snd7;
|
||||||
|
optional_device<netlist_mame_logic_input_t> m_audio_dac;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* memory pointers */
|
/* memory pointers */
|
||||||
required_shared_ptr<UINT8> m_spriteram;
|
required_shared_ptr<UINT8> m_spriteram;
|
||||||
|
Loading…
Reference in New Issue
Block a user