Previous 199869 Revisions Next

r21205 Wednesday 20th February, 2013 at 04:37:53 UTC by Andrew Gardner
Modernize rf5c68 and tms36xx sound devices. [Andrew Gardner]

Out of whatsnew.txt:
Thanks for the fix to my last changes Micko.  I got the MESS stuff this time :-).
[src/emu/sound]rf5c68.c rf5c68.h tms36xx.c tms36xx.h
[src/mame/audio]phoenix.c pleiads.c segag80r.c
[src/mame/drivers]naughtyb.c phoenix.c segas18.c segas32.c system16.c
[src/mame/machine]megacd.c
[src/mess/drivers]fmtowns.c

trunk/src/emu/sound/rf5c68.c
r21204r21205
66#include "rf5c68.h"
77
88
9#define  NUM_CHANNELS    (8)
9// device type definition
10const device_type RF5C68 = &device_creator<rf5c68_device>;
1011
1112
12struct pcm_channel
13{
14   UINT8       enable;
15   UINT8       env;
16   UINT8       pan;
17   UINT8       start;
18   UINT32      addr;
19   UINT16      step;
20   UINT16      loopst;
21};
13//**************************************************************************
14//  LIVE DEVICE
15//**************************************************************************
2216
17//-------------------------------------------------
18//  rf5c68_device - constructor
19//-------------------------------------------------
2320
24struct rf5c68_state
21rf5c68_device::rf5c68_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
22   : device_t(mconfig, RF5C68, "RF5C68", tag, owner, clock),
23     device_sound_interface(mconfig, *this),
24     m_stream(NULL),
25     m_cbank(0),
26     m_wbank(0),
27     m_enable(0),
28     m_sample_callback(NULL)
2529{
26   sound_stream *      stream;
27   pcm_channel         chan[NUM_CHANNELS];
28   UINT8               cbank;
29   UINT8               wbank;
30   UINT8               enable;
31   UINT8               data[0x10000];
32   void                (*sample_callback)(device_t* device,int channel);
33   device_t* device;
34};
30   memset(m_data, 0, sizeof(UINT8)*0x10000);
31}
3532
3633
37INLINE rf5c68_state *get_safe_token(device_t *device)
34//-------------------------------------------------
35//  device_start - device-specific startup
36//-------------------------------------------------
37
38void rf5c68_device::device_start()
3839{
39   assert(device != NULL);
40   assert(device->type() == RF5C68);
41   return (rf5c68_state *)downcast<rf5c68_device *>(device)->token();
40   const rf5c68_interface* intf = (const rf5c68_interface*)static_config();
41
42   /* allocate memory for the chip */
43   memset(m_data, 0xff, sizeof(m_data));
44
45   /* allocate the stream */
46   m_stream = stream_alloc(0, 2, clock() / 384);
47
48   /* set up callback */
49   if(intf != NULL)
50      m_sample_callback = intf->sample_end_callback;
51   else
52      m_sample_callback = NULL;
4253}
4354
4455
45/************************************************/
46/*    RF5C68 stream update                      */
47/************************************************/
56//-------------------------------------------------
57//  sound_stream_update - handle a stream update
58//-------------------------------------------------
4859
49static STREAM_UPDATE( rf5c68_update )
60void rf5c68_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
5061{
51   rf5c68_state *chip = (rf5c68_state *)param;
5262   stream_sample_t *left = outputs[0];
5363   stream_sample_t *right = outputs[1];
5464   int i, j;
r21204r21205
5868   memset(right, 0, samples * sizeof(*right));
5969
6070   /* bail if not enabled */
61   if (!chip->enable)
71   if (!m_enable)
6272      return;
6373
6474   /* loop over channels */
65   for (i = 0; i < NUM_CHANNELS; i++)
75   for (i = 0; i < RF5C68_NUM_CHANNELS; i++)
6676   {
67      pcm_channel *chan = &chip->chan[i];
77      rf5c68_pcm_channel *chan = &m_chan[i];
6878
6979      /* if this channel is active, accumulate samples */
7080      if (chan->enable)
r21204r21205
7888            int sample;
7989
8090            /* trigger sample callback */
81            if(chip->sample_callback)
91            if(m_sample_callback)
8292            {
8393               if(((chan->addr >> 11) & 0xfff) == 0xfff)
84                  chip->sample_callback(chip->device,((chan->addr >> 11)/0x2000));
94                  m_sample_callback(this, ((chan->addr >> 11)/0x2000));
8595            }
8696
8797            /* fetch the sample and handle looping */
88            sample = chip->data[(chan->addr >> 11) & 0xffff];
98            sample = m_data[(chan->addr >> 11) & 0xffff];
8999            if (sample == 0xff)
90100            {
91101               chan->addr = chan->loopst << 11;
92               sample = chip->data[(chan->addr >> 11) & 0xffff];
102               sample = m_data[(chan->addr >> 11) & 0xffff];
93103
94104               /* if we loop to a loop point, we're effectively dead */
95105               if (sample == 0xff)
r21204r21205
131141}
132142
133143
134/************************************************/
135/*    RF5C68 start                              */
136/************************************************/
144//-------------------------------------------------
145//    RF5C68 write register                     
146//-------------------------------------------------
137147
138static DEVICE_START( rf5c68 )
148READ8_MEMBER( rf5c68_device::rf5c68_r )
139149{
140   const rf5c68_interface* intf = (const rf5c68_interface*)device->static_config();
141
142   /* allocate memory for the chip */
143   rf5c68_state *chip = get_safe_token(device);
144   memset(chip->data, 0xff, sizeof(chip->data));
145
146   /* allocate the stream */
147   chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock() / 384, chip, rf5c68_update);
148
149   chip->device = device;
150
151   /* set up callback */
152   if(intf != NULL)
153      chip->sample_callback = intf->sample_end_callback;
154   else
155      chip->sample_callback = NULL;
156}
157
158
159/************************************************/
160/*    RF5C68 write register                     */
161/************************************************/
162
163READ8_DEVICE_HANDLER( rf5c68_r )
164{
165   rf5c68_state *chip = get_safe_token(device);
166150   UINT8 shift;
167151
168   chip->stream->update();
152   m_stream->update();
169153   shift = (offset & 1) ? 11 + 8 : 11;
170154
171//  printf("%08x\n",(chip->chan[(offset & 0x0e) >> 1].addr));
155//  printf("%08x\n",(m_chan[(offset & 0x0e) >> 1].addr));
172156
173   return (chip->chan[(offset & 0x0e) >> 1].addr) >> (shift);
157   return (m_chan[(offset & 0x0e) >> 1].addr) >> (shift);
174158}
175159
176WRITE8_DEVICE_HANDLER( rf5c68_w )
160WRITE8_MEMBER( rf5c68_device::rf5c68_w )
177161{
178   rf5c68_state *chip = get_safe_token(device);
179   pcm_channel *chan = &chip->chan[chip->cbank];
162   rf5c68_pcm_channel *chan = &m_chan[m_cbank];
180163   int i;
181164
182165   /* force the stream to update first */
183   chip->stream->update();
166   m_stream->update();
184167
185168   /* switch off the address */
186169   switch (offset)
r21204r21205
216199         break;
217200
218201      case 0x07:  /* control reg */
219         chip->enable = (data >> 7) & 1;
202         m_enable = (data >> 7) & 1;
220203         if (data & 0x40)
221            chip->cbank = data & 7;
204            m_cbank = data & 7;
222205         else
223            chip->wbank = data & 15;
206            m_wbank = data & 15;
224207         break;
225208
226209      case 0x08:  /* channel on/off reg */
227210         for (i = 0; i < 8; i++)
228211         {
229            chip->chan[i].enable = (~data >> i) & 1;
230            if (!chip->chan[i].enable)
231               chip->chan[i].addr = chip->chan[i].start << (8 + 11);
212            m_chan[i].enable = (~data >> i) & 1;
213            if (!m_chan[i].enable)
214               m_chan[i].addr = m_chan[i].start << (8 + 11);
232215         }
233216         break;
234217   }
235218}
236219
237220
238/************************************************/
239/*    RF5C68 read memory                        */
240/************************************************/
241
242READ8_DEVICE_HANDLER( rf5c68_mem_r )
243{
244   rf5c68_state *chip = get_safe_token(device);
245   return chip->data[chip->wbank * 0x1000 + offset];
246}
247
248
249/************************************************/
250/*    RF5C68 write memory                       */
251/************************************************/
252
253WRITE8_DEVICE_HANDLER( rf5c68_mem_w )
254{
255   rf5c68_state *chip = get_safe_token(device);
256   chip->data[chip->wbank * 0x1000 + offset] = data;
257}
258
259const device_type RF5C68 = &device_creator<rf5c68_device>;
260
261rf5c68_device::rf5c68_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
262   : device_t(mconfig, RF5C68, "RF5C68", tag, owner, clock),
263      device_sound_interface(mconfig, *this)
264{
265   m_token = global_alloc_clear(rf5c68_state);
266}
267
268221//-------------------------------------------------
269//  device_config_complete - perform any
270//  operations now that the configuration is
271//  complete
222//    RF5C68 read memory                       
272223//-------------------------------------------------
273224
274void rf5c68_device::device_config_complete()
225READ8_MEMBER( rf5c68_device::rf5c68_mem_r )
275226{
227   return m_data[m_wbank * 0x1000 + offset];
276228}
277229
278//-------------------------------------------------
279//  device_start - device-specific startup
280//-------------------------------------------------
281230
282void rf5c68_device::device_start()
283{
284   DEVICE_START_NAME( rf5c68 )(this);
285}
286
287231//-------------------------------------------------
288//  sound_stream_update - handle a stream update
232//    RF5C68 write memory                      
289233//-------------------------------------------------
290234
291void rf5c68_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
235WRITE8_MEMBER( rf5c68_device::rf5c68_mem_w )
292236{
293   // should never get here
294   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
237   m_data[m_wbank * 0x1000 + offset] = data;
295238}
trunk/src/emu/sound/rf5c68.h
r21204r21205
77#ifndef __RF5C68_H__
88#define __RF5C68_H__
99
10#include "devlegcy.h"
10#define RF5C68_NUM_CHANNELS (8)
1111
12/******************************************/
13DECLARE_READ8_DEVICE_HANDLER( rf5c68_r );
14DECLARE_WRITE8_DEVICE_HANDLER( rf5c68_w );
1512
16DECLARE_READ8_DEVICE_HANDLER( rf5c68_mem_r );
17DECLARE_WRITE8_DEVICE_HANDLER( rf5c68_mem_w );
13//**************************************************************************
14//  INTERFACE CONFIGURATION MACROS
15//**************************************************************************
1816
17#define MCFG_RF5C68_ADD(_tag, _clock) \
18   MCFG_DEVICE_ADD(_tag, RF5C68, _clock)
19#define MCFG_RF5C68_REPLACE(_tag, _clock) \
20   MCFG_DEVICE_REPLACE(_tag, RF5C68, _clock)
21
22
23//**************************************************************************
24//  TYPE DEFINITIONS
25//**************************************************************************
26
1927struct rf5c68_interface
2028{
2129   void (*sample_end_callback)(device_t* device, int channel);
2230};
2331
32
33struct rf5c68_pcm_channel
34{
35    rf5c68_pcm_channel() :
36        enable(0),
37        env(0),
38        pan(0),
39        start(0),
40        addr(0),
41        step(0),
42        loopst(0) {}
43   
44   UINT8       enable;
45   UINT8       env;
46   UINT8       pan;
47   UINT8       start;
48   UINT32      addr;
49   UINT16      step;
50   UINT16      loopst;
51};
52
53
54
55// ======================> rf5c68_device
56
2457class rf5c68_device : public device_t,
25                           public device_sound_interface
58                 public device_sound_interface
2659{
2760public:
2861   rf5c68_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
29   ~rf5c68_device() { global_free(m_token); }
62   ~rf5c68_device() { }
3063
31   // access to legacy token
32   void *token() const { assert(m_token != NULL); return m_token; }
3364protected:
3465   // device-level overrides
35   virtual void device_config_complete();
3666   virtual void device_start();
3767
3868   // sound stream update overrides
3969   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
70
71public:
72    DECLARE_READ8_MEMBER( rf5c68_r );
73    DECLARE_WRITE8_MEMBER( rf5c68_w );
74
75    DECLARE_READ8_MEMBER( rf5c68_mem_r );
76    DECLARE_WRITE8_MEMBER( rf5c68_mem_w );
77
4078private:
41   // internal state
42   void *m_token;
79   sound_stream*        m_stream;
80   rf5c68_pcm_channel   m_chan[RF5C68_NUM_CHANNELS];
81   UINT8                m_cbank;
82   UINT8                m_wbank;
83   UINT8                m_enable;
84   UINT8                m_data[0x10000];
85   void                (*m_sample_callback)(device_t* device,int channel);
4386};
4487
4588extern const device_type RF5C68;
trunk/src/emu/sound/tms36xx.c
r21204r21205
1111/* the frequencies are later adjusted by "* clock / FSCALE" */
1212#define FSCALE  1024
1313
14struct tms_state {
15   char *subtype;      /* subtype name MM6221AA, TMS3615 or TMS3617 */
16   sound_stream * channel; /* returned by stream_create() */
17
18   int samplerate;     /* output sample rate */
19
20   int basefreq;       /* chip's base frequency */
21   int octave;         /* octave select of the TMS3615 */
22
23   int speed;          /* speed of the tune */
24   int tune_counter;   /* tune counter */
25   int note_counter;   /* note counter */
26
27   int voices;         /* active voices */
28   int shift;          /* shift toggles between 0 and 6 to allow decaying voices */
29   int vol[12];        /* (decaying) volume of harmonics notes */
30   int vol_counter[12];/* volume adjustment counter */
31   int decay[12];      /* volume adjustment rate - dervied from decay */
32
33   int counter[12];    /* tone frequency counter */
34   int frequency[12];  /* tone frequency */
35   int output;         /* output signal bits */
36   int enable;         /* mask which harmoics */
37
38   int tune_num;       /* tune currently playing */
39   int tune_ofs;       /* note currently playing */
40   int tune_max;       /* end of tune */
41
42   const tms36xx_interface *intf;
43};
44
4514#define C(n)    (int)((FSCALE<<(n-1))*1.18921)  /* 2^(3/12) */
4615#define Cx(n)   (int)((FSCALE<<(n-1))*1.25992)  /* 2^(4/12) */
4716#define D(n)    (int)((FSCALE<<(n-1))*1.33484)  /* 2^(5/12) */
r21204r21205
299268static const int *const tunes[] = {NULL,tune1,tune2,tune3,tune4};
300269
301270#define DECAY(voice)                                            \
302   if( tms->vol[voice] > VMIN )                                \
271   if( m_vol[voice] > VMIN )                                   \
303272   {                                                           \
304273      /* decay of first voice */                              \
305      tms->vol_counter[voice] -= tms->decay[voice];           \
306      while( tms->vol_counter[voice] <= 0 )                   \
274      m_vol_counter[voice] -= m_decay[voice];                 \
275      while( m_vol_counter[voice] <= 0 )                      \
307276      {                                                       \
308         tms->vol_counter[voice] += samplerate;              \
309         if( tms->vol[voice]-- <= VMIN )                     \
277         m_vol_counter[voice] += samplerate;                 \
278         if( m_vol[voice]-- <= VMIN )                        \
310279         {                                                   \
311            tms->frequency[voice] = 0;                      \
312            tms->vol[voice] = VMIN;                         \
280            m_frequency[voice] = 0;                         \
281            m_vol[voice] = VMIN;                            \
313282            break;                                          \
314283         }                                                   \
315284      }                                                       \
316285   }
317286
318287#define RESTART(voice)                                          \
319   if( tunes[tms->tune_num][tms->tune_ofs*6+voice] )           \
288   if( tunes[m_tune_num][m_tune_ofs*6+voice] )                 \
320289   {                                                           \
321      tms->frequency[tms->shift+voice] =                      \
322         tunes[tms->tune_num][tms->tune_ofs*6+voice] *       \
323         (tms->basefreq << tms->octave) / FSCALE;            \
324      tms->vol[tms->shift+voice] = VMAX;                      \
290      m_frequency[m_shift+voice] =                            \
291         tunes[m_tune_num][m_tune_ofs*6+voice] *             \
292         (m_basefreq << m_octave) / FSCALE;                  \
293      m_vol[m_shift+voice] = VMAX;                            \
325294   }
326295
327296#define TONE(voice)                                             \
328   if( (tms->enable & (1<<voice)) && tms->frequency[voice] )   \
297   if( (m_enable & (1<<voice)) && m_frequency[voice] )         \
329298   {                                                           \
330299      /* first note */                                        \
331      tms->counter[voice] -= tms->frequency[voice];           \
332      while( tms->counter[voice] <= 0 )                       \
300      m_counter[voice] -= m_frequency[voice];                 \
301      while( m_counter[voice] <= 0 )                          \
333302      {                                                       \
334         tms->counter[voice] += samplerate;                  \
335         tms->output ^= 1 << voice;                          \
303         m_counter[voice] += samplerate;                     \
304         m_output ^= 1 << voice;                             \
336305      }                                                       \
337      if (tms->output & tms->enable & (1 << voice))           \
338         sum += tms->vol[voice];                             \
306      if (m_output & m_enable & (1 << voice))                 \
307         sum += m_vol[voice];                                \
339308   }
340309
341310
342INLINE tms_state *get_safe_token(device_t *device)
311
312// device type definition
313const device_type TMS36XX = &device_creator<tms36xx_device>;
314
315
316//**************************************************************************
317//  LIVE DEVICE
318//**************************************************************************
319
320//-------------------------------------------------
321//  tms36xx_device - constructor
322//-------------------------------------------------
323
324tms36xx_device::tms36xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
325   : device_t(mconfig, TMS36XX, "TMS36XX", tag, owner, clock),
326     device_sound_interface(mconfig, *this),
327     m_subtype(NULL),
328     m_channel(NULL),
329     m_samplerate(0),
330     m_basefreq(0),
331     m_octave(0),
332     m_speed(0),
333     m_tune_counter(0),
334     m_note_counter(0),
335     m_voices(0),
336     m_shift(0),
337     m_output(0),
338     m_enable(0),
339     m_tune_num(0),
340     m_tune_ofs(0),
341     m_tune_max(0),
342     m_intf(NULL)
343343{
344   assert(device != NULL);
345   assert(device->type() == TMS36XX);
346   return (tms_state *)downcast<tms36xx_device *>(device)->token();
344   memset(m_vol, 0, sizeof(int)*12);
345   memset(m_vol_counter, 0, sizeof(int)*12);
346   memset(m_decay, 0, sizeof(int)*12);
347   memset(m_counter, 0, sizeof(int)*12);
348   memset(m_frequency, 0, sizeof(int)*12);
347349}
348350
349351
350static STREAM_UPDATE( tms36xx_sound_update )
352//-------------------------------------------------
353//  device_start - device-specific startup
354//-------------------------------------------------
355
356void tms36xx_device::device_start()
351357{
352   tms_state *tms = (tms_state *)param;
353   int samplerate = tms->samplerate;
358   int j;
359   int enable;
360
361   m_intf = (const tms36xx_interface *)static_config();
362
363   m_channel = stream_alloc(0, 1, clock() * 64);
364   m_samplerate = clock() * 64;
365   m_basefreq = clock();
366   enable = 0;
367   for (j = 0; j < 6; j++)
368   {
369      if( m_intf->decay[j] > 0 )
370      {
371         m_decay[j+0] = m_decay[j+6] = VMAX / m_intf->decay[j];
372         enable |= 0x41 << j;
373      }
374   }
375   m_speed = (m_intf->speed > 0) ? VMAX / m_intf->speed : VMAX;
376   tms3617_enable(enable);
377
378   LOG(("TMS36xx samplerate    %d\n", m_samplerate));
379   LOG(("TMS36xx basefreq      %d\n", m_basefreq));
380   LOG(("TMS36xx decay         %d,%d,%d,%d,%d,%d\n",
381      m_decay[0], m_decay[1], m_decay[2],
382      m_decay[3], m_decay[4], m_decay[5]));
383   LOG(("TMS36xx speed         %d\n", m_speed));
384}
385
386
387//-------------------------------------------------
388//  sound_stream_update - handle a stream update
389//-------------------------------------------------
390
391void tms36xx_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
392{
393   int samplerate = m_samplerate;
354394   stream_sample_t *buffer = outputs[0];
355395
356396   /* no tune played? */
357   if( !tunes[tms->tune_num] || tms->voices == 0 )
397   if( !tunes[m_tune_num] || m_voices == 0 )
358398   {
359399      while (--samples >= 0)
360400         buffer[samples] = 0;
r21204r21205
370410      DECAY( 6) DECAY( 7) DECAY( 8) DECAY( 9) DECAY(10) DECAY(11)
371411
372412      /* musical note timing */
373      tms->tune_counter -= tms->speed;
374      if( tms->tune_counter <= 0 )
413      m_tune_counter -= m_speed;
414      if( m_tune_counter <= 0 )
375415      {
376         int n = (-tms->tune_counter / samplerate) + 1;
377         tms->tune_counter += n * samplerate;
416         int n = (-m_tune_counter / samplerate) + 1;
417         m_tune_counter += n * samplerate;
378418
379         if( (tms->note_counter -= n) <= 0 )
419         if( (m_note_counter -= n) <= 0 )
380420         {
381            tms->note_counter += VMAX;
382            if (tms->tune_ofs < tms->tune_max)
421            m_note_counter += VMAX;
422            if (m_tune_ofs < m_tune_max)
383423            {
384424               /* shift to the other 'bank' of voices */
385               tms->shift ^= 6;
425               m_shift ^= 6;
386426               /* restart one 'bank' of voices */
387427               RESTART(0) RESTART(1) RESTART(2)
388428               RESTART(3) RESTART(4) RESTART(5)
389               tms->tune_ofs++;
429               m_tune_ofs++;
390430            }
391431         }
392432      }
r21204r21205
395435      TONE( 0) TONE( 1) TONE( 2) TONE( 3) TONE( 4) TONE( 5)
396436      TONE( 6) TONE( 7) TONE( 8) TONE( 9) TONE(10) TONE(11)
397437
398      *buffer++ = sum / tms->voices;
438      *buffer++ = sum / m_voices;
399439   }
400440}
401441
402static void tms36xx_reset_counters(tms_state *tms)
403{
404   tms->tune_counter = 0;
405   tms->note_counter = 0;
406   memset(tms->vol_counter, 0, sizeof(tms->vol_counter));
407   memset(tms->counter, 0, sizeof(tms->counter));
408}
409442
410void mm6221aa_tune_w(device_t *device, int tune)
411{
412   tms_state *tms = get_safe_token(device);
443//-------------------------------------------------
444//  MM6221AA interface functions
445//-------------------------------------------------
413446
447void tms36xx_device::mm6221aa_tune_w(int tune)
448{
414449   /* which tune? */
415450   tune &= 3;
416   if( tune == tms->tune_num )
451   if( tune == m_tune_num )
417452      return;
418453
419   LOG(("%s tune:%X\n", tms->subtype, tune));
454   LOG(("%s tune:%X\n", m_subtype, tune));
420455
421456   /* update the stream before changing the tune */
422   tms->channel->update();
457   m_channel->update();
423458
424   tms->tune_num = tune;
425   tms->tune_ofs = 0;
426   tms->tune_max = 96; /* fixed for now */
459   m_tune_num = tune;
460   m_tune_ofs = 0;
461   m_tune_max = 96; /* fixed for now */
427462}
428463
429void tms36xx_note_w(device_t *device, int octave, int note)
430{
431   tms_state *tms = get_safe_token(device);
432464
465//-------------------------------------------------
466//  TMS3615/17 interface functions
467//-------------------------------------------------
468
469void tms36xx_device::tms36xx_note_w(int octave, int note)
470{
433471   octave &= 3;
434472   note &= 15;
435473
436474   if (note > 12)
437475      return;
438476
439   LOG(("%s octave:%X note:%X\n", tms->subtype, octave, note));
477   LOG(("%s octave:%X note:%X\n", m_subtype, octave, note));
440478
441479   /* update the stream before changing the tune */
442   tms->channel->update();
480   m_channel->update();
443481
444482   /* play a single note from 'tune 4', a list of the 13 tones */
445   tms36xx_reset_counters(tms);
446   tms->octave = octave;
447   tms->tune_num = 4;
448   tms->tune_ofs = note;
449   tms->tune_max = note + 1;
483   tms36xx_reset_counters();
484   m_octave = octave;
485   m_tune_num = 4;
486   m_tune_ofs = note;
487   m_tune_max = note + 1;
450488}
451489
452static void tms3617_enable(tms_state *tms, int enable)
490
491//-------------------------------------------------
492//  TMS3617 interface functions
493//-------------------------------------------------
494     
495void tms36xx_device::tms3617_enable_w(int enable)
453496{
497   tms3617_enable(enable);
498}
499
500
501//-------------------------------------------------
502//  Locals
503//-------------------------------------------------
504
505void tms36xx_device::tms36xx_reset_counters()
506{
507   m_tune_counter = 0;
508   m_note_counter = 0;
509   memset(m_vol_counter, 0, sizeof(m_vol_counter));
510   memset(m_counter, 0, sizeof(m_counter));
511}
512
513
514void tms36xx_device::tms3617_enable(int enable)
515{
454516   int i, bits = 0;
455517
456518   /* duplicate the 6 voice enable bits */
457519   enable = (enable & 0x3f) | ((enable & 0x3f) << 6);
458   if (enable == tms->enable)
520   if (enable == m_enable)
459521      return;
460522
461523   /* update the stream before changing the tune */
462   tms->channel->update();
524   m_channel->update();
463525
464   LOG(("%s enable voices", tms->subtype));
526   LOG(("%s enable voices", m_subtype));
465527   for (i = 0; i < 6; i++)
466528   {
467529      if (enable & (1 << i))
r21204r21205
480542      }
481543   }
482544   /* set the enable mask and number of active voices */
483   tms->enable = enable;
484   tms->voices = bits;
545   m_enable = enable;
546   m_voices = bits;
485547   LOG(("%s\n", bits ? "" : " none"));
486548}
487
488void tms3617_enable_w(device_t *device, int enable)
489{
490   tms_state *tms = get_safe_token(device);
491   tms3617_enable(tms, enable);
492}
493
494static DEVICE_START( tms36xx )
495{
496   int j;
497   tms_state *tms = get_safe_token(device);
498   int enable;
499
500   tms->intf = (const tms36xx_interface *)device->static_config();
501
502   tms->channel = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() * 64, tms, tms36xx_sound_update);
503   tms->samplerate = device->clock() * 64;
504   tms->basefreq = device->clock();
505   enable = 0;
506   for (j = 0; j < 6; j++)
507   {
508      if( tms->intf->decay[j] > 0 )
509      {
510         tms->decay[j+0] = tms->decay[j+6] = VMAX / tms->intf->decay[j];
511         enable |= 0x41 << j;
512      }
513   }
514   tms->speed = (tms->intf->speed > 0) ? VMAX / tms->intf->speed : VMAX;
515   tms3617_enable(tms,enable);
516
517   LOG(("TMS36xx samplerate    %d\n", tms->samplerate));
518   LOG(("TMS36xx basefreq      %d\n", tms->basefreq));
519   LOG(("TMS36xx decay         %d,%d,%d,%d,%d,%d\n",
520      tms->decay[0], tms->decay[1], tms->decay[2],
521      tms->decay[3], tms->decay[4], tms->decay[5]));
522   LOG(("TMS36xx speed         %d\n", tms->speed));
523}
524
525
526const device_type TMS36XX = &device_creator<tms36xx_device>;
527
528tms36xx_device::tms36xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
529   : device_t(mconfig, TMS36XX, "TMS36XX", tag, owner, clock),
530      device_sound_interface(mconfig, *this)
531{
532   m_token = global_alloc_clear(tms_state);
533}
534
535//-------------------------------------------------
536//  device_config_complete - perform any
537//  operations now that the configuration is
538//  complete
539//-------------------------------------------------
540
541void tms36xx_device::device_config_complete()
542{
543}
544
545//-------------------------------------------------
546//  device_start - device-specific startup
547//-------------------------------------------------
548
549void tms36xx_device::device_start()
550{
551   DEVICE_START_NAME( tms36xx )(this);
552}
553
554//-------------------------------------------------
555//  sound_stream_update - handle a stream update
556//-------------------------------------------------
557
558void tms36xx_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
559{
560   // should never get here
561   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
562}
trunk/src/emu/sound/tms36xx.h
r21204r21205
33#ifndef __TMS36XX_H__
44#define __TMS36XX_H__
55
6#include "devlegcy.h"
6//**************************************************************************
7//  INTERFACE CONFIGURATION MACROS
8//**************************************************************************
79
8/* subtypes */
9#define MM6221AA    21      /* Phoenix (fixed melodies) */
10#define TMS3615     15      /* Naughty Boy, Pleiads (13 notes, one output) */
11#define TMS3617     17      /* Monster Bash (13 notes, six outputs) */
10#define MCFG_TMS36XX_ADD(_tag, _clock) \
11   MCFG_DEVICE_ADD(_tag, TMS36XX, _clock)
12#define MCFG_TMS36XX_REPLACE(_tag, _clock) \
13   MCFG_DEVICE_REPLACE(_tag, TMS36XX, _clock)
1214
13/* The interface structure */
15
16//**************************************************************************
17//  TYPE DEFINITIONS
18//**************************************************************************
19
20// subtypes
21#define MM6221AA    21      // Phoenix (fixed melodies)
22#define TMS3615     15      // Naughty Boy, Pleiads (13 notes, one output)
23#define TMS3617     17      // Monster Bash (13 notes, six outputs)
24
25
26// ======================> tms36xx_interface
27
1428struct tms36xx_interface
1529{
1630   int subtype;
17   double decay[6];    /* decay times for the six harmonic notes */
18   double speed;       /* tune speed (meaningful for the TMS3615 only) */
31   double decay[6];    // decay times for the six harmonic notes
32   double speed;       // tune speed (meaningful for the TMS3615 only)
1933};
2034
21/* MM6221AA interface functions */
22extern void mm6221aa_tune_w(device_t *device, int tune);
2335
24/* TMS3615/17 interface functions */
25extern void tms36xx_note_w(device_t *device, int octave, int note);
36// ======================> tms36xx_device
2637
27/* TMS3617 interface functions */
28extern void tms3617_enable_w(device_t *device, int enable);
29
3038class tms36xx_device : public device_t,
31                           public device_sound_interface
39                  public device_sound_interface
3240{
3341public:
3442   tms36xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
35   ~tms36xx_device() { global_free(m_token); }
43   ~tms36xx_device() { }
3644
37   // access to legacy token
38   void *token() const { assert(m_token != NULL); return m_token; }
3945protected:
4046   // device-level overrides
41   virtual void device_config_complete();
4247   virtual void device_start();
4348
4449   // sound stream update overrides
4550   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
51
52public:
53    // MM6221AA interface functions
54    void mm6221aa_tune_w(int tune);
55
56    // TMS3615/17 interface functions
57    void tms36xx_note_w(int octave, int note);
58
59    // TMS3617 interface functions
60    void tms3617_enable_w(int enable);
61
4662private:
47   // internal state
48   void *m_token;
63    void tms36xx_reset_counters();
64    void tms3617_enable(int enable);
65
66private:
67   char *m_subtype;      // subtype name MM6221AA, TMS3615 or TMS3617
68   sound_stream *m_channel; // returned by stream_create()
69
70   int m_samplerate;     // output sample rate
71
72   int m_basefreq;       // chip's base frequency
73   int m_octave;         // octave select of the TMS3615
74
75   int m_speed;          // speed of the tune
76   int m_tune_counter;   // tune counter
77   int m_note_counter;   // note counter
78
79   int m_voices;         // active voices
80   int m_shift;          // shift toggles between 0 and 6 to allow decaying voices
81   int m_vol[12];        // (decaying) volume of harmonics notes
82   int m_vol_counter[12];// volume adjustment counter
83   int m_decay[12];      // volume adjustment rate - dervied from decay
84
85   int m_counter[12];    // tone frequency counter
86   int m_frequency[12];  // tone frequency
87   int m_output;         // output signal bits
88   int m_enable;         // mask which harmoics
89
90   int m_tune_num;       // tune currently playing
91   int m_tune_ofs;       // note currently playing
92   int m_tune_max;       // end of tune
93
94   const tms36xx_interface *m_intf;
4995};
5096
5197extern const device_type TMS36XX;
trunk/src/mess/drivers/fmtowns.c
r21204r21205
21812181   AM_RANGE(0xc2100000, 0xc213ffff) AM_ROM AM_REGION("user",0x180000)  // FONT ROM
21822182   AM_RANGE(0xc2140000, 0xc2141fff) AM_READWRITE8(towns_cmos_r,towns_cmos_w,0xffffffff) // CMOS (mirror?)
21832183   AM_RANGE(0xc2180000, 0xc21fffff) AM_ROM AM_REGION("user",0x080000)  // F20 ROM
2184   AM_RANGE(0xc2200000, 0xc220ffff) AM_DEVREADWRITE8_LEGACY("pcm",rf5c68_mem_r,rf5c68_mem_w,0xffffffff)  // WAVE RAM
2184   AM_RANGE(0xc2200000, 0xc220ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffffffff)  // WAVE RAM
21852185   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
21862186ADDRESS_MAP_END
21872187
r21204r21205
22072207   AM_RANGE(0x00d00000, 0x00dfffff) AM_RAM // IC Memory Card (is this usable on the Marty?)
22082208   AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
22092209   AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000)  // FONT
2210   AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8_LEGACY("pcm",rf5c68_mem_r,rf5c68_mem_w,0xffffffff)  // WAVE RAM
2210   AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffffffff)  // WAVE RAM
22112211   AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
22122212   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
22132213ADDRESS_MAP_END
r21204r21205
22342234   AM_RANGE(0x00e00000, 0x00e7ffff) AM_ROM AM_REGION("user",0x000000)  // OS
22352235   AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
22362236   AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000)  // FONT
2237   AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8_LEGACY("pcm",rf5c68_mem_r,rf5c68_mem_w,0xffffffff)  // WAVE RAM
2237   AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffffffff)  // WAVE RAM
22382238   AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
22392239   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
22402240ADDRESS_MAP_END
r21204r21205
22742274   AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8_LEGACY("fm",ym3438_r,ym3438_w,0x00ff00ff)
22752275   AM_RANGE(0x04e0,0x04e3) AM_READWRITE8(towns_volume_r,towns_volume_w,0xffffffff)  // R/W  -- volume ports
22762276   AM_RANGE(0x04e8,0x04ef) AM_READWRITE8(towns_sound_ctrl_r,towns_sound_ctrl_w,0xffffffff)
2277   AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8_LEGACY("pcm",rf5c68_w,0xffffffff)
2277   AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8("pcm", rf5c68_device, rf5c68_w, 0xffffffff)
22782278   // CRTC / Video
22792279   AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffffffff)
22802280   // System ports
r21204r21205
27932793   MCFG_SOUND_ADD("fm", YM3438, 53693100 / 7) // actual clock speed unknown
27942794   MCFG_SOUND_CONFIG(ym3438_intf)
27952795   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
2796   MCFG_SOUND_ADD("pcm", RF5C68, 53693100 / 7)  // actual clock speed unknown
2796   MCFG_RF5C68_ADD("pcm", 53693100 / 7)  // actual clock speed unknown
27972797   MCFG_SOUND_CONFIG(rf5c68_intf)
27982798   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50)
27992799   MCFG_SOUND_ADD("cdda",CDDA,0)
trunk/src/mame/drivers/naughtyb.c
r21204r21205
441441   /* uses the TMS3615NS for sound */
442442   MCFG_SPEAKER_STANDARD_MONO("mono")
443443
444   MCFG_SOUND_ADD("tms", TMS36XX, 350)
444   MCFG_TMS36XX_ADD("tms", 350)
445445   MCFG_SOUND_CONFIG(tms3615_interface)
446446   MCFG_SOUND_ROUTE(0, "mono", 0.60)
447447
r21204r21205
472472   /* sound hardware */
473473   MCFG_SPEAKER_STANDARD_MONO("mono")
474474
475   MCFG_SOUND_ADD("tms", TMS36XX, 350)
475   MCFG_TMS36XX_ADD("tms", 350)
476476   MCFG_SOUND_CONFIG(tms3615_interface)
477477   MCFG_SOUND_ROUTE(0, "mono", 0.60)
478478
trunk/src/mame/drivers/phoenix.c
r21204r21205
472472   /* sound hardware */
473473   MCFG_SPEAKER_STANDARD_MONO("mono")
474474
475   MCFG_SOUND_ADD("tms", TMS36XX, 372)
475   MCFG_TMS36XX_ADD("tms",  372)
476476   MCFG_SOUND_CONFIG(phoenix_tms36xx_interface)
477477   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
478478
r21204r21205
497497   MCFG_PALETTE_INIT_OVERRIDE(phoenix_state,pleiads)
498498
499499   /* sound hardware */
500   MCFG_SOUND_REPLACE("tms", TMS36XX, 247)
500   MCFG_TMS36XX_REPLACE("tms", 247)
501501   MCFG_SOUND_CONFIG(pleiads_tms36xx_interface)
502502   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
503503
trunk/src/mame/drivers/segas32.c
r21204r21205
12241224static ADDRESS_MAP_START( system32_sound_map, AS_PROGRAM, 8, segas32_state )
12251225   AM_RANGE(0x0000, 0x9fff) AM_ROM AM_REGION("soundcpu", 0x100000)
12261226   AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank1")
1227   AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x0ff0) AM_DEVWRITE_LEGACY("rfsnd", rf5c68_w)
1228   AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE_LEGACY("rfsnd", rf5c68_mem_r, rf5c68_mem_w)
1227   AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x0ff0) AM_DEVWRITE("rfsnd", rf5c68_device, rf5c68_w)
1228   AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE("rfsnd", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w)
12291229   AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("z80_shared_ram")
12301230ADDRESS_MAP_END
12311231
r21204r21205
22222222   MCFG_SOUND_ROUTE(0, "lspeaker", 0.40)
22232223   MCFG_SOUND_ROUTE(1, "rspeaker", 0.40)
22242224
2225   MCFG_SOUND_ADD("rfsnd", RF5C68, RFC_CLOCK/4)
2225   MCFG_RF5C68_ADD("rfsnd", RFC_CLOCK/4)
22262226   MCFG_SOUND_ROUTE(0, "lspeaker", 0.55)
22272227   MCFG_SOUND_ROUTE(1, "rspeaker", 0.55)
22282228MACHINE_CONFIG_END
trunk/src/mame/drivers/segas18.c
r21204r21205
615615   ADDRESS_MAP_UNMAP_HIGH
616616   AM_RANGE(0x0000, 0x9fff) AM_ROM AM_REGION("soundcpu", 0x10000)
617617   AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank1")
618   AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x0ff0) AM_DEVWRITE_LEGACY("rfsnd", rf5c68_w)
619   AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE_LEGACY("rfsnd", rf5c68_mem_r, rf5c68_mem_w)
618   AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x0ff0) AM_DEVWRITE("rfsnd", rf5c68_device, rf5c68_w)
619   AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE("rfsnd", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w)
620620   AM_RANGE(0xe000, 0xffff) AM_RAM
621621ADDRESS_MAP_END
622622
r21204r21205
12851285   MCFG_SOUND_ADD("ym2", YM3438, 8000000)
12861286   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
12871287
1288   MCFG_SOUND_ADD("rfsnd", RF5C68, 10000000)
1288   MCFG_RF5C68_ADD("rfsnd", 10000000)
12891289   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
12901290MACHINE_CONFIG_END
12911291
trunk/src/mame/drivers/system16.c
r21204r21205
10141014   AM_RANGE(0x0000, 0x9fff) AM_ROM
10151015   AM_RANGE(0xa000, 0xbfff) AM_READ(system18_bank_r)
10161016   /**** D/A register ****/
1017   AM_RANGE(0xc000, 0xc008) AM_DEVWRITE_LEGACY("5c68", rf5c68_w)
1018   AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE_LEGACY("5c68", rf5c68_mem_r, rf5c68_mem_w)
1017   AM_RANGE(0xc000, 0xc008) AM_DEVWRITE("5c68", rf5c68_device, rf5c68_w)
1018   AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE("5c68", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w)
10191019   AM_RANGE(0xe000, 0xffff) AM_RAM //??
10201020ADDRESS_MAP_END
10211021
r21204r21205
23122312   MCFG_SOUND_ROUTE(2, "lspeaker", 0.40)
23132313   MCFG_SOUND_ROUTE(3, "rspeaker", 0.40)
23142314
2315   MCFG_SOUND_ADD("5c68", RF5C68, 8000000)
2315   MCFG_RF5C68_ADD("5c68", 8000000)
23162316   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
23172317   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
23182318MACHINE_CONFIG_END
trunk/src/mame/audio/phoenix.c
r21204r21205
6969   sound_stream *      m_channel;
7070   UINT32 *                m_poly18;
7171   device_t *m_discrete;
72   device_t *m_tms;
72   tms36xx_device *m_tms;
7373};
7474
7575INLINE phoenix_sound_state *get_safe_token( device_t *device )
r21204r21205
531531   discrete_sound_w(state->m_discrete, space, PHOENIX_EFFECT_1_FREQ, data & 0x10);
532532
533533   /* update the tune that the MM6221AA is playing */
534   mm6221aa_tune_w(state->m_tms, data >> 6);
534   state->m_tms->mm6221aa_tune_w(data >> 6);
535535}
536536
537537static DEVICE_START( phoenix_sound )
r21204r21205
546546   memset(&state->m_noise_state, 0, sizeof(state->m_noise_state));
547547
548548   state->m_discrete = device->machine().device("discrete");
549   state->m_tms = device->machine().device("tms");
549   state->m_tms = device->machine().device<tms36xx_device>("tms");
550550
551551   state->m_poly18 = auto_alloc_array(device->machine(), UINT32, 1ul << (18-5));
552552
trunk/src/mame/audio/segag80r.c
r21204r21205
865865   MCFG_SAMPLES_ADD("samples", monsterb_samples_interface)
866866   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
867867
868   MCFG_SOUND_ADD("music", TMS36XX, 247)
868   MCFG_TMS36XX_ADD("music", 247)
869869   MCFG_SOUND_CONFIG(monsterb_tms3617_interface)
870870   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
871871
r21204r21205
900900
901901WRITE8_MEMBER(segag80r_state::monsterb_sound_a_w)
902902{
903   device_t *tms = machine().device("music");
903   tms36xx_device *tms = machine().device<tms36xx_device>("music");
904904   int enable_val;
905905
906906   /* Lower four data lines get decoded into 13 control lines */
907   tms36xx_note_w(tms, 0, data & 15);
907   tms->tms36xx_note_w(0, data & 15);
908908
909909   /* Top four data lines address an 82S123 ROM that enables/disables voices */
910910   enable_val = machine().root_device().memregion("prom")->base()[(data & 0xF0) >> 4];
911   tms3617_enable_w(tms, enable_val >> 2);
911   tms->tms3617_enable_w(enable_val >> 2);
912912}
913913
914914
trunk/src/mame/audio/pleiads.c
r21204r21205
4040
4141struct pleiads_sound_state
4242{
43   device_t *m_tms;
43   tms36xx_device *m_tms;
4444   sound_stream *m_channel;
4545
4646   int m_sound_latch_a;
r21204r21205
451451   if (pitch == 3)
452452      pitch = 2;  /* 2 and 3 are the same */
453453
454   tms36xx_note_w(state->m_tms, pitch, note);
454   state->m_tms->tms36xx_note_w(pitch, note);
455455
456456   state->m_channel->update();
457457   state->m_sound_latch_b = data;
r21204r21205
477477   UINT32 shiftreg;
478478
479479   state->m_pc4.level = PC4_MIN;
480   state->m_tms = device->machine().device("tms");
480   state->m_tms = device->machine().device<tms36xx_device>("tms");
481481   state->m_poly18 = auto_alloc_array(device->machine(), UINT32, 1ul << (18-5));
482482
483483   shiftreg = 0;
trunk/src/mame/machine/megacd.c
r21204r21205
8585
8686   AM_RANGE(0xfe0000, 0xfe3fff) AM_READWRITE(segacd_backupram_r,segacd_backupram_w) AM_SHARE("backupram") // backup RAM, odd bytes only!
8787
88   AM_RANGE(0xff0000, 0xff001f) AM_DEVWRITE8_LEGACY("rfsnd", rf5c68_w, 0x00ff)  // PCM, RF5C164
89   AM_RANGE(0xff0020, 0xff003f) AM_DEVREAD8_LEGACY("rfsnd", rf5c68_r, 0x00ff)
90   AM_RANGE(0xff2000, 0xff3fff) AM_DEVREADWRITE8_LEGACY("rfsnd", rf5c68_mem_r, rf5c68_mem_w,0x00ff)  // PCM, RF5C164
88   AM_RANGE(0xff0000, 0xff001f) AM_DEVWRITE8("rfsnd", rf5c68_device, rf5c68_w, 0x00ff)  // PCM, RF5C164
89   AM_RANGE(0xff0020, 0xff003f) AM_DEVREAD8("rfsnd", rf5c68_device, rf5c68_r, 0x00ff)
90   AM_RANGE(0xff2000, 0xff3fff) AM_DEVREADWRITE8("rfsnd", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w,0x00ff)  // PCM, RF5C164
9191
9292
9393   AM_RANGE(0xff8000 ,0xff8001) AM_READWRITE(segacd_sub_led_ready_r, segacd_sub_led_ready_w)
r21204r21205
147147
148148
149149
150   MCFG_SOUND_ADD("rfsnd", RF5C68, SEGACD_CLOCK) // RF5C164!
150   MCFG_RF5C68_ADD("rfsnd", SEGACD_CLOCK) // RF5C164!
151151   MCFG_SOUND_ROUTE( 0, ":lspeaker", 0.50 )
152152   MCFG_SOUND_ROUTE( 1, ":rspeaker", 0.50 )
153153

Previous 199869 Revisions Next


© 1997-2024 The MAME Team