mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
Merge pull request #193 from superctr/master
Add configurable clock dividers for Namco C352 [superctr]
This commit is contained in:
commit
83e407f7bb
@ -45,6 +45,17 @@ c352_device::c352_device(const machine_config &mconfig, const char *tag, device_
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// static_set_dividder - configuration helper to
|
||||||
|
// set the divider setting
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void c352_device::static_set_divider(device_t &device, int setting)
|
||||||
|
{
|
||||||
|
c352_device &c352 = downcast<c352_device &>(device);
|
||||||
|
c352.m_divider = setting;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// memory_space_config - return a description of
|
// memory_space_config - return a description of
|
||||||
// any address spaces owned by this device
|
// any address spaces owned by this device
|
||||||
@ -457,7 +468,7 @@ void c352_device::write_reg16(unsigned long address, unsigned short val)
|
|||||||
|
|
||||||
void c352_device::device_start()
|
void c352_device::device_start()
|
||||||
{
|
{
|
||||||
int i;
|
int i, divider;
|
||||||
double x_max = 32752.0;
|
double x_max = 32752.0;
|
||||||
double y_max = 127.0;
|
double y_max = 127.0;
|
||||||
double u = 10.0;
|
double u = 10.0;
|
||||||
@ -465,7 +476,21 @@ void c352_device::device_start()
|
|||||||
// find our direct access
|
// find our direct access
|
||||||
m_direct = &space().direct();
|
m_direct = &space().direct();
|
||||||
|
|
||||||
m_sample_rate_base = clock() / 288;
|
switch(m_divider)
|
||||||
|
{
|
||||||
|
case C352_DIVIDER_228:
|
||||||
|
divider=228;
|
||||||
|
break;
|
||||||
|
case C352_DIVIDER_288:
|
||||||
|
default:
|
||||||
|
divider=288;
|
||||||
|
break;
|
||||||
|
case C352_DIVIDER_332:
|
||||||
|
divider=332;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sample_rate_base = clock() / divider;
|
||||||
|
|
||||||
m_stream = machine().sound().stream_alloc(*this, 0, 4, m_sample_rate_base);
|
m_stream = machine().sound().stream_alloc(*this, 0, 4, m_sample_rate_base);
|
||||||
|
|
||||||
|
@ -5,13 +5,28 @@
|
|||||||
#ifndef __C352_H__
|
#ifndef __C352_H__
|
||||||
#define __C352_H__
|
#define __C352_H__
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// CONSTANTS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
C352_DIVIDER_228 = 0,
|
||||||
|
C352_DIVIDER_288 = 1,
|
||||||
|
C352_DIVIDER_332 = 2
|
||||||
|
};
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// INTERFACE CONFIGURATION MACROS
|
// INTERFACE CONFIGURATION MACROS
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
#define MCFG_C352_ADD(_tag, _clock) \
|
#define MCFG_C352_ADD(_tag, _clock, _setting) \
|
||||||
MCFG_DEVICE_ADD(_tag, C352, _clock)
|
MCFG_DEVICE_ADD(_tag, C352, _clock) \
|
||||||
|
MCFG_C352_DIVIDER(_setting)
|
||||||
|
|
||||||
|
#define MCFG_C352_DIVIDER(_setting) \
|
||||||
|
c352_device::static_set_divider(*device, _setting);
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// TYPE DEFINITIONS
|
// TYPE DEFINITIONS
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
@ -26,6 +41,9 @@ public:
|
|||||||
// construction/destruction
|
// construction/destruction
|
||||||
c352_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
c352_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||||
|
|
||||||
|
// inline configuration helpers
|
||||||
|
static void static_set_divider(device_t &device, int setting);
|
||||||
|
|
||||||
DECLARE_READ16_MEMBER(read);
|
DECLARE_READ16_MEMBER(read);
|
||||||
DECLARE_WRITE16_MEMBER(write);
|
DECLARE_WRITE16_MEMBER(write);
|
||||||
|
|
||||||
@ -89,7 +107,8 @@ private:
|
|||||||
|
|
||||||
c352_ch_t m_c352_ch[32];
|
c352_ch_t m_c352_ch[32];
|
||||||
int m_sample_rate_base;
|
int m_sample_rate_base;
|
||||||
|
int m_divider;
|
||||||
|
|
||||||
long m_channel_l[2048*2];
|
long m_channel_l[2048*2];
|
||||||
long m_channel_r[2048*2];
|
long m_channel_r[2048*2];
|
||||||
long m_channel_l2[2048*2];
|
long m_channel_l2[2048*2];
|
||||||
|
@ -610,7 +610,7 @@ static MACHINE_CONFIG_START( namcofl, namcofl_state )
|
|||||||
MCFG_VIDEO_START_OVERRIDE(namcofl_state,namcofl)
|
MCFG_VIDEO_START_OVERRIDE(namcofl_state,namcofl)
|
||||||
|
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
MCFG_C352_ADD("c352", 48384000/2)
|
MCFG_C352_ADD("c352", 48384000/2, C352_DIVIDER_288)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
|
@ -1126,7 +1126,7 @@ static MACHINE_CONFIG_START( namconb1, namconb1_state )
|
|||||||
MCFG_VIDEO_START_OVERRIDE(namconb1_state,namconb1)
|
MCFG_VIDEO_START_OVERRIDE(namconb1_state,namconb1)
|
||||||
|
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
MCFG_C352_ADD("c352", MASTER_CLOCK/2)
|
MCFG_C352_ADD("c352", MASTER_CLOCK/2, C352_DIVIDER_288)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
@ -1163,7 +1163,7 @@ static MACHINE_CONFIG_START( namconb2, namconb1_state )
|
|||||||
MCFG_VIDEO_START_OVERRIDE(namconb1_state,namconb2)
|
MCFG_VIDEO_START_OVERRIDE(namconb1_state,namconb2)
|
||||||
|
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
MCFG_C352_ADD("c352", MASTER_CLOCK/2)
|
MCFG_C352_ADD("c352", MASTER_CLOCK/2, C352_DIVIDER_288)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
|
@ -319,7 +319,7 @@ static MACHINE_CONFIG_START( namcond1, namcond1_state )
|
|||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
|
|
||||||
MCFG_C352_ADD("c352", XTAL_49_152MHz/2)
|
MCFG_C352_ADD("c352", XTAL_49_152MHz/2, C352_DIVIDER_288)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
|
@ -571,7 +571,7 @@ static MACHINE_CONFIG_START( coh110, namcos11_state )
|
|||||||
|
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
|
|
||||||
MCFG_C352_ADD("c352", 16934400*1.5) // measured at 20MHz, but that's too lowpitched
|
MCFG_C352_ADD("c352", 20013200, C352_DIVIDER_228)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
|
@ -1591,7 +1591,7 @@ static MACHINE_CONFIG_START( coh700, namcos12_state )
|
|||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
|
|
||||||
MCFG_C352_ADD("c352", 16737350*1.5) // measured at 29.168MHz, but that's too highpitched
|
MCFG_C352_ADD("c352", 29168000, C352_DIVIDER_332)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
|
@ -3781,7 +3781,7 @@ static MACHINE_CONFIG_START( namcos22, namcos22_state )
|
|||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
|
|
||||||
MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2)
|
MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, C352_DIVIDER_288)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
@ -3830,7 +3830,7 @@ static MACHINE_CONFIG_START( namcos22s, namcos22_state )
|
|||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
|
|
||||||
MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2)
|
MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, C352_DIVIDER_288)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
|
@ -1247,7 +1247,7 @@ Notes:
|
|||||||
#define JVSCLOCK (XTAL_14_7456MHz)
|
#define JVSCLOCK (XTAL_14_7456MHz)
|
||||||
#define H8CLOCK (16737350) /* from 2061 */
|
#define H8CLOCK (16737350) /* from 2061 */
|
||||||
#define BUSCLOCK (16737350*2) /* 33MHz CPU bus clock / input */
|
#define BUSCLOCK (16737350*2) /* 33MHz CPU bus clock / input */
|
||||||
#define C352CLOCK (16737350*1.5) /* measured at 25.992MHz from 2061 pin 9 (but that sounds too highpitched) */
|
#define C352CLOCK (25992000) /* measured at 25.992MHz from 2061 pin 9 (System 12 uses a divider of 332) */
|
||||||
#define VSYNC1 (59.8824)
|
#define VSYNC1 (59.8824)
|
||||||
#define VSYNC2 (59.915)
|
#define VSYNC2 (59.915)
|
||||||
#define HSYNC (16666150)
|
#define HSYNC (16666150)
|
||||||
@ -3320,7 +3320,7 @@ static MACHINE_CONFIG_START( gorgon, namcos23_state )
|
|||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
|
|
||||||
MCFG_C352_ADD("c352", C352CLOCK)
|
MCFG_C352_ADD("c352", C352CLOCK, C352_DIVIDER_332)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
@ -3389,7 +3389,7 @@ static MACHINE_CONFIG_START( s23, namcos23_state )
|
|||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
|
|
||||||
MCFG_C352_ADD("c352", C352CLOCK)
|
MCFG_C352_ADD("c352", C352CLOCK, C352_DIVIDER_332)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
@ -3469,7 +3469,7 @@ static MACHINE_CONFIG_START( ss23, namcos23_state )
|
|||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
|
|
||||||
MCFG_C352_ADD("c352", C352CLOCK)
|
MCFG_C352_ADD("c352", C352CLOCK, C352_DIVIDER_332)
|
||||||
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
|
||||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
|
||||||
|
Loading…
Reference in New Issue
Block a user