Previous 199869 Revisions Next

r22849 Thursday 16th May, 2013 at 11:42:21 UTC by smf
started to modernise TMS5110 [smf]
[src/emu/sound]tms5110.c tms5110.h
[src/mame/audio]dkong.c scramble.c
[src/mame/drivers]bagman.c cvs.c
[src/mame/includes]cvs.h dkong.h

trunk/src/mame/drivers/cvs.c
r22848r22849
9393#include "emu.h"
9494#include "cpu/s2650/s2650.h"
9595#include "sound/dac.h"
96#include "sound/tms5110.h"
9796#include "video/s2636.h"
9897#include "includes/cvs.h"
9998
r22848r22849
279278
280279READ8_MEMBER(cvs_state::tms_clock_r)
281280{
282   device_t *device = machine().device("tms");
283   return tms5110_romclk_hack_r(device, space, 0) ? 0x80 : 0;
281   return m_tms5110->romclk_hack_r(space, 0) ? 0x80 : 0;
284282}
285283
286284TIMER_CALLBACK_MEMBER(cvs_state::cvs_393hz_timer_cb)
r22848r22849
375373{
376374   /* FIXME: this was by observation on board ???
377375    *          -bit 7 is TMS status (active LO) */
378   return ((tms5110_ctl_r(m_tms, space, 0) ^ 1) << 7) | (soundlatch_byte_r(space, 0) & 0x7f);
376   return ((m_tms5110->ctl_r(space, 0) ^ 1) << 7) | (soundlatch_byte_r(space, 0) & 0x7f);
379377}
380378
381379
382380WRITE8_MEMBER(cvs_state::cvs_tms5110_ctl_w)
383381{
384   device_t *device = machine().device("tms");
385382   UINT8 ctl;
386383   /*
387384    * offset 0: CS ?
r22848r22849
394391         (m_tms5110_ctl_data[1] << 3);   /* CTL8 */
395392
396393   LOG(("CVS: Speech CTL = %04x %02x %02x\n",  ctl, offset, data));
397   tms5110_ctl_w(device, space, 0, ctl);
394   m_tms5110->ctl_w(space, 0, ctl);
398395}
399396
400397
401398WRITE8_MEMBER(cvs_state::cvs_tms5110_pdc_w)
402399{
403   device_t *device = machine().device("tms");
404400   UINT8 out = ((~data) >> 7) & 1;
405401   LOG(("CVS: Speech PDC = %02x %02x\n", offset, out));
406   tms5110_pdc_w(device, out);
402   m_tms5110->pdc_w(out);
407403}
408404
409405
r22848r22849
982978
983979   /* set devices */
984980   m_speech = machine().device("speech");
985   m_tms = machine().device("tms");
986981   m_s2636_0 = machine().device("s2636_0");
987982   m_s2636_1 = machine().device("s2636_1");
988983   m_s2636_2 = machine().device("s2636_2");
trunk/src/mame/drivers/bagman.c
r22848r22849
6969
7070WRITE8_MEMBER(bagman_state::bagman_ls259_w)
7171{
72   device_t *device = machine().device("tmsprom");
72   tmsprom_device *tmsprom = machine().device<tmsprom_device>("tmsprom");
7373   bagman_pal16r6_w(space, offset,data); /*this is just a simulation*/
7474
7575   if (m_ls259_buf[offset] != (data&1) )
r22848r22849
8181      case 0:
8282      case 1:
8383      case 2:
84         tmsprom_bit_w(device, space, 0, 7 - ((m_ls259_buf[0]<<2) | (m_ls259_buf[1]<<1) | (m_ls259_buf[2]<<0)));
84         tmsprom->bit_w(space, 0, 7 - ((m_ls259_buf[0]<<2) | (m_ls259_buf[1]<<1) | (m_ls259_buf[2]<<0)));
8585         break;
8686      case 3:
87         tmsprom_enable_w(device, m_ls259_buf[offset]);
87         tmsprom->enable_w(m_ls259_buf[offset]);
8888         break;
8989      case 4:
90         tmsprom_rom_csq_w(device, space, 0, m_ls259_buf[offset]);
90         tmsprom->rom_csq_w(space, 0, m_ls259_buf[offset]);
9191         break;
9292      case 5:
93         tmsprom_rom_csq_w(device, space, 1, m_ls259_buf[offset]);
93         tmsprom->rom_csq_w(space, 1, m_ls259_buf[offset]);
9494         break;
9595      }
9696   }
r22848r22849
444444   2,                              /* bit # of ctl8 line */
445445   6,                              /* bit # of rom reset */
446446   7,                              /* bit # of stop */
447   DEVCB_DEVICE_LINE("tms", tms5110_pdc_w),        /* tms pdc func */
448   DEVCB_DEVICE_HANDLER("tms", tms5110_ctl_w)      /* tms ctl func */
447   DEVCB_DEVICE_LINE_MEMBER("tms", tms5110_device, pdc_w),        /* tms pdc func */
448   DEVCB_DEVICE_MEMBER("tms", tms5110_device, ctl_w)      /* tms ctl func */
449449};
450450
451451static const tms5110_interface bagman_tms5110_interface =
r22848r22849
454454   NULL,                                           /* function to be called when chip requests another bit */
455455   NULL,                                           /* speech ROM load address callback */
456456   /* new rom controller interface */
457   DEVCB_DEVICE_LINE("tmsprom", tmsprom_m0_w),     /* the M0 line */
457   DEVCB_DEVICE_LINE_MEMBER("tmsprom", tmsprom_device, m0_w),     /* the M0 line */
458458   DEVCB_NULL,                                     /* the M1 line */
459459   DEVCB_NULL,                                     /* Write to ADD1,2,4,8 - 4 address bits */
460   DEVCB_DEVICE_LINE("tmsprom", tmsprom_data_r),   /* Read one bit from ADD8/Data - voice data */
460   DEVCB_DEVICE_LINE_MEMBER("tmsprom", tmsprom_device, data_r),   /* Read one bit from ADD8/Data - voice data */
461461   DEVCB_NULL                                      /* rom clock - Only used to drive the data lines */
462462};
463463
trunk/src/mame/audio/scramble.c
r22848r22849
257257
258258static WRITE8_DEVICE_HANDLER( ad2083_tms5110_ctrl_w )
259259{
260   tmsprom_device *tmsprom = (tmsprom_device *) device;
260261   static const int tbl[8] = {0,4,2,6,1,5,3,7};
261262
262   tmsprom_bit_w(device, space, 0, tbl[data & 0x07]);
263   tmsprom->bit_w(space, 0, tbl[data & 0x07]);
263264   switch (data>>3)
264265   {
265266      case 0x01:
266         tmsprom_rom_csq_w(device, space, 1, 0);
267         tmsprom->rom_csq_w(space, 1, 0);
267268         break;
268269      case 0x03:
269         tmsprom_rom_csq_w(device, space, 0, 0);
270         tmsprom->rom_csq_w(space, 0, 0);
270271         break;
271272      case 0x00:
272273         /* Rom 2 select */
r22848r22849
278279         break;
279280   }
280281   /* most likely triggered by write access */
281   tmsprom_enable_w(device, 0);
282   tmsprom_enable_w(device, 1);
282   tmsprom->enable_w(0);
283   tmsprom->enable_w(1);
283284}
284285
285286
r22848r22849
333334   2,                              /* bit # of ctl8 line */
334335   6,                              /* bit # of rom reset */
335336   7,                              /* bit # of stop */
336   DEVCB_DEVICE_LINE("tms", tms5110_pdc_w),        /* tms pdc func */
337   DEVCB_DEVICE_HANDLER("tms", tms5110_ctl_w)      /* tms ctl func */
337   DEVCB_DEVICE_LINE_MEMBER("tms", tms5110_device, pdc_w),        /* tms pdc func */
338   DEVCB_DEVICE_MEMBER("tms", tms5110_device, ctl_w)      /* tms ctl func */
338339};
339340
340341static const tms5110_interface ad2083_tms5110_interface =
r22848r22849
343344   NULL,                                           /* function to be called when chip requests another bit */
344345   NULL,                                           /* speech ROM load address callback */
345346   /* new rom controller interface */
346   DEVCB_DEVICE_LINE("tmsprom", tmsprom_m0_w),     /* the M0 line */
347   DEVCB_DEVICE_LINE_MEMBER("tmsprom", tmsprom_device, m0_w),     /* the M0 line */
347348   DEVCB_NULL,                                     /* the M1 line */
348349   DEVCB_NULL,                                     /* Write to ADD1,2,4,8 - 4 address bits */
349   DEVCB_DEVICE_LINE("tmsprom", tmsprom_data_r),   /* Read one bit from ADD8/Data - voice data */
350   DEVCB_DEVICE_LINE_MEMBER("tmsprom", tmsprom_device, data_r),   /* Read one bit from ADD8/Data - voice data */
350351   DEVCB_NULL                                      /* rom clock - Only used to drive the data lines */
351352};
352353
trunk/src/mame/audio/dkong.c
r22848r22849
12141214
12151215WRITE8_MEMBER(dkong_state::M58817_command_w)
12161216{
1217   device_t *device = machine().device("tms");
1218   tms5110_ctl_w(device, space, 0, data & 0x0f);
1219   tms5110_pdc_w(device, (data>>4) & 0x01);
1217   tms5110_device *tms5110 = machine().device<tms5110_device>("tms");
1218   tms5110->ctl_w(space, 0, data & 0x0f);
1219   tms5110->pdc_w((data>>4) & 0x01);
12201220   /* FIXME 0x20 is CS */
12211221}
12221222
1223READ8_DEVICE_HANDLER(M58817_status_r)
1224{
1225   m58817_device *m58817 = (m58817_device *) device;
1226   return m58817->status_r(space, offset, mem_mask);
1227}
12231228
1229
12241230/****************************************************************
12251231 *
12261232 * I/O Handlers - static
r22848r22849
14151421   MCFG_LATCH8_ADD( "virtual_p1" ) /* virtual latch for port A */
14161422   MCFG_LATCH8_INVERT( 0x80 )      /* signal is inverted       */
14171423   MCFG_LATCH8_DEVREAD(7, "ls259.6h", latch8_r, 3)
1418   MCFG_LATCH8_DEVREAD(6, "tms", m58817_status_r, 0)
1424   MCFG_LATCH8_DEVREAD(6, "tms", M58817_status_r, 0)
14191425
14201426   /* tms memory controller */
14211427   MCFG_DEVICE_ADD("m58819", M58819, 0)
trunk/src/mame/includes/cvs.h
r22848r22849
55****************************************************************************/
66
77#include "sound/dac.h"
8#include "sound/tms5110.h"
89
910#define CVS_S2636_Y_OFFSET     (3)
1011#define CVS_S2636_X_OFFSET     (-26)
r22848r22849
2930         m_maincpu(*this, "maincpu"),
3031         m_audiocpu(*this, "audiocpu"),
3132         m_dac2(*this, "dac2"),
32         m_dac3(*this, "dac3") { }
33         m_dac3(*this, "dac3"),
34         m_tms5110(*this, "tms")
35   {
36   }
3337
3438   /* memory pointers */
3539   required_shared_ptr<UINT8> m_video_ram;
r22848r22849
6468   device_t *m_speech;
6569   optional_device<dac_device> m_dac2;
6670   optional_device<dac_device> m_dac3;
67   device_t *m_tms;
71   optional_device<tms5110_device> m_tms5110;
6872   device_t *m_s2636_0;
6973   device_t *m_s2636_1;
7074   device_t *m_s2636_2;
trunk/src/mame/includes/dkong.h
r22848r22849
227227   INTERRUPT_GEN_MEMBER(vblank_irq);
228228   TIMER_CALLBACK_MEMBER(scanline_callback);
229229   DECLARE_WRITE8_MEMBER(M58817_command_w);
230   DECLARE_READ8_MEMBER(M58817_status_r);
230231   DECLARE_READ8_MEMBER(dkong_voice_status_r);
231232   DECLARE_READ8_MEMBER(dkong_tune_r);
232233   DECLARE_WRITE8_MEMBER(dkong_p1_w);
trunk/src/emu/sound/tms5110.c
r22848r22849
6464#include "tms5110.h"
6565
6666#define MAX_SAMPLE_CHUNK        512
67#define FIFO_SIZE               64 // TODO: technically the tms51xx chips don't have a fifo at all
6867
6968/* Variants */
7069
r22848r22849
8483#define CTL_STATE_OUTPUT        (1)
8584#define CTL_STATE_NEXT_OUTPUT   (2)
8685
87struct tms5110_state
88{
89   /* coefficient tables */
90   int variant;                /* Variant of the 5110 - see tms5110.h */
91
92   /* coefficient tables */
93   const struct tms5100_coeffs *coeff;
94
95   /* these contain data that describes the 64 bits FIFO */
96   UINT8 fifo[FIFO_SIZE];
97   UINT8 fifo_head;
98   UINT8 fifo_tail;
99   UINT8 fifo_count;
100
101   /* these contain global status bits */
102   UINT8 PDC;
103   UINT8 CTL_pins;
104   UINT8 speaking_now;
105   UINT8 talk_status;
106   UINT8 state;
107
108   /* Rom interface */
109   UINT32 address;
110   UINT8  next_is_address;
111   UINT8  schedule_dummy_read;
112   UINT8  addr_bit;
113
114   /* external callback */
115   int (*M0_callback)(device_t *);
116   void (*set_load_address)(device_t *, int);
117
118   /* callbacks */
119   devcb_resolved_write_line m0_func;      /* the M0 line */
120   devcb_resolved_write_line m1_func;      /* the M1 line */
121   devcb_resolved_write8 addr_func;        /* Write to ADD1,2,4,8 - 4 address bits */
122   devcb_resolved_read_line data_func;     /* Read one bit from ADD8/Data - voice data */
123   devcb_resolved_write_line romclk_func;  /* rom clock - Only used to drive the data lines */
124
125
126   device_t *device;
127
128   /* these contain data describing the current and previous voice frames */
129   UINT16 old_energy;
130   UINT16 old_pitch;
131   INT32 old_k[10];
132
133   UINT16 new_energy;
134   UINT16 new_pitch;
135   INT32 new_k[10];
136
137
138   /* these are all used to contain the current state of the sound generation */
139   UINT16 current_energy;
140   UINT16 current_pitch;
141   INT32 current_k[10];
142
143   UINT16 target_energy;
144   UINT16 target_pitch;
145   INT32 target_k[10];
146
147   UINT8 interp_count;       /* number of interp periods (0-7) */
148   UINT8 sample_count;       /* sample number within interp (0-24) */
149   INT32 pitch_count;
150
151   INT32 x[11];
152
153   INT32 RNG;  /* the random noise generator configuration is: 1 + x + x^3 + x^4 + x^13 */
154
155   const tms5110_interface *intf;
156   const UINT8 *table;
157   sound_stream *stream;
158   INT32 speech_rom_bitnum;
159
160   emu_timer *romclk_hack_timer;
161   UINT8 romclk_hack_timer_started;
162   UINT8 romclk_hack_state;
163};
164
165struct tmsprom_state
166{
167   /* Rom interface */
168   UINT32 address;
169   /* ctl lines */
170   UINT8  m0;
171   UINT8  enable;
172   UINT32  base_address;
173   UINT8  bit;
174
175   int prom_cnt;
176
177   int    clock;
178   const UINT8 *rom;
179   const UINT8 *prom;
180
181   devcb_resolved_write_line pdc_func;     /* tms pdc func */
182   devcb_resolved_write8 ctl_func;         /* tms ctl func */
183
184   device_t *device;
185   emu_timer *romclk_timer;
186
187   const tmsprom_interface *intf;
188};
189
19086/* Pull in the ROM tables */
19187#include "tms5110r.c"
19288
193
194
195INLINE tms5110_state *get_safe_token(device_t *device)
196{
197   assert(device != NULL);
198   assert(device->type() == TMS5110 ||
199         device->type() == TMS5100 ||
200         device->type() == TMS5110A ||
201         device->type() == CD2801 ||
202         device->type() == TMC0281 ||
203         device->type() == CD2802 ||
204         device->type() == M58817);
205   return (tms5110_state *)downcast<tms5110_device *>(device)->token();
206}
207
208INLINE tmsprom_state *get_safe_token_prom(device_t *device)
209{
210   assert(device != NULL);
211   assert(device->type() == TMSPROM);
212   return (tmsprom_state *)downcast<tmsprom_device *>(device)->token();
213}
214
215/* Static function prototypes */
216static void tms5110_set_variant(tms5110_state *tms, int variant);
217static void tms5110_PDC_set(tms5110_state *tms, int data);
218static void tms5110_process(tms5110_state *tms, INT16 *buffer, unsigned int size);
219static void parse_frame(tms5110_state *tms);
220static STREAM_UPDATE( tms5110_update );
221static TIMER_CALLBACK( romclk_hack_timer_cb );
222
223
22489#define DEBUG_5110  0
22590
226void tms5110_set_variant(tms5110_state *tms, int variant)
91void tms5110_device::set_variant(int variant)
22792{
22893   switch (variant)
22994   {
23095      case TMS5110_IS_5110A:
231         tms->coeff = &tms5110a_coeff;
96         m_coeff = &tms5110a_coeff;
23297         break;
23398      case TMS5110_IS_5100:
234         tms->coeff = &pat4209836_coeff;
99         m_coeff = &pat4209836_coeff;
235100         break;
236101      case TMS5110_IS_5110:
237         tms->coeff = &pat4403965_coeff;
102         m_coeff = &pat4403965_coeff;
238103         break;
239104      default:
240105         fatalerror("Unknown variant in tms5110_create\n");
241106   }
242107
243   tms->variant = variant;
108   m_variant = variant;
244109}
245110
246static void new_int_write(tms5110_state *tms, UINT8 rc, UINT8 m0, UINT8 m1, UINT8 addr)
111void tms5110_device::new_int_write(UINT8 rc, UINT8 m0, UINT8 m1, UINT8 addr)
247112{
248   if (!tms->m0_func.isnull())
249      tms->m0_func(m0);
250   if (!tms->m1_func.isnull())
251      tms->m1_func(m1);
252   if (!tms->addr_func.isnull())
253      tms->addr_func(0, addr);
254   if (!tms->romclk_func.isnull())
113   if (!m_m0_func.isnull())
114      m_m0_func(m0);
115   if (!m_m1_func.isnull())
116      m_m1_func(m1);
117   if (!m_addr_func.isnull())
118      m_addr_func(0, addr);
119   if (!m_romclk_func.isnull())
255120   {
256121      //printf("rc %d\n", rc);
257      tms->romclk_func(rc);
122      m_romclk_func(rc);
258123   }
259124}
260125
261static void new_int_write_addr(tms5110_state *tms, UINT8 addr)
126void tms5110_device::new_int_write_addr(UINT8 addr)
262127{
263   new_int_write(tms, 1, 0, 1, addr);
264   new_int_write(tms, 0, 0, 1, addr);
265   new_int_write(tms, 1, 0, 0, addr);
266   new_int_write(tms, 0, 0, 0, addr);
128   new_int_write(1, 0, 1, addr);
129   new_int_write(0, 0, 1, addr);
130   new_int_write(1, 0, 0, addr);
131   new_int_write(0, 0, 0, addr);
267132}
268133
269static UINT8 new_int_read(tms5110_state *tms)
134UINT8 tms5110_device::new_int_read()
270135{
271   new_int_write(tms, 1, 1, 0, 0);
272   new_int_write(tms, 0, 1, 0, 0);
273   new_int_write(tms, 1, 0, 0, 0);
274   new_int_write(tms, 0, 0, 0, 0);
275   if (!tms->data_func.isnull())
276      return tms->data_func();
136   new_int_write(1, 1, 0, 0);
137   new_int_write(0, 1, 0, 0);
138   new_int_write(1, 0, 0, 0);
139   new_int_write(0, 0, 0, 0);
140   if (!m_data_func.isnull())
141      return m_data_func();
277142   return 0;
278143}
279144
280static void register_for_save_states(tms5110_state *tms)
145void tms5110_device::register_for_save_states()
281146{
282   tms->device->save_item(NAME(tms->fifo));
283   tms->device->save_item(NAME(tms->fifo_head));
284   tms->device->save_item(NAME(tms->fifo_tail));
285   tms->device->save_item(NAME(tms->fifo_count));
147   save_item(NAME(m_fifo));
148   save_item(NAME(m_fifo_head));
149   save_item(NAME(m_fifo_tail));
150   save_item(NAME(m_fifo_count));
286151
287   tms->device->save_item(NAME(tms->PDC));
288   tms->device->save_item(NAME(tms->CTL_pins));
289   tms->device->save_item(NAME(tms->speaking_now));
290   tms->device->save_item(NAME(tms->talk_status));
291   tms->device->save_item(NAME(tms->state));
152   save_item(NAME(m_PDC));
153   save_item(NAME(m_CTL_pins));
154   save_item(NAME(m_speaking_now));
155   save_item(NAME(m_talk_status));
156   save_item(NAME(m_state));
292157
293   tms->device->save_item(NAME(tms->old_energy));
294   tms->device->save_item(NAME(tms->old_pitch));
295   tms->device->save_item(NAME(tms->old_k));
158   save_item(NAME(m_old_energy));
159   save_item(NAME(m_old_pitch));
160   save_item(NAME(m_old_k));
296161
297   tms->device->save_item(NAME(tms->new_energy));
298   tms->device->save_item(NAME(tms->new_pitch));
299   tms->device->save_item(NAME(tms->new_k));
162   save_item(NAME(m_new_energy));
163   save_item(NAME(m_new_pitch));
164   save_item(NAME(m_new_k));
300165
301   tms->device->save_item(NAME(tms->current_energy));
302   tms->device->save_item(NAME(tms->current_pitch));
303   tms->device->save_item(NAME(tms->current_k));
166   save_item(NAME(m_current_energy));
167   save_item(NAME(m_current_pitch));
168   save_item(NAME(m_current_k));
304169
305   tms->device->save_item(NAME(tms->target_energy));
306   tms->device->save_item(NAME(tms->target_pitch));
307   tms->device->save_item(NAME(tms->target_k));
170   save_item(NAME(m_target_energy));
171   save_item(NAME(m_target_pitch));
172   save_item(NAME(m_target_k));
308173
309   tms->device->save_item(NAME(tms->interp_count));
310   tms->device->save_item(NAME(tms->sample_count));
311   tms->device->save_item(NAME(tms->pitch_count));
174   save_item(NAME(m_interp_count));
175   save_item(NAME(m_sample_count));
176   save_item(NAME(m_pitch_count));
312177
313   tms->device->save_item(NAME(tms->next_is_address));
314   tms->device->save_item(NAME(tms->address));
315   tms->device->save_item(NAME(tms->schedule_dummy_read));
316   tms->device->save_item(NAME(tms->addr_bit));
178   save_item(NAME(m_next_is_address));
179   save_item(NAME(m_address));
180   save_item(NAME(m_schedule_dummy_read));
181   save_item(NAME(m_addr_bit));
317182
318   tms->device->save_item(NAME(tms->x));
183   save_item(NAME(m_x));
319184
320   tms->device->save_item(NAME(tms->RNG));
185   save_item(NAME(m_RNG));
321186}
322187
323188
r22848r22849
328193     FIFO_data_write -- handle bit data write to the TMS5110 (as a result of toggling M0 pin)
329194
330195******************************************************************************************/
331static void FIFO_data_write(tms5110_state *tms, int data)
196void tms5110_device::FIFO_data_write(int data)
332197{
333198   /* add this bit to the FIFO */
334   if (tms->fifo_count < FIFO_SIZE)
199   if (m_fifo_count < FIFO_SIZE)
335200   {
336      tms->fifo[tms->fifo_tail] = (data&1); /* set bit to 1 or 0 */
201      m_fifo[m_fifo_tail] = (data&1); /* set bit to 1 or 0 */
337202
338      tms->fifo_tail = (tms->fifo_tail + 1) % FIFO_SIZE;
339      tms->fifo_count++;
203      m_fifo_tail = (m_fifo_tail + 1) % FIFO_SIZE;
204      m_fifo_count++;
340205
341      if (DEBUG_5110) logerror("Added bit to FIFO (size=%2d)\n", tms->fifo_count);
206      if (DEBUG_5110) logerror("Added bit to FIFO (size=%2d)\n", m_fifo_count);
342207   }
343208   else
344209   {
r22848r22849
352217
353218******************************************************************************************/
354219
355static int extract_bits(tms5110_state *tms, int count)
220int tms5110_device::extract_bits(int count)
356221{
357222   int val = 0;
358223
359224   while (count--)
360225   {
361      val = (val << 1) | (tms->fifo[tms->fifo_head] & 1);
362      tms->fifo_count--;
363      tms->fifo_head = (tms->fifo_head + 1) % FIFO_SIZE;
226      val = (val << 1) | (m_fifo[m_fifo_head] & 1);
227      m_fifo_count--;
228      m_fifo_head = (m_fifo_head + 1) % FIFO_SIZE;
364229   }
365230   return val;
366231}
367232
368static void request_bits(tms5110_state *tms, int no)
233void tms5110_device::request_bits(int no)
369234{
370int i;
371   for (i=0; i<no; i++)
235   for (int i=0; i<no; i++)
372236   {
373      if (tms->M0_callback)
237      if (m_M0_callback)
374238      {
375         int data = (*tms->M0_callback)(tms->device);
376         FIFO_data_write(tms, data);
239         int data = (*m_M0_callback)(this);
240         FIFO_data_write(data);
377241      }
378242      else
379243      {
380244         //if (DEBUG_5110) logerror("-->ERROR: TMS5110 missing M0 callback function\n");
381         UINT8 data = new_int_read(tms);
382         FIFO_data_write(tms, data);
245         UINT8 data = new_int_read();
246         FIFO_data_write(data);
383247      }
384248   }
385249}
386250
387static void perform_dummy_read(tms5110_state *tms)
251void tms5110_device::perform_dummy_read()
388252{
389   if (tms->schedule_dummy_read)
253   if (m_schedule_dummy_read)
390254   {
391      if (tms->M0_callback)
255      if (m_M0_callback)
392256      {
393         int data = (*tms->M0_callback)(tms->device);
257         int data = (*m_M0_callback)(this);
394258
395259         if (DEBUG_5110) logerror("TMS5110 performing dummy read; value read = %1i\n", data&1);
396260      }
397261      else
398262      {
399         int data = new_int_read(tms);
263         int data = new_int_read();
400264
401265         if (DEBUG_5110) logerror("TMS5110 performing dummy read; value read = %1i\n", data&1);
402266         //if (DEBUG_5110) logerror("-->ERROR: TMS5110 missing M0 callback function\n");
403267      }
404      tms->schedule_dummy_read = FALSE;
268      m_schedule_dummy_read = FALSE;
405269   }
406270}
407271
r22848r22849
414278
415279***********************************************************************************************/
416280
417void tms5110_process(tms5110_state *tms, INT16 *buffer, unsigned int size)
281void tms5110_device::process(INT16 *buffer, unsigned int size)
418282{
419283   int buf_count=0;
420284   int i, interp_period, bitout;
421285   INT16 Y11, cliptemp;
422286
423287   /* if we're not speaking, fill with nothingness */
424   if (!tms->speaking_now)
288   if (!m_speaking_now)
425289      goto empty;
426290
427291   /* if we're to speak, but haven't started */
428   if (!tms->talk_status)
292   if (!m_talk_status)
429293   {
430294   /* a "dummy read" is mentioned in the tms5200 datasheet */
431295   /* The Bagman speech roms data are organized in such a way that
r22848r22849
433297   ** is the speech data. It seems that the tms5110 performs a dummy read
434298   ** just before it executes a SPEAK command.
435299   ** This has been moved to command logic ...
436   **  perform_dummy_read(tms);
300   **  perform_dummy_read();
437301   */
438302
439303      /* clear out the new frame parameters (it will become old frame just before the first call to parse_frame() ) */
440      tms->new_energy = 0;
441      tms->new_pitch = 0;
442      for (i = 0; i < tms->coeff->num_k; i++)
443         tms->new_k[i] = 0;
304      m_new_energy = 0;
305      m_new_pitch = 0;
306      for (i = 0; i < m_coeff->num_k; i++)
307         m_new_k[i] = 0;
444308
445      tms->talk_status = 1;
309      m_talk_status = 1;
446310   }
447311
448312
449313   /* loop until the buffer is full or we've stopped speaking */
450   while ((size > 0) && tms->speaking_now)
314   while ((size > 0) && m_speaking_now)
451315   {
452316      int current_val;
453317
454318      /* if we're ready for a new frame */
455      if ((tms->interp_count == 0) && (tms->sample_count == 0))
319      if ((m_interp_count == 0) && (m_sample_count == 0))
456320      {
457321         /* remember previous frame */
458         tms->old_energy = tms->new_energy;
459         tms->old_pitch = tms->new_pitch;
460         for (i = 0; i < tms->coeff->num_k; i++)
461            tms->old_k[i] = tms->new_k[i];
322         m_old_energy = m_new_energy;
323         m_old_pitch = m_new_pitch;
324         for (i = 0; i < m_coeff->num_k; i++)
325            m_old_k[i] = m_new_k[i];
462326
463327
464328         /* if the old frame was a stop frame, exit and do not process any more frames */
465         if (tms->old_energy == COEFF_ENERGY_SENTINEL)
329         if (m_old_energy == COEFF_ENERGY_SENTINEL)
466330         {
467331            if (DEBUG_5110) logerror("processing frame: stop frame\n");
468            tms->target_energy = tms->current_energy = 0;
469            tms->speaking_now = tms->talk_status = 0;
470            tms->interp_count = tms->sample_count = tms->pitch_count = 0;
332            m_target_energy = m_current_energy = 0;
333            m_speaking_now = m_talk_status = 0;
334            m_interp_count = m_sample_count = m_pitch_count = 0;
471335            goto empty;
472336         }
473337
474338
475339         /* Parse a new frame into the new_energy, new_pitch and new_k[] */
476         parse_frame(tms);
340         parse_frame();
477341
478342
479343         /* Set old target as new start of frame */
480         tms->current_energy = tms->old_energy;
481         tms->current_pitch = tms->old_pitch;
344         m_current_energy = m_old_energy;
345         m_current_pitch = m_old_pitch;
482346
483         for (i = 0; i < tms->coeff->num_k; i++)
484            tms->current_k[i] = tms->old_k[i];
347         for (i = 0; i < m_coeff->num_k; i++)
348            m_current_k[i] = m_old_k[i];
485349
486350
487351         /* is this the stop (ramp down) frame? */
488         if (tms->new_energy == COEFF_ENERGY_SENTINEL)
352         if (m_new_energy == COEFF_ENERGY_SENTINEL)
489353         {
490354            /*logerror("processing frame: ramp down\n");*/
491            tms->target_energy = 0;
492            tms->target_pitch = tms->old_pitch;
493            for (i = 0; i < tms->coeff->num_k; i++)
494               tms->target_k[i] = tms->old_k[i];
355            m_target_energy = 0;
356            m_target_pitch = m_old_pitch;
357            for (i = 0; i < m_coeff->num_k; i++)
358               m_target_k[i] = m_old_k[i];
495359         }
496         else if ((tms->old_energy == 0) && (tms->new_energy != 0)) /* was the old frame a zero-energy frame? */
360         else if ((m_old_energy == 0) && (m_new_energy != 0)) /* was the old frame a zero-energy frame? */
497361         {
498362            /* if so, and if the new frame is non-zero energy frame then the new parameters
499363               should become our current and target parameters immediately,
r22848r22849
501365            */
502366
503367            /*logerror("processing non-zero energy frame after zero-energy frame\n");*/
504            tms->target_energy = tms->new_energy;
505            tms->target_pitch = tms->current_pitch = tms->new_pitch;
506            for (i = 0; i < tms->coeff->num_k; i++)
507               tms->target_k[i] = tms->current_k[i] = tms->new_k[i];
368            m_target_energy = m_new_energy;
369            m_target_pitch = m_current_pitch = m_new_pitch;
370            for (i = 0; i < m_coeff->num_k; i++)
371               m_target_k[i] = m_current_k[i] = m_new_k[i];
508372         }
509         else if ((tms->old_pitch == 0) && (tms->new_pitch != 0))    /* is this a change from unvoiced to voiced frame ? */
373         else if ((m_old_pitch == 0) && (m_new_pitch != 0))    /* is this a change from unvoiced to voiced frame ? */
510374         {
511375            /* if so, then the new parameters should become our current and target parameters immediately,
512376               i.e. we should NOT interpolate them slowly in.
513377            */
514378            /*if (DEBUG_5110) logerror("processing frame: UNVOICED->VOICED frame change\n");*/
515            tms->target_energy = tms->new_energy;
516            tms->target_pitch = tms->current_pitch = tms->new_pitch;
517            for (i = 0; i < tms->coeff->num_k; i++)
518               tms->target_k[i] = tms->current_k[i] = tms->new_k[i];
379            m_target_energy = m_new_energy;
380            m_target_pitch = m_current_pitch = m_new_pitch;
381            for (i = 0; i < m_coeff->num_k; i++)
382               m_target_k[i] = m_current_k[i] = m_new_k[i];
519383         }
520         else if ((tms->old_pitch != 0) && (tms->new_pitch == 0))    /* is this a change from voiced to unvoiced frame ? */
384         else if ((m_old_pitch != 0) && (m_new_pitch == 0))    /* is this a change from voiced to unvoiced frame ? */
521385         {
522386            /* if so, then the new parameters should become our current and target parameters immediately,
523387               i.e. we should NOT interpolate them slowly in.
524388            */
525389            /*if (DEBUG_5110) logerror("processing frame: VOICED->UNVOICED frame change\n");*/
526            tms->target_energy = tms->new_energy;
527            tms->target_pitch = tms->current_pitch = tms->new_pitch;
528            for (i = 0; i < tms->coeff->num_k; i++)
529               tms->target_k[i] = tms->current_k[i] = tms->new_k[i];
390            m_target_energy = m_new_energy;
391            m_target_pitch = m_current_pitch = m_new_pitch;
392            for (i = 0; i < m_coeff->num_k; i++)
393               m_target_k[i] = m_current_k[i] = m_new_k[i];
530394         }
531395         else
532396         {
r22848r22849
534398            /*logerror("*** Energy = %d\n",current_energy);*/
535399            /*logerror("proc: %d %d\n",last_fbuf_head,fbuf_head);*/
536400
537            tms->target_energy = tms->new_energy;
538            tms->target_pitch = tms->new_pitch;
539            for (i = 0; i < tms->coeff->num_k; i++)
540               tms->target_k[i] = tms->new_k[i];
401            m_target_energy = m_new_energy;
402            m_target_pitch = m_new_pitch;
403            for (i = 0; i < m_coeff->num_k; i++)
404               m_target_k[i] = m_new_k[i];
541405         }
542406      }
543407      else
544408      {
545         interp_period = tms->sample_count / 25;
546         switch(tms->interp_count)
409         interp_period = m_sample_count / 25;
410         switch(m_interp_count)
547411         {
548412            /*         PC=X  X cycle, rendering change (change for next cycle which chip is actually doing) */
549413            case 0: /* PC=0, A cycle, nothing happens (calc energy) */
r22848r22849
551415            case 1: /* PC=0, B cycle, nothing happens (update energy) */
552416            break;
553417            case 2: /* PC=1, A cycle, update energy (calc pitch) */
554            tms->current_energy += ((tms->target_energy - tms->current_energy) >> tms->coeff->interp_coeff[interp_period]);
418            m_current_energy += ((m_target_energy - m_current_energy) >> m_coeff->interp_coeff[interp_period]);
555419            break;
556420            case 3: /* PC=1, B cycle, nothing happens (update pitch) */
557421            break;
558422            case 4: /* PC=2, A cycle, update pitch (calc K1) */
559            tms->current_pitch += ((tms->target_pitch - tms->current_pitch) >> tms->coeff->interp_coeff[interp_period]);
423            m_current_pitch += ((m_target_pitch - m_current_pitch) >> m_coeff->interp_coeff[interp_period]);
560424            break;
561425            case 5: /* PC=2, B cycle, nothing happens (update K1) */
562426            break;
563427            case 6: /* PC=3, A cycle, update K1 (calc K2) */
564            tms->current_k[0] += ((tms->target_k[0] - tms->current_k[0]) >> tms->coeff->interp_coeff[interp_period]);
428            m_current_k[0] += ((m_target_k[0] - m_current_k[0]) >> m_coeff->interp_coeff[interp_period]);
565429            break;
566430            case 7: /* PC=3, B cycle, nothing happens (update K2) */
567431            break;
568432            case 8: /* PC=4, A cycle, update K2 (calc K3) */
569            tms->current_k[1] += ((tms->target_k[1] - tms->current_k[1]) >> tms->coeff->interp_coeff[interp_period]);
433            m_current_k[1] += ((m_target_k[1] - m_current_k[1]) >> m_coeff->interp_coeff[interp_period]);
570434            break;
571435            case 9: /* PC=4, B cycle, nothing happens (update K3) */
572436            break;
573437            case 10: /* PC=5, A cycle, update K3 (calc K4) */
574            tms->current_k[2] += ((tms->target_k[2] - tms->current_k[2]) >> tms->coeff->interp_coeff[interp_period]);
438            m_current_k[2] += ((m_target_k[2] - m_current_k[2]) >> m_coeff->interp_coeff[interp_period]);
575439            break;
576440            case 11: /* PC=5, B cycle, nothing happens (update K4) */
577441            break;
578442            case 12: /* PC=6, A cycle, update K4 (calc K5) */
579            tms->current_k[3] += ((tms->target_k[3] - tms->current_k[3]) >> tms->coeff->interp_coeff[interp_period]);
443            m_current_k[3] += ((m_target_k[3] - m_current_k[3]) >> m_coeff->interp_coeff[interp_period]);
580444            break;
581445            case 13: /* PC=6, B cycle, nothing happens (update K5) */
582446            break;
583447            case 14: /* PC=7, A cycle, update K5 (calc K6) */
584            tms->current_k[4] += ((tms->target_k[4] - tms->current_k[4]) >> tms->coeff->interp_coeff[interp_period]);
448            m_current_k[4] += ((m_target_k[4] - m_current_k[4]) >> m_coeff->interp_coeff[interp_period]);
585449            break;
586450            case 15: /* PC=7, B cycle, nothing happens (update K6) */
587451            break;
588452            case 16: /* PC=8, A cycle, update K6 (calc K7) */
589            tms->current_k[5] += ((tms->target_k[5] - tms->current_k[5]) >> tms->coeff->interp_coeff[interp_period]);
453            m_current_k[5] += ((m_target_k[5] - m_current_k[5]) >> m_coeff->interp_coeff[interp_period]);
590454            break;
591455            case 17: /* PC=8, B cycle, nothing happens (update K7) */
592456            break;
593457            case 18: /* PC=9, A cycle, update K7 (calc K8) */
594            tms->current_k[6] += ((tms->target_k[6] - tms->current_k[6]) >> tms->coeff->interp_coeff[interp_period]);
458            m_current_k[6] += ((m_target_k[6] - m_current_k[6]) >> m_coeff->interp_coeff[interp_period]);
595459            break;
596460            case 19: /* PC=9, B cycle, nothing happens (update K8) */
597461            break;
598462            case 20: /* PC=10, A cycle, update K8 (calc K9) */
599            tms->current_k[7] += ((tms->target_k[7] - tms->current_k[7]) >> tms->coeff->interp_coeff[interp_period]);
463            m_current_k[7] += ((m_target_k[7] - m_current_k[7]) >> m_coeff->interp_coeff[interp_period]);
600464            break;
601465            case 21: /* PC=10, B cycle, nothing happens (update K9) */
602466            break;
603467            case 22: /* PC=11, A cycle, update K9 (calc K10) */
604            tms->current_k[8] += ((tms->target_k[8] - tms->current_k[8]) >> tms->coeff->interp_coeff[interp_period]);
468            m_current_k[8] += ((m_target_k[8] - m_current_k[8]) >> m_coeff->interp_coeff[interp_period]);
605469            break;
606470            case 23: /* PC=11, B cycle, nothing happens (update K10) */
607471            break;
608472            case 24: /* PC=12, A cycle, update K10 (do nothing) */
609            tms->current_k[9] += ((tms->target_k[9] - tms->current_k[9]) >> tms->coeff->interp_coeff[interp_period]);
473            m_current_k[9] += ((m_target_k[9] - m_current_k[9]) >> m_coeff->interp_coeff[interp_period]);
610474            break;
611475         }
612476      }
r22848r22849
614478
615479      /* calculate the output */
616480
617      if (tms->current_energy == 0)
481      if (m_current_energy == 0)
618482      {
619483         /* generate silent samples here */
620484         current_val = 0x00;
621485      }
622      else if (tms->old_pitch == 0)
486      else if (m_old_pitch == 0)
623487      {
624488         /* generate unvoiced samples here */
625         if (tms->RNG&1)
489         if (m_RNG&1)
626490            current_val = -64; /* according to the patent it is (either + or -) half of the maximum value in the chirp table */
627491         else
628492            current_val = 64;
r22848r22849
639503          * (address 50d holds zeroes)
640504          */
641505
642      /*if (tms->coeff->subtype & (SUBTYPE_TMS5100 | SUBTYPE_M58817))*/
506      /*if (m_coeff->subtype & (SUBTYPE_TMS5100 | SUBTYPE_M58817))*/
643507
644      if (tms->pitch_count > 50)
645         current_val = tms->coeff->chirptable[50];
508      if (m_pitch_count > 50)
509         current_val = m_coeff->chirptable[50];
646510      else
647         current_val = tms->coeff->chirptable[tms->pitch_count];
511         current_val = m_coeff->chirptable[m_pitch_count];
648512      }
649513
650514      /* Update LFSR *20* times every sample, like patent shows */
651515      for (i=0; i<20; i++)
652516      {
653         bitout = ((tms->RNG>>12)&1) ^
654               ((tms->RNG>>10)&1) ^
655               ((tms->RNG>> 9)&1) ^
656               ((tms->RNG>> 0)&1);
657         tms->RNG >>= 1;
658         tms->RNG |= (bitout<<12);
517         bitout = ((m_RNG>>12)&1) ^
518               ((m_RNG>>10)&1) ^
519               ((m_RNG>> 9)&1) ^
520               ((m_RNG>> 0)&1);
521         m_RNG >>= 1;
522         m_RNG |= (bitout<<12);
659523      }
660524
661525      /* Lattice filter here */
662526
663      Y11 = (current_val * 64 * tms->current_energy) / 512;
527      Y11 = (current_val * 64 * m_current_energy) / 512;
664528
665      for (i = tms->coeff->num_k - 1; i >= 0; i--)
529      for (i = m_coeff->num_k - 1; i >= 0; i--)
666530      {
667         Y11 = Y11 - ((tms->current_k[i] * tms->x[i]) / 512);
668         tms->x[i+1] = tms->x[i] + ((tms->current_k[i] * Y11) / 512);
531         Y11 = Y11 - ((m_current_k[i] * m_x[i]) / 512);
532         m_x[i+1] = m_x[i] + ((m_current_k[i] * Y11) / 512);
669533      }
670534
671      tms->x[0] = Y11;
535      m_x[0] = Y11;
672536
673537
674538      /* clipping & wrapping, just like the patent */
r22848r22849
677541      cliptemp = Y11 / 16;
678542
679543      /* M58817 seems to be different */
680      if (tms->coeff->subtype & (SUBTYPE_M58817))
544      if (m_coeff->subtype & (SUBTYPE_M58817))
681545         cliptemp = cliptemp / 2;
682546
683547      if (cliptemp > 511) cliptemp = -512 + (cliptemp-511);
r22848r22849
692556
693557      /* Update all counts */
694558
695      tms->sample_count = (tms->sample_count + 1) % 200;
559      m_sample_count = (m_sample_count + 1) % 200;
696560
697      if (tms->current_pitch != 0)
561      if (m_current_pitch != 0)
698562      {
699         tms->pitch_count++;
700         if (tms->pitch_count >= tms->current_pitch)
701            tms->pitch_count = 0;
563         m_pitch_count++;
564         if (m_pitch_count >= m_current_pitch)
565            m_pitch_count = 0;
702566      }
703567      else
704         tms->pitch_count = 0;
568         m_pitch_count = 0;
705569
706      tms->interp_count = (tms->interp_count + 1) % 25;
570      m_interp_count = (m_interp_count + 1) % 25;
707571
708572      buf_count++;
709573      size--;
r22848r22849
713577
714578   while (size > 0)
715579   {
716      tms->sample_count = (tms->sample_count + 1) % 200;
717      tms->interp_count = (tms->interp_count + 1) % 25;
580      m_sample_count = (m_sample_count + 1) % 200;
581      m_interp_count = (m_interp_count + 1) % 25;
718582
719583      buffer[buf_count] = 0x00;
720584      buf_count++;
r22848r22849
730594
731595******************************************************************************************/
732596
733void tms5110_PDC_set(tms5110_state *tms, int data)
597void tms5110_device::PDC_set(int data)
734598{
735   if (tms->PDC != (data & 0x1) )
599   if (m_PDC != (data & 0x1) )
736600   {
737      tms->PDC = data & 0x1;
738      if (tms->PDC == 0) /* toggling 1->0 processes command on CTL_pins */
601      m_PDC = data & 0x1;
602      if (m_PDC == 0) /* toggling 1->0 processes command on CTL_pins */
739603      {
740604         /* first pdc toggles output, next toggles input */
741         switch (tms->state)
605         switch (m_state)
742606         {
743607         case CTL_STATE_INPUT:
744608            /* continue */
745609            break;
746610         case CTL_STATE_NEXT_OUTPUT:
747            tms->state = CTL_STATE_OUTPUT;
611            m_state = CTL_STATE_OUTPUT;
748612            return;
749613         case CTL_STATE_OUTPUT:
750            tms->state = CTL_STATE_INPUT;
614            m_state = CTL_STATE_INPUT;
751615            return;
752616         }
753617         /* the only real commands we handle now are SPEAK and RESET */
754         if (tms->next_is_address)
618         if (m_next_is_address)
755619         {
756            tms->next_is_address = FALSE;
757            tms->address = tms->address | ((tms->CTL_pins & 0x0F)<<tms->addr_bit);
758            tms->addr_bit = (tms->addr_bit + 4) % 12;
759            tms->schedule_dummy_read = TRUE;
760            if (tms->set_load_address)
761               tms->set_load_address(tms->device, tms->address);
762            new_int_write_addr(tms, tms->CTL_pins & 0x0F);
620            m_next_is_address = FALSE;
621            m_address = m_address | ((m_CTL_pins & 0x0F)<<m_addr_bit);
622            m_addr_bit = (m_addr_bit + 4) % 12;
623            m_schedule_dummy_read = TRUE;
624            if (m_set_load_address)
625               m_set_load_address(this, m_address);
626            new_int_write_addr(m_CTL_pins & 0x0F);
763627         }
764628         else
765629         {
766            switch (tms->CTL_pins & 0xe) /*CTL1 - don't care*/
630            switch (m_CTL_pins & 0xe) /*CTL1 - don't care*/
767631            {
768632            case TMS5110_CMD_SPEAK:
769               perform_dummy_read(tms);
770               tms->speaking_now = 1;
633               perform_dummy_read();
634               m_speaking_now = 1;
771635
772636               //should FIFO be cleared now ?????
773637               break;
774638
775639            case TMS5110_CMD_RESET:
776               perform_dummy_read(tms);
777               tms->device->reset();
640               perform_dummy_read();
641               reset();
778642               break;
779643
780644            case TMS5110_CMD_READ_BIT:
781               if (tms->schedule_dummy_read)
782                  perform_dummy_read(tms);
645               if (m_schedule_dummy_read)
646                  perform_dummy_read();
783647               else
784648               {
785                  request_bits(tms, 1);
786                  tms->CTL_pins = (tms->CTL_pins & 0x0E) | extract_bits(tms, 1);
649                  request_bits(1);
650                  m_CTL_pins = (m_CTL_pins & 0x0E) | extract_bits(1);
787651               }
788652               break;
789653
790654            case TMS5110_CMD_LOAD_ADDRESS:
791               tms->next_is_address = TRUE;
655               m_next_is_address = TRUE;
792656               break;
793657
794658            case TMS5110_CMD_READ_BRANCH:
795               new_int_write(tms, 0,1,1,0);
796               new_int_write(tms, 1,1,1,0);
797               new_int_write(tms, 0,1,1,0);
798               new_int_write(tms, 0,0,0,0);
799               new_int_write(tms, 1,0,0,0);
800               new_int_write(tms, 0,0,0,0);
801               tms->schedule_dummy_read = FALSE;
659               new_int_write(0,1,1,0);
660               new_int_write(1,1,1,0);
661               new_int_write(0,1,1,0);
662               new_int_write(0,0,0,0);
663               new_int_write(1,0,0,0);
664               new_int_write(0,0,0,0);
665               m_schedule_dummy_read = FALSE;
802666               break;
803667
804668            case TMS5110_CMD_TEST_TALK:
805               tms->state = CTL_STATE_NEXT_OUTPUT;
669               m_state = CTL_STATE_NEXT_OUTPUT;
806670               break;
807671
808672            default:
809               logerror("tms5110.c: unknown command: 0x%02x\n", tms->CTL_pins);
673               logerror("tms5110.c: unknown command: 0x%02x\n", m_CTL_pins);
810674               break;
811675            }
812676
r22848r22849
823687
824688******************************************************************************************/
825689
826static void parse_frame(tms5110_state *tms)
690void tms5110_device::parse_frame()
827691{
828692   int bits, indx, i, rep_flag;
829693#if (DEBUG_5110)
r22848r22849
831695#endif
832696
833697   /* count the total number of bits available */
834   bits = tms->fifo_count;
698   bits = m_fifo_count;
835699
836700
837701   /* attempt to extract the energy index */
838   bits -= tms->coeff->energy_bits;
702   bits -= m_coeff->energy_bits;
839703   if (bits < 0)
840704   {
841      request_bits( tms,-bits ); /* toggle M0 to receive needed bits */
705      request_bits( -bits ); /* toggle M0 to receive needed bits */
842706      bits = 0;
843707   }
844   indx = extract_bits(tms,tms->coeff->energy_bits);
845   tms->new_energy = tms->coeff->energytable[indx];
708   indx = extract_bits(m_coeff->energy_bits);
709   m_new_energy = m_coeff->energytable[indx];
846710#if (DEBUG_5110)
847711   ene = indx;
848712#endif
r22848r22849
851715
852716   if ((indx == 0) || (indx == 15))
853717   {
854      if (DEBUG_5110) logerror("  (4-bit energy=%d frame)\n",tms->new_energy);
718      if (DEBUG_5110) logerror("  (4-bit energy=%d frame)\n",m_new_energy);
855719
856720   /* clear the k's */
857721      if (indx == 0)
858722      {
859         for (i = 0; i < tms->coeff->num_k; i++)
860            tms->new_k[i] = 0;
723         for (i = 0; i < m_coeff->num_k; i++)
724            m_new_k[i] = 0;
861725      }
862726
863727      /* clear fifo if stop frame encountered */
864728      if (indx == 15)
865729      {
866         if (DEBUG_5110) logerror("  (4-bit energy=%d STOP frame)\n",tms->new_energy);
867         tms->fifo_head = tms->fifo_tail = tms->fifo_count = 0;
730         if (DEBUG_5110) logerror("  (4-bit energy=%d STOP frame)\n",m_new_energy);
731         m_fifo_head = m_fifo_tail = m_fifo_count = 0;
868732      }
869733      return;
870734   }
r22848r22849
874738   bits -= 1;
875739   if (bits < 0)
876740   {
877      request_bits( tms,-bits ); /* toggle M0 to receive needed bits */
741      request_bits( -bits ); /* toggle M0 to receive needed bits */
878742      bits = 0;
879743   }
880   rep_flag = extract_bits(tms,1);
744   rep_flag = extract_bits(1);
881745
882746   /* attempt to extract the pitch */
883   bits -= tms->coeff->pitch_bits;
747   bits -= m_coeff->pitch_bits;
884748   if (bits < 0)
885749   {
886      request_bits( tms,-bits ); /* toggle M0 to receive needed bits */
750      request_bits( -bits ); /* toggle M0 to receive needed bits */
887751      bits = 0;
888752   }
889   indx = extract_bits(tms,tms->coeff->pitch_bits);
890   tms->new_pitch = tms->coeff->pitchtable[indx];
753   indx = extract_bits(m_coeff->pitch_bits);
754   m_new_pitch = m_coeff->pitchtable[indx];
891755
892756   /* if this is a repeat frame, just copy the k's */
893757   if (rep_flag)
894758   {
895759   //actually, we do nothing because the k's were already loaded (on parsing the previous frame)
896760
897      if (DEBUG_5110) logerror("  (10-bit energy=%d pitch=%d rep=%d frame)\n", tms->new_energy, tms->new_pitch, rep_flag);
761      if (DEBUG_5110) logerror("  (10-bit energy=%d pitch=%d rep=%d frame)\n", m_new_energy, m_new_pitch, rep_flag);
898762      return;
899763   }
900764
r22848r22849
906770      bits -= 18;
907771      if (bits < 0)
908772      {
909      request_bits( tms,-bits ); /* toggle M0 to receive needed bits */
773      request_bits( -bits ); /* toggle M0 to receive needed bits */
910774      bits = 0;
911775      }
912776      for (i = 0; i < 4; i++)
913         tms->new_k[i] = tms->coeff->ktable[i][extract_bits(tms,tms->coeff->kbits[i])];
777         m_new_k[i] = m_coeff->ktable[i][extract_bits(m_coeff->kbits[i])];
914778
915779   /* and clear the rest of the new_k[] */
916      for (i = 4; i < tms->coeff->num_k; i++)
917         tms->new_k[i] = 0;
780      for (i = 4; i < m_coeff->num_k; i++)
781         m_new_k[i] = 0;
918782
919      if (DEBUG_5110) logerror("  (28-bit energy=%d pitch=%d rep=%d 4K frame)\n", tms->new_energy, tms->new_pitch, rep_flag);
783      if (DEBUG_5110) logerror("  (28-bit energy=%d pitch=%d rep=%d 4K frame)\n", m_new_energy, m_new_pitch, rep_flag);
920784      return;
921785   }
922786
r22848r22849
924788   bits -= 39;
925789   if (bits < 0)
926790   {
927         request_bits( tms,-bits ); /* toggle M0 to receive needed bits */
791         request_bits( -bits ); /* toggle M0 to receive needed bits */
928792      bits = 0;
929793   }
930794#if (DEBUG_5110)
931795   printf("FrameDump %02d ", ene);
932   for (i = 0; i < tms->coeff->num_k; i++)
796   for (i = 0; i < m_coeff->num_k; i++)
933797   {
934798      int x;
935      x = extract_bits(tms, tms->coeff->kbits[i]);
936      tms->new_k[i] = tms->coeff->ktable[i][x];
799      x = extract_bits( m_coeff->kbits[i]);
800      m_new_k[i] = m_coeff->ktable[i][x];
937801      printf("%02d ", x);
938802   }
939803   printf("\n");
940804#else
941   for (i = 0; i < tms->coeff->num_k; i++)
805   for (i = 0; i < m_coeff->num_k; i++)
942806   {
943807      int x;
944      x = extract_bits(tms, tms->coeff->kbits[i]);
945      tms->new_k[i] = tms->coeff->ktable[i][x];
808      x = extract_bits( m_coeff->kbits[i]);
809      m_new_k[i] = m_coeff->ktable[i][x];
946810   }
947811#endif
948   if (DEBUG_5110) logerror("  (49-bit energy=%d pitch=%d rep=%d 10K frame)\n", tms->new_energy, tms->new_pitch, rep_flag);
812   if (DEBUG_5110) logerror("  (49-bit energy=%d pitch=%d rep=%d 10K frame)\n", m_new_energy, m_new_pitch, rep_flag);
949813
950814}
951815
r22848r22849
976840
977841static int speech_rom_read_bit(device_t *device)
978842{
979   tms5110_state *tms = get_safe_token(device);
843   tms5110_device *tms5110 = (tms5110_device *) device;
844   return tms5110->_speech_rom_read_bit();
845}
980846
847int tms5110_device::_speech_rom_read_bit()
848{
981849   int r;
982850
983   if (tms->speech_rom_bitnum<0)
851   if (m_speech_rom_bitnum<0)
984852      r = 0;
985853   else
986      r = (tms->table[tms->speech_rom_bitnum >> 3] >> (0x07 - (tms->speech_rom_bitnum & 0x07))) & 1;
854      r = (m_table[m_speech_rom_bitnum >> 3] >> (0x07 - (m_speech_rom_bitnum & 0x07))) & 1;
987855
988   tms->speech_rom_bitnum++;
856   m_speech_rom_bitnum++;
989857
990858   return r;
991859}
992860
993861static void speech_rom_set_addr(device_t *device, int addr)
994862{
995   tms5110_state *tms = get_safe_token(device);
863   tms5110_device *tms5110 = (tms5110_device *) device;
864   tms5110->_speech_rom_set_addr(addr);
865}
996866
997   tms->speech_rom_bitnum = addr * 8 - 1;
867void tms5110_device::_speech_rom_set_addr(int addr)
868{
869   m_speech_rom_bitnum = addr * 8 - 1;
998870}
999871
1000872/******************************************************************************
r22848r22849
1004876******************************************************************************/
1005877
1006878
1007static DEVICE_START( tms5110 )
879//-------------------------------------------------
880//  device_start - device-specific startup
881//-------------------------------------------------
882
883void tms5110_device::device_start()
1008884{
1009885   static const tms5110_interface dummy = { NULL, NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL};
1010   tms5110_state *tms = get_safe_token(device);
1011886
1012   assert_always(tms != NULL, "Error creating TMS5110 chip");
887   assert_always(static_config() != NULL, "No config");
1013888
1014   assert_always(device->static_config() != NULL, "No config");
889   m_intf = static_config() ? (const tms5110_interface *)static_config() : &dummy;
890   m_table = *region();
1015891
1016   tms->intf = device->static_config() ? (const tms5110_interface *)device->static_config() : &dummy;
1017   tms->table = *device->region();
892   set_variant(TMS5110_IS_5110A);
1018893
1019   tms->device = device;
1020   tms5110_set_variant(tms, TMS5110_IS_5110A);
1021
1022894   /* resolve lines */
1023   tms->m0_func.resolve(tms->intf->m0_func, *device);
1024   tms->m1_func.resolve(tms->intf->m1_func, *device);
1025   tms->romclk_func.resolve(tms->intf->romclk_func, *device);
1026   tms->addr_func.resolve(tms->intf->addr_func, *device);
1027   tms->data_func.resolve(tms->intf->data_func, *device);
895   m_m0_func.resolve(m_intf->m0_func, *this);
896   m_m1_func.resolve(m_intf->m1_func, *this);
897   m_romclk_func.resolve(m_intf->romclk_func, *this);
898   m_addr_func.resolve(m_intf->addr_func, *this);
899   m_data_func.resolve(m_intf->data_func, *this);
1028900
1029901   /* initialize a stream */
1030   tms->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() / 80, tms, tms5110_update);
902   m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / 80);
1031903
1032   if (tms->table == NULL)
904   if (m_table == NULL)
1033905   {
1034906#if 0
1035      assert_always(tms->intf->M0_callback != NULL, "Missing _mandatory_ 'M0_callback' function pointer in the TMS5110 interface\n  This function is used by TMS5110 to call for a single bits\n  needed to generate the speech\n  Aborting startup...\n");
907      assert_always(m_intf->M0_callback != NULL, "Missing _mandatory_ 'M0_callback' function pointer in the TMS5110 interface\n  This function is used by TMS5110 to call for a single bits\n  needed to generate the speech\n  Aborting startup...\n");
1036908#endif
1037      tms->M0_callback = tms->intf->M0_callback;
1038      tms->set_load_address = tms->intf->load_address;
909      m_M0_callback = m_intf->M0_callback;
910      m_set_load_address = m_intf->load_address;
1039911   }
1040912   else
1041913   {
1042      tms->M0_callback = speech_rom_read_bit;
1043      tms->set_load_address = speech_rom_set_addr;
914      m_M0_callback = speech_rom_read_bit;
915      m_set_load_address = speech_rom_set_addr;
1044916   }
1045917
1046   tms->state = CTL_STATE_INPUT; /* most probably not defined */
1047   tms->romclk_hack_timer = device->machine().scheduler().timer_alloc(FUNC(romclk_hack_timer_cb), (void *) device);
918   m_state = CTL_STATE_INPUT; /* most probably not defined */
919   m_romclk_hack_timer = timer_alloc(0);
1048920
1049   register_for_save_states(tms);
921   register_for_save_states();
1050922}
1051923
1052static DEVICE_START( tms5100 )
924//-------------------------------------------------
925//  device_start - device-specific startup
926//-------------------------------------------------
927
928void tms5100_device::device_start()
1053929{
1054   tms5110_state *tms = get_safe_token(device);
1055   DEVICE_START_CALL( tms5110 );
1056   tms5110_set_variant(tms, TMS5110_IS_5100);
930   tms5110_device::device_start();
931   set_variant(TMS5110_IS_5100);
1057932}
1058933
1059static DEVICE_START( tms5110a )
934//-------------------------------------------------
935//  device_start - device-specific startup
936//-------------------------------------------------
937
938void tms5110a_device::device_start()
1060939{
1061   tms5110_state *tms = get_safe_token(device);
1062   DEVICE_START_CALL( tms5110 );
1063   tms5110_set_variant(tms, TMS5110_IS_5110A);
940   tms5110_device::device_start();
941   set_variant(TMS5110_IS_5110A);
1064942}
1065943
1066static DEVICE_START( cd2801 )
944//-------------------------------------------------
945//  device_start - device-specific startup
946//-------------------------------------------------
947
948void cd2801_device::device_start()
1067949{
1068   tms5110_state *tms = get_safe_token(device);
1069   DEVICE_START_CALL( tms5110 );
1070   tms5110_set_variant(tms, TMS5110_IS_CD2801);
950   tms5110_device::device_start();
951   set_variant(TMS5110_IS_CD2801);
1071952}
1072953
1073static DEVICE_START( tmc0281 )
954//-------------------------------------------------
955//  device_start - device-specific startup
956//-------------------------------------------------
957
958void tmc0281_device::device_start()
1074959{
1075   tms5110_state *tms = get_safe_token(device);
1076   DEVICE_START_CALL( tms5110 );
1077   tms5110_set_variant(tms, TMS5110_IS_TMC0281);
960   tms5110_device::device_start();
961   set_variant(TMS5110_IS_TMC0281);
1078962}
1079963
1080static DEVICE_START( cd2802 )
964//-------------------------------------------------
965//  device_start - device-specific startup
966//-------------------------------------------------
967
968void cd2802_device::device_start()
1081969{
1082   tms5110_state *tms = get_safe_token(device);
1083   DEVICE_START_CALL( tms5110 );
1084   tms5110_set_variant(tms, TMS5110_IS_CD2802);
970   tms5110_device::device_start();
971   set_variant(TMS5110_IS_CD2802);
1085972}
1086973
1087static DEVICE_START( m58817 )
974//-------------------------------------------------
975//  device_start - device-specific startup
976//-------------------------------------------------
977
978void m58817_device::device_start()
1088979{
1089   tms5110_state *tms = get_safe_token(device);
1090   DEVICE_START_CALL( tms5110 );
1091   tms5110_set_variant(tms, TMS5110_IS_M58817);
980   tms5110_device::device_start();
981   set_variant(TMS5110_IS_M58817);
1092982}
1093983
1094984
1095static DEVICE_RESET( tms5110 )
1096{
1097   tms5110_state *tms = get_safe_token(device);
985//-------------------------------------------------
986//  device_reset - device-specific reset
987//-------------------------------------------------
1098988
989void tms5110_device::device_reset()
990{
1099991   /* initialize the FIFO */
1100   memset(tms->fifo, 0, sizeof(tms->fifo));
1101   tms->fifo_head = tms->fifo_tail = tms->fifo_count = 0;
992   memset(m_fifo, 0, sizeof(m_fifo));
993   m_fifo_head = m_fifo_tail = m_fifo_count = 0;
1102994
1103995   /* initialize the chip state */
1104   tms->speaking_now = tms->talk_status = 0;
1105   tms->CTL_pins = 0;
1106      tms->RNG = 0x1fff;
996   m_speaking_now = m_talk_status = 0;
997   m_CTL_pins = 0;
998      m_RNG = 0x1fff;
1107999
11081000   /* initialize the energy/pitch/k states */
1109   tms->old_energy = tms->new_energy = tms->current_energy = tms->target_energy = 0;
1110   tms->old_pitch = tms->new_pitch = tms->current_pitch = tms->target_pitch = 0;
1111   memset(tms->old_k, 0, sizeof(tms->old_k));
1112   memset(tms->new_k, 0, sizeof(tms->new_k));
1113   memset(tms->current_k, 0, sizeof(tms->current_k));
1114   memset(tms->target_k, 0, sizeof(tms->target_k));
1001   m_old_energy = m_new_energy = m_current_energy = m_target_energy = 0;
1002   m_old_pitch = m_new_pitch = m_current_pitch = m_target_pitch = 0;
1003   memset(m_old_k, 0, sizeof(m_old_k));
1004   memset(m_new_k, 0, sizeof(m_new_k));
1005   memset(m_current_k, 0, sizeof(m_current_k));
1006   memset(m_target_k, 0, sizeof(m_target_k));
11151007
11161008   /* initialize the sample generators */
1117   tms->interp_count = tms->sample_count = tms->pitch_count = 0;
1118   memset(tms->x, 0, sizeof(tms->x));
1119   tms->next_is_address = FALSE;
1120   tms->address = 0;
1121   if (tms->table != NULL || tms->M0_callback != NULL)
1009   m_interp_count = m_sample_count = m_pitch_count = 0;
1010   memset(m_x, 0, sizeof(m_x));
1011   m_next_is_address = FALSE;
1012   m_address = 0;
1013   if (m_table != NULL || m_M0_callback != NULL)
11221014   {
11231015      /* legacy interface */
1124      tms->schedule_dummy_read = TRUE;
1016      m_schedule_dummy_read = TRUE;
11251017
11261018   }
11271019   else
r22848r22849
11291021      /* no dummy read! This makes bagman and ad2083 speech fail
11301022       * with the new cycle and transition exact interfaces
11311023       */
1132      tms->schedule_dummy_read = FALSE;
1024      m_schedule_dummy_read = FALSE;
11331025   }
1134   tms->addr_bit = 0;
1026   m_addr_bit = 0;
11351027}
11361028
11371029
r22848r22849
11431035
11441036******************************************************************************/
11451037
1146WRITE8_DEVICE_HANDLER( tms5110_ctl_w )
1038WRITE8_MEMBER( tms5110_device::ctl_w )
11471039{
1148   tms5110_state *tms = get_safe_token(device);
1149
11501040   /* bring up to date first */
1151   tms->stream->update();
1152   tms->CTL_pins = data & 0xf;
1041   m_stream->update();
1042   m_CTL_pins = data & 0xf;
11531043}
11541044
11551045
r22848r22849
11591049
11601050******************************************************************************/
11611051
1162WRITE_LINE_DEVICE_HANDLER( tms5110_pdc_w )
1052WRITE_LINE_MEMBER( tms5110_device::pdc_w )
11631053{
1164   tms5110_state *tms = get_safe_token(device);
1165
11661054   /* bring up to date first */
1167   tms->stream->update();
1168   tms5110_PDC_set(tms, state);
1055   m_stream->update();
1056   PDC_set(state);
11691057}
11701058
11711059
r22848r22849
11851073
11861074******************************************************************************/
11871075
1188READ8_DEVICE_HANDLER( tms5110_ctl_r )
1076READ8_MEMBER( tms5110_device::ctl_r )
11891077{
1190   tms5110_state *tms = get_safe_token(device);
1191
11921078   /* bring up to date first */
1193   tms->stream->update();
1194   if (tms->state == CTL_STATE_OUTPUT)
1079   m_stream->update();
1080   if (m_state == CTL_STATE_OUTPUT)
11951081   {
1196      //if (DEBUG_5110) logerror("Status read (status=%2d)\n", tms->talk_status);
1197      return (tms->talk_status << 0); /*CTL1 = still talking ? */
1082      //if (DEBUG_5110) logerror("Status read (status=%2d)\n", m_talk_status);
1083      return (m_talk_status << 0); /*CTL1 = still talking ? */
11981084   }
11991085   else
12001086   {
r22848r22849
12031089   }
12041090}
12051091
1206READ8_DEVICE_HANDLER( m58817_status_r )
1092READ8_MEMBER( m58817_device::status_r )
12071093{
1208   tms5110_state *tms = get_safe_token(device);
1209
12101094   /* bring up to date first */
1211   tms->stream->update();
1212   return (tms->talk_status << 0); /*CTL1 = still talking ? */
1095   m_stream->update();
1096   return (m_talk_status << 0); /*CTL1 = still talking ? */
12131097}
12141098
12151099/******************************************************************************
r22848r22849
12181102
12191103******************************************************************************/
12201104
1221static TIMER_CALLBACK( romclk_hack_timer_cb )
1105void tms5110_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
12221106{
1223   tms5110_state *tms = get_safe_token((device_t *) ptr);
1224   tms->romclk_hack_state = !tms->romclk_hack_state;
1107   m_romclk_hack_state = !m_romclk_hack_state;
12251108}
12261109
1227READ8_DEVICE_HANDLER( tms5110_romclk_hack_r )
1110READ8_MEMBER( tms5110_device::romclk_hack_r )
12281111{
1229   tms5110_state *tms = get_safe_token(device);
1230
12311112   /* bring up to date first */
1232   tms->stream->update();
1113   m_stream->update();
12331114
12341115   /* create and start timer if necessary */
1235   if (!tms->romclk_hack_timer_started)
1116   if (!m_romclk_hack_timer_started)
12361117   {
1237      tms->romclk_hack_timer_started = TRUE;
1238      tms->romclk_hack_timer->adjust(attotime::from_hz(device->clock() / 40), 0, attotime::from_hz(device->clock() / 40));
1118      m_romclk_hack_timer_started = TRUE;
1119      m_romclk_hack_timer->adjust(attotime::from_hz(clock() / 40), 0, attotime::from_hz(clock() / 40));
12391120   }
1240   return tms->romclk_hack_state;
1121   return m_romclk_hack_state;
12411122}
12421123
12431124
r22848r22849
12481129
12491130******************************************************************************/
12501131
1251int tms5110_ready_r(device_t *device)
1132int tms5110_device::ready_r()
12521133{
1253   tms5110_state *tms = get_safe_token(device);
1254
12551134   /* bring up to date first */
1256   tms->stream->update();
1257   return (tms->fifo_count < FIFO_SIZE-1);
1135   m_stream->update();
1136   return (m_fifo_count < FIFO_SIZE-1);
12581137}
12591138
12601139
r22848r22849
12651144
12661145******************************************************************************/
12671146
1268static STREAM_UPDATE( tms5110_update )
1147//-------------------------------------------------
1148//  sound_stream_update - handle a stream update
1149//-------------------------------------------------
1150
1151void tms5110_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
12691152{
1270   tms5110_state *tms = (tms5110_state *)param;
12711153   INT16 sample_data[MAX_SAMPLE_CHUNK];
12721154   stream_sample_t *buffer = outputs[0];
12731155
r22848r22849
12781160      int index;
12791161
12801162      /* generate the samples and copy to the target buffer */
1281      tms5110_process(tms, sample_data, length);
1163      process(sample_data, length);
12821164      for (index = 0; index < length; index++)
12831165         *buffer++ = sample_data[index];
12841166
r22848r22849
12951177
12961178******************************************************************************/
12971179
1298void tms5110_set_frequency(device_t *device, int frequency)
1180void tms5110_device::set_frequency(int frequency)
12991181{
1300   tms5110_state *tms = get_safe_token(device);
1301   tms->stream->set_sample_rate(frequency / 80);
1182   m_stream->set_sample_rate(frequency / 80);
13021183}
13031184
1304
13051185/*
13061186 *
13071187 * General Interface design (Bagman)
r22848r22849
13461226
13471227******************************************************************************/
13481228
1349static void register_for_save_states_prom(tmsprom_state *tms)
1229void tmsprom_device::register_for_save_states()
13501230{
1351   tms->device->save_item(NAME(tms->address));
1352   tms->device->save_item(NAME(tms->base_address));
1353   tms->device->save_item(NAME(tms->bit));
1354   tms->device->save_item(NAME(tms->enable));
1355   tms->device->save_item(NAME(tms->prom_cnt));
1356   tms->device->save_item(NAME(tms->m0));
1231   save_item(NAME(m_address));
1232   save_item(NAME(m_base_address));
1233   save_item(NAME(m_bit));
1234   save_item(NAME(m_enable));
1235   save_item(NAME(m_prom_cnt));
1236   save_item(NAME(m_m0));
13571237}
13581238
1359
1360static void update_prom_cnt(tmsprom_state *tms)
1239void tmsprom_device::update_prom_cnt()
13611240{
1362   UINT8 prev_val = tms->prom[tms->prom_cnt] | 0x0200;
1363   if (tms->enable && (prev_val & (1<<tms->intf->stop_bit)))
1364      tms->prom_cnt |= 0x10;
1241   UINT8 prev_val = m_prom[m_prom_cnt] | 0x0200;
1242   if (m_enable && (prev_val & (1<<m_intf->stop_bit)))
1243      m_prom_cnt |= 0x10;
13651244   else
1366      tms->prom_cnt &= 0x0f;
1245      m_prom_cnt &= 0x0f;
13671246}
13681247
1369static TIMER_CALLBACK( tmsprom_step )
1248void tmsprom_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
13701249{
1371   device_t *device = (device_t *)ptr;
1372   tmsprom_state *tms = get_safe_token_prom(device);
1373
13741250   /* only 16 bytes needed ... The original dump is bad. This
13751251    * is what is needed to get speech to work. The prom data has
13761252    * been updated and marked as BAD_DUMP. The information below
r22848r22849
13811257    */
13821258   UINT16 ctrl;
13831259
1384   update_prom_cnt(tms);
1385   ctrl = (tms->prom[tms->prom_cnt] | 0x200);
1260   update_prom_cnt();
1261   ctrl = (m_prom[m_prom_cnt] | 0x200);
13861262
1387   //if (tms->enable && tms->prom_cnt < 0x10) printf("ctrl %04x, enable %d cnt %d\n", ctrl, tms->enable, tms->prom_cnt);
1388   tms->prom_cnt = ((tms->prom_cnt + 1) & 0x0f) | (tms->prom_cnt & 0x10);
1263   //if (m_enable && m_prom_cnt < 0x10) printf("ctrl %04x, enable %d cnt %d\n", ctrl, m_enable, m_prom_cnt);
1264   m_prom_cnt = ((m_prom_cnt + 1) & 0x0f) | (m_prom_cnt & 0x10);
13891265
1390   if (ctrl & (1 << tms->intf->reset_bit))
1391      tms->address = 0;
1266   if (ctrl & (1 << m_intf->reset_bit))
1267      m_address = 0;
13921268
1393   tms->ctl_func(0, BITSWAP8(ctrl,0,0,0,0,tms->intf->ctl8_bit,
1394         tms->intf->ctl4_bit,tms->intf->ctl2_bit,tms->intf->ctl1_bit));
1269   m_ctl_func(0, BITSWAP8(ctrl,0,0,0,0,m_intf->ctl8_bit,
1270         m_intf->ctl4_bit,m_intf->ctl2_bit,m_intf->ctl1_bit));
13951271
1396   tms->pdc_func((ctrl >> tms->intf->pdc_bit) & 0x01);
1272   m_pdc_func((ctrl >> m_intf->pdc_bit) & 0x01);
13971273}
13981274
1399static DEVICE_START( tmsprom )
1275//-------------------------------------------------
1276//  device_start - device-specific startup
1277//-------------------------------------------------
1278
1279void tmsprom_device::device_start()
14001280{
1401   tmsprom_state *tms = get_safe_token_prom(device);
1281   m_intf = (const tmsprom_interface *) static_config();
1282   assert_always(m_intf != NULL, "Error creating TMSPROM chip: No configuration");
14021283
1403   assert_always(tms != NULL, "Error creating TMSPROM chip");
1404
1405   tms->intf = (const tmsprom_interface *) device->static_config();
1406   assert_always(tms->intf != NULL, "Error creating TMSPROM chip: No configuration");
1407
14081284   /* resolve lines */
1409   tms->pdc_func.resolve(tms->intf->pdc_func, *device);
1410   tms->ctl_func.resolve(tms->intf->ctl_func, *device);
1285   m_pdc_func.resolve(m_intf->pdc_func, *this);
1286   m_ctl_func.resolve(m_intf->ctl_func, *this);
14111287
1412   tms->rom = *device->region();
1413   assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No rom region found");
1414   tms->prom = device->machine().root_device().memregion(tms->intf->prom_region)->base();
1415   assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No prom region found");
1288   m_rom = *region();
1289   assert_always(m_rom != NULL, "Error creating TMSPROM chip: No rom region found");
1290   m_prom = machine().root_device().memregion(m_intf->prom_region)->base();
1291   assert_always(m_rom != NULL, "Error creating TMSPROM chip: No prom region found");
14161292
1417   tms->device = device;
1418   tms->clock = device->clock();
1293   m_clock = clock();
14191294
1420   tms->romclk_timer = device->machine().scheduler().timer_alloc(FUNC(tmsprom_step), device);
1421   tms->romclk_timer->adjust(attotime::zero, 0, attotime::from_hz(tms->clock));
1295   m_romclk_timer = timer_alloc(0);
1296   m_romclk_timer->adjust(attotime::zero, 0, attotime::from_hz(m_clock));
14221297
1423   tms->bit = 0;
1424   tms->base_address = 0;
1425   tms->address = 0;
1426   tms->enable = 0;
1427   tms->m0 = 0;
1428   tms->prom_cnt = 0;
1429   register_for_save_states_prom(tms);
1298   m_bit = 0;
1299   m_base_address = 0;
1300   m_address = 0;
1301   m_enable = 0;
1302   m_m0 = 0;
1303   m_prom_cnt = 0;
1304
1305   register_for_save_states();
14301306}
14311307
1432WRITE_LINE_DEVICE_HANDLER( tmsprom_m0_w )
1308WRITE_LINE_MEMBER( tmsprom_device::m0_w )
14331309{
1434   tmsprom_state *tms = get_safe_token_prom(device);
1435
14361310   /* falling edge counts */
1437   if (tms->m0 && !state)
1311   if (m_m0 && !state)
14381312   {
1439      tms->address += 1;
1440      tms->address &= (tms->intf->rom_size-1);
1313      m_address += 1;
1314      m_address &= (m_intf->rom_size-1);
14411315   }
1442   tms->m0 = state;
1316   m_m0 = state;
14431317}
14441318
1445READ_LINE_DEVICE_HANDLER( tmsprom_data_r )
1319READ_LINE_MEMBER( tmsprom_device::data_r )
14461320{
1447   tmsprom_state *tms = get_safe_token_prom(device);
1448
1449   return (tms->rom[tms->base_address + tms->address] >> tms->bit) & 0x01;
1321   return (m_rom[m_base_address + m_address] >> m_bit) & 0x01;
14501322}
14511323
14521324
1453WRITE8_DEVICE_HANDLER( tmsprom_rom_csq_w )
1325WRITE8_MEMBER( tmsprom_device::rom_csq_w )
14541326{
1455   tmsprom_state *tms = get_safe_token_prom(device);
1456
14571327   if (!data)
1458      tms->base_address = offset * tms->intf->rom_size;
1328      m_base_address = offset * m_intf->rom_size;
14591329}
14601330
1461WRITE8_DEVICE_HANDLER( tmsprom_bit_w )
1331WRITE8_MEMBER( tmsprom_device::bit_w )
14621332{
1463   tmsprom_state *tms = get_safe_token_prom(device);
1464
1465   tms->bit = data;
1333   m_bit = data;
14661334}
14671335
1468WRITE_LINE_DEVICE_HANDLER( tmsprom_enable_w )
1336WRITE_LINE_MEMBER( tmsprom_device::enable_w )
14691337{
1470   tmsprom_state *tms = get_safe_token_prom(device);
1471
1472   if (state != tms->enable)
1338   if (state != m_enable)
14731339   {
1474      tms->enable = state;
1475      update_prom_cnt(tms);
1340      m_enable = state;
1341      update_prom_cnt();
14761342
14771343      /* the following is needed for ad2084.
14781344       * It is difficult to derive the actual connections from
r22848r22849
14841350       * counter bits are 0!
14851351       */
14861352      if (state)
1487         tms->prom_cnt &= 0x10;
1353         m_prom_cnt &= 0x10;
14881354   }
14891355}
14901356
r22848r22849
14991365   : device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock),
15001366      device_sound_interface(mconfig, *this)
15011367{
1502   m_token = global_alloc_clear(tms5110_state);
15031368}
1369
15041370tms5110_device::tms5110_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
15051371   : device_t(mconfig, type, name, tag, owner, clock),
15061372      device_sound_interface(mconfig, *this)
15071373{
1508   m_token = global_alloc_clear(tms5110_state);
15091374}
15101375
15111376//-------------------------------------------------
r22848r22849
15181383{
15191384}
15201385
1521//-------------------------------------------------
1522//  device_start - device-specific startup
1523//-------------------------------------------------
1524
1525void tms5110_device::device_start()
1526{
1527   DEVICE_START_NAME( tms5110 )(this);
1528}
1529
1530//-------------------------------------------------
1531//  device_reset - device-specific reset
1532//-------------------------------------------------
1533
1534void tms5110_device::device_reset()
1535{
1536   DEVICE_RESET_NAME( tms5110 )(this);
1537}
1538
1539//-------------------------------------------------
1540//  sound_stream_update - handle a stream update
1541//-------------------------------------------------
1542
1543void tms5110_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
1544{
1545   // should never get here
1546   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
1547}
1548
1549
15501386const device_type TMS5100 = &device_creator<tms5100_device>;
15511387
1388
15521389tms5100_device::tms5100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
15531390   : tms5110_device(mconfig, TMS5100, "TMS5100", tag, owner, clock)
15541391{
15551392}
15561393
1557//-------------------------------------------------
1558//  device_start - device-specific startup
1559//-------------------------------------------------
15601394
1561void tms5100_device::device_start()
1562{
1563   DEVICE_START_NAME( tms5100 )(this);
1564}
1565
1566//-------------------------------------------------
1567//  sound_stream_update - handle a stream update
1568//-------------------------------------------------
1569
1570void tms5100_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
1571{
1572   // should never get here
1573   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
1574}
1575
1576
15771395const device_type TMS5110A = &device_creator<tms5110a_device>;
15781396
15791397tms5110a_device::tms5110a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r22848r22849
15811399{
15821400}
15831401
1584//-------------------------------------------------
1585//  device_start - device-specific startup
1586//-------------------------------------------------
15871402
1588void tms5110a_device::device_start()
1589{
1590   DEVICE_START_NAME( tms5110a )(this);
1591}
1592
1593//-------------------------------------------------
1594//  sound_stream_update - handle a stream update
1595//-------------------------------------------------
1596
1597void tms5110a_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
1598{
1599   // should never get here
1600   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
1601}
1602
1603
16041403const device_type CD2801 = &device_creator<cd2801_device>;
16051404
16061405cd2801_device::cd2801_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r22848r22849
16081407{
16091408}
16101409
1611//-------------------------------------------------
1612//  device_start - device-specific startup
1613//-------------------------------------------------
16141410
1615void cd2801_device::device_start()
1616{
1617   DEVICE_START_NAME( cd2801 )(this);
1618}
1619
1620//-------------------------------------------------
1621//  sound_stream_update - handle a stream update
1622//-------------------------------------------------
1623
1624void cd2801_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
1625{
1626   // should never get here
1627   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
1628}
1629
1630
16311411const device_type TMC0281 = &device_creator<tmc0281_device>;
16321412
16331413tmc0281_device::tmc0281_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r22848r22849
16351415{
16361416}
16371417
1638//-------------------------------------------------
1639//  device_start - device-specific startup
1640//-------------------------------------------------
16411418
1642void tmc0281_device::device_start()
1643{
1644   DEVICE_START_NAME( tmc0281 )(this);
1645}
1646
1647//-------------------------------------------------
1648//  sound_stream_update - handle a stream update
1649//-------------------------------------------------
1650
1651void tmc0281_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
1652{
1653   // should never get here
1654   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
1655}
1656
1657
16581419const device_type CD2802 = &device_creator<cd2802_device>;
16591420
16601421cd2802_device::cd2802_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r22848r22849
16621423{
16631424}
16641425
1665//-------------------------------------------------
1666//  device_start - device-specific startup
1667//-------------------------------------------------
16681426
1669void cd2802_device::device_start()
1670{
1671   DEVICE_START_NAME( cd2802 )(this);
1672}
1673
1674//-------------------------------------------------
1675//  sound_stream_update - handle a stream update
1676//-------------------------------------------------
1677
1678void cd2802_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
1679{
1680   // should never get here
1681   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
1682}
1683
1684
16851427const device_type M58817 = &device_creator<m58817_device>;
16861428
16871429m58817_device::m58817_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r22848r22849
16891431{
16901432}
16911433
1692//-------------------------------------------------
1693//  device_start - device-specific startup
1694//-------------------------------------------------
16951434
1696void m58817_device::device_start()
1697{
1698   DEVICE_START_NAME( m58817 )(this);
1699}
1700
1701//-------------------------------------------------
1702//  sound_stream_update - handle a stream update
1703//-------------------------------------------------
1704
1705void m58817_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
1706{
1707   // should never get here
1708   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
1709}
1710
1711
1712
17131435const device_type TMSPROM = &device_creator<tmsprom_device>;
17141436
17151437tmsprom_device::tmsprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
17161438   : device_t(mconfig, TMSPROM, "TMSPROM", tag, owner, clock)
17171439{
1718   m_token = global_alloc_clear(tmsprom_state);
17191440}
17201441
17211442//-------------------------------------------------
r22848r22849
17271448void tmsprom_device::device_config_complete()
17281449{
17291450}
1730
1731//-------------------------------------------------
1732//  device_start - device-specific startup
1733//-------------------------------------------------
1734
1735void tmsprom_device::device_start()
1736{
1737   DEVICE_START_NAME( tmsprom )(this);
1738}
trunk/src/emu/sound/tms5110.h
r22848r22849
33#ifndef __TMS5110_H__
44#define __TMS5110_H__
55
6#include "devlegcy.h"
6#include "emu.h"
77
8#define FIFO_SIZE               64 // TODO: technically the tms51xx chips don't have a fifo at all
9
810/* TMS5110 commands */
911                              /* CTL8  CTL4  CTL2  CTL1  |   PDC's  */
1012                              /* (MSB)             (LSB) | required */
r22848r22849
3840   devcb_write_line romclk_func;   /* rom clock - Only used to drive the data lines */
3941};
4042
41DECLARE_WRITE8_DEVICE_HANDLER( tms5110_ctl_w );
42DECLARE_READ8_DEVICE_HANDLER( tms5110_ctl_r );
43WRITE_LINE_DEVICE_HANDLER( tms5110_pdc_w );
44
45/* this is only used by cvs.c
46 * it is not related at all to the speech generation
47 * and conflicts with the new rom controller interface.
48 */
49DECLARE_READ8_DEVICE_HANDLER( tms5110_romclk_hack_r );
50
51/* m58817 status line */
52DECLARE_READ8_DEVICE_HANDLER( m58817_status_r );
53
54int tms5110_ready_r(device_t *device);
55
56void tms5110_set_frequency(device_t *device, int frequency);
57
5843class tms5110_device : public device_t,
5944                           public device_sound_interface
6045{
6146public:
6247   tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
6348   tms5110_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
64   ~tms5110_device() { global_free(m_token); }
6549
66   // access to legacy token
67   void *token() const { assert(m_token != NULL); return m_token; }
50   DECLARE_WRITE8_MEMBER( ctl_w );
51   DECLARE_READ8_MEMBER( ctl_r );
52   DECLARE_WRITE_LINE_MEMBER( pdc_w );
53
54   /* this is only used by cvs.c
55    * it is not related at all to the speech generation
56    * and conflicts with the new rom controller interface.
57    */
58   DECLARE_READ8_MEMBER( romclk_hack_r );
59
60   int ready_r();
61   void set_frequency(int frequency);
62
63   int _speech_rom_read_bit();
64   void _speech_rom_set_addr(int addr);
65
6866protected:
6967   // device-level overrides
7068   virtual void device_config_complete();
7169   virtual void device_start();
7270   virtual void device_reset();
7371
72   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
73
7474   // sound stream update overrides
7575   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
76
77   void set_variant(int variant);
78
7679private:
77   // internal state
78   void *m_token;
80   void new_int_write(UINT8 rc, UINT8 m0, UINT8 m1, UINT8 addr);
81   void new_int_write_addr(UINT8 addr);
82   UINT8 new_int_read();
83   void register_for_save_states();
84   void FIFO_data_write(int data);
85   int extract_bits(int count);
86   void request_bits(int no);
87   void perform_dummy_read();
88   void process(INT16 *buffer, unsigned int size);
89   void PDC_set(int data);
90   void parse_frame();
91
92   /* these contain data that describes the 64 bits FIFO */
93   UINT8 m_fifo[FIFO_SIZE];
94   UINT8 m_fifo_head;
95   UINT8 m_fifo_tail;
96   UINT8 m_fifo_count;
97
98   /* these contain global status bits */
99   UINT8 m_PDC;
100   UINT8 m_CTL_pins;
101   UINT8 m_speaking_now;
102protected:   UINT8 m_talk_status; private:
103   UINT8 m_state;
104
105   /* Rom interface */
106   UINT32 m_address;
107   UINT8  m_next_is_address;
108   UINT8  m_schedule_dummy_read;
109   UINT8  m_addr_bit;
110
111   /* external callback */
112   int (*m_M0_callback)(device_t *);
113   void (*m_set_load_address)(device_t *, int);
114
115   /* callbacks */
116   devcb_resolved_write_line m_m0_func;      /* the M0 line */
117   devcb_resolved_write_line m_m1_func;      /* the M1 line */
118   devcb_resolved_write8 m_addr_func;        /* Write to ADD1,2,4,8 - 4 address bits */
119   devcb_resolved_read_line m_data_func;     /* Read one bit from ADD8/Data - voice data */
120   devcb_resolved_write_line m_romclk_func;  /* rom clock - Only used to drive the data lines */
121
122   /* these contain data describing the current and previous voice frames */
123   UINT16 m_old_energy;
124   UINT16 m_old_pitch;
125   INT32 m_old_k[10];
126
127   UINT16 m_new_energy;
128   UINT16 m_new_pitch;
129   INT32 m_new_k[10];
130
131
132   /* these are all used to contain the current state of the sound generation */
133   UINT16 m_current_energy;
134   UINT16 m_current_pitch;
135   INT32 m_current_k[10];
136
137   UINT16 m_target_energy;
138   UINT16 m_target_pitch;
139   INT32 m_target_k[10];
140
141   UINT8 m_interp_count;       /* number of interp periods (0-7) */
142   UINT8 m_sample_count;       /* sample number within interp (0-24) */
143   INT32 m_pitch_count;
144
145   INT32 m_x[11];
146
147   INT32 m_RNG;  /* the random noise generator configuration is: 1 + x + x^3 + x^4 + x^13 */
148
149   INT32 m_speech_rom_bitnum;
150
151   UINT8 m_romclk_hack_timer_started;
152   UINT8 m_romclk_hack_state;
153
154   /* coefficient tables */
155   int m_variant;                /* Variant of the 5110 - see tms5110.h */
156
157   /* coefficient tables */
158   const struct tms5100_coeffs *m_coeff;
159
160protected: sound_stream *m_stream; private:
161   emu_timer *m_romclk_hack_timer;
162   const tms5110_interface *m_intf;
163   const UINT8 *m_table;
79164};
80165
81166extern const device_type TMS5110;
r22848r22849
87172protected:
88173   // device-level overrides
89174   virtual void device_start();
90
91   // sound stream update overrides
92   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
93175};
94176
95177extern const device_type TMS5100;
r22848r22849
101183protected:
102184   // device-level overrides
103185   virtual void device_start();
104
105   // sound stream update overrides
106   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
107186};
108187
109188extern const device_type TMS5110A;
r22848r22849
115194protected:
116195   // device-level overrides
117196   virtual void device_start();
118
119   // sound stream update overrides
120   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
121197};
122198
123199extern const device_type CD2801;
r22848r22849
129205protected:
130206   // device-level overrides
131207   virtual void device_start();
132
133   // sound stream update overrides
134   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
135208};
136209
137210extern const device_type TMC0281;
r22848r22849
143216protected:
144217   // device-level overrides
145218   virtual void device_start();
146
147   // sound stream update overrides
148   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
149219};
150220
151221extern const device_type CD2802;
r22848r22849
154224{
155225public:
156226   m58817_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
227
228   DECLARE_READ8_MEMBER( status_r );
229
157230protected:
158231   // device-level overrides
159232   virtual void device_start();
160
161   // sound stream update overrides
162   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
163233};
164234
165235extern const device_type M58817;
r22848r22849
184254   devcb_write8 ctl_func;          /* tms ctl func */
185255};
186256
187WRITE_LINE_DEVICE_HANDLER( tmsprom_m0_w );
188READ_LINE_DEVICE_HANDLER( tmsprom_data_r );
189
190/* offset is rom # */
191DECLARE_WRITE8_DEVICE_HANDLER( tmsprom_rom_csq_w );
192DECLARE_WRITE8_DEVICE_HANDLER( tmsprom_bit_w );
193WRITE_LINE_DEVICE_HANDLER( tmsprom_enable_w );
194
195257class tmsprom_device : public device_t
196258{
197259public:
198260   tmsprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
199   ~tmsprom_device() { global_free(m_token); }
200261
201   // access to legacy token
202   void *token() const { assert(m_token != NULL); return m_token; }
262   WRITE_LINE_MEMBER( m0_w );
263   READ_LINE_MEMBER( data_r );
264
265   /* offset is rom # */
266   DECLARE_WRITE8_MEMBER( rom_csq_w );
267   DECLARE_WRITE8_MEMBER( bit_w );
268   WRITE_LINE_MEMBER( enable_w );
269
203270protected:
204271   // device-level overrides
205272   virtual void device_config_complete();
206273   virtual void device_start();
274
275   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
276
207277private:
278   void register_for_save_states();
279   void update_prom_cnt();
280
208281   // internal state
209   void *m_token;
282   /* Rom interface */
283   UINT32 m_address;
284   /* ctl lines */
285   UINT8  m_m0;
286   UINT8  m_enable;
287   UINT32  m_base_address;
288   UINT8  m_bit;
289
290   int m_prom_cnt;
291
292   devcb_resolved_write_line m_pdc_func;     /* tms pdc func */
293   devcb_resolved_write8 m_ctl_func;         /* tms ctl func */
294
295   int    m_clock;
296   emu_timer *m_romclk_timer;
297   const tmsprom_interface *m_intf;
298   const UINT8 *m_rom;
299   const UINT8 *m_prom;
210300};
211301
212302extern const device_type TMSPROM;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team