Previous 15994 Revisions Next

r5517 Friday 28th August, 2009 at 22:21:22 UTC by Jonathan Gevaryahu
[dectalk] hooked up status registers and fifos, fixed a compile warning.
[src/mess/drivers]dectalk.c

src/mess/drivers/dectalk.c
r5516r5517
55*  with major help (dumping, tech questions answered, etc)
66*  from Kevin 'kevtris' Horton, without whom this driver would
77*  have been impossible.
8*  Special thanks to Al Kossow for archiving the DTC-01 schematic at bitsavers,
9*  which is invaluable for work on this driver.
810*
911*  TODO:
1012*  * Attach 2681(M68681 clone?) DUART
r5516r5517
1214*  * Figure out why status LEDS are flashing 00 FD 00 FD etc... some sort of 68k selftest DUART error?
1315*    * NICETOHAVE: figure out what all the LED error codes actually mean, as DEC didn't document them anywhere.
1416*  * Actually store the X2212 nvram's eeprom data to disk rather than throwing it out on exit
15*  * Properly attach 'input' FIFO between 68k and TMS32010
16*    * force sync between both processors if either one pushes or pulls the fifo
17*  * force sync between both processors if either one pushes or pulls the fifo
1718*      or the shared error/fifo flag regs... How can I actually do this? CPU_BOOST_INTERLEAVE?
19*      otherwise i need to have the two in some mad insane sync...
1820*  * Hook the 'output' FIFO up to the 10khz sampling rate generator xtal using SPEAKER
19*  * hook up the SPC(tms32010 interface) status flags properly
2021*  * emulate/simulate the MT8060 dtmf decoder as an input device
2122*  * discuss and figure out how to have an external application send data to the two serial ports to be spoken
2223*
r5516r5517
7778UINT16 outfifo[16]; // technically three 74LS224 4bit*16stage FIFO chips, arranged as a 16 stage, 12-bit wide fifo
7879UINT8 outfifo_tail_ptr;
7980UINT8 outfifo_head_ptr;
80UINT8 outfifo_status_latch; // latch for status of output fifo, d-latch 74ls74 @ E64 'lower half'
81UINT8 outfifo_writable_latch; // latch for status of output fifo, d-latch 74ls74 @ E64 'lower half'
8182UINT8 spc_error_latch; // latch for error status of speech dsp, d-latch 74ls74 @ E64 'upper half'
83UINT8 m68k_spcflags_latch; // latch for initializing the speech dsp, d-latch 74ls74 @ E29 'lower half', AND latch for spc irq enable, d-latch 74ls74 @ E29 'upper half'; these are stored in bits 0 and 6 respectively, the rest of the bits stored here MUST be zeroed!
84UINT8 m68k_tlcflags_latch; // latch for telephone interface stuff, d-latches 74ls74 @ E93 'upper half' and @ 103 'upper and lower halves'
8285} dectalk={ {0}};
8386
87#define SPC_INITIALIZE dectalk.m68k_spcflags_latch&0x1 // speech initialize flag
88#define SPC_IRQ_ENABLED ((dectalk.m68k_spcflags_latch&0x40)>>6) // irq enable flag
89
8490static void dectalk_clear_all_fifos( running_machine *machine )
8591{
8692   // clear fifos (TODO: memset would work better here...)
r5516r5517
113119DRIVER_INIT( dectalk )
114120{
115121   dectalk_clear_all_fifos(machine);
116   dectalk.outfifo_status_latch = 0;
122   dectalk.outfifo_writable_latch = 0;
117123   dectalk.spc_error_latch = 0;
118124}
119125
r5516r5517
123129// stuff that is affected by the RESET generator on the pcb: the status LED latch, the novram (forced load from eeprom to tempram)
124130   dectalk.statusLED = 0; // clear status led latch
125131   dectalk_x2212_recall(machine);
132   dectalk.m68k_spcflags_latch = 1; // initial status is speech reset(d0) active and spc int(d6) disabled
133   dectalk.m68k_tlcflags_latch = 0; // initial status is tone detect int(d6) off, answer phone(d8) off, ring detect int(d14) off
134   dectalk_clear_all_fifos(machine); // which also clears the fifos, though we have to do it explicitly here since we're not actually in the m68k_spcflags_w function.
135   /* write me */ // it also forces the CLR line active on the tms32010, we need to do that here as well
126136}
127137
128WRITE16_HANDLER( latch_outfifo_error_stats ) // latch 74ls74 @ E64 upper and lower halves with d0 and fifo status respectively
129{
130    dectalk.outfifo_status_latch = (dectalk.outfifo_tail_ptr == ((dectalk.outfifo_head_ptr-1)&0xF)?1:0);
131    dectalk.spc_error_latch = data&1;
132}
138/* Begin 68k i/o handlers */
133139
134WRITE16_HANDLER( outfifo_data_w )
135{
136 // for now, do nothing. eventually we'll actually need to write data here.
137 //logerror("write to fifo, data %x\n", data)
138}
139
140READ8_HANDLER( outfifo_status_r ) // Return state of d-latch 74ls74 @ E64 'lower half' in d0
141{
142 return dectalk.spc_error_latch;
143}
144
145140/* x2212 nvram/sram chip and led array demunger due to interleaved addresses */
146141/* 0x400 long: anything at offset&0x1 = 0 is open bus read, write to leds; everything else is nvram*/
147142READ16_HANDLER( led_sw_nvr_read )
r5516r5517
184179   }
185180}
186181
182WRITE16_HANDLER( m68k_infifo_w ) // 68k write to the speech input fifo
183{
184    dectalk.infifo[dectalk.infifo_head_ptr] = data;
185    dectalk.infifo_head_ptr++;
186    dectalk.infifo_head_ptr&=0x1F;
187}
187188
189READ16_HANDLER( m68k_spcflags_r ) // 68k read from the speech flags
190{
191   UINT8 data = 0;
192   data |= dectalk.m68k_spcflags_latch; // bits 0 and 6
193   data |= dectalk.spc_error_latch<<5; // bit 5
194   data |= dectalk.outfifo_writable_latch<<7; // bit 7
195   return data;
196}
188197
198WRITE16_HANDLER( m68k_spcflags_w ) // 68k write to the speech flags (only 3 bits do anything)
199{
200   dectalk.m68k_spcflags_latch = data&0x41; // ONLY store bits 6 and 0!
201   // d0: initialize speech flag (reset tms32010 and clear infifo and outfifo if high)
202   if ((data&0x1) == 0x1) // bit 0
203   {
204      dectalk_clear_all_fifos(space->machine);
205      /* write me */ // data&1 also forces the CLR line active on the tms32010, we need to do that here as well
206   }
207   if ((data&0x2) == 0x2) // bit 1
208   {
209   // clear the two speech side latches
210   dectalk.spc_error_latch = 0;
211   dectalk.outfifo_writable_latch = 0;
212   }
213   if ((data&0x40) == 0x40) // bit 6
214   {
215      /* write me */ //enable or disable the spc irq, which triggers when fifo writable goes high, if data&40 is set.
216   }
217}
218
219READ16_HANDLER( m68k_tlcflags_r ) // dtmf flags read
220{
221   UINT16 data = 0;
222   data |= dectalk.m68k_tlcflags_latch; // bits 6, 8, 14;
223   //data |= dectalk.tlc_tonedetect<<7; // bit 7 is tone detect
224   //data |= dectalk.tlc_ringdetect<<14; // bit 15 is ring detect
225   return data;
226}
227
228WRITE16_HANDLER( m68k_tlcflags_w ) // dtmf flags write
229{
230   dectalk.m68k_tlcflags_latch = data&0x4140; // ONLY store bits 6 8 and 14!
231   // write me for the ring and tone int enables and answer phone
232}
233
234READ16_HANDLER( m68k_tlc_dtmf_r ) // dtmf chip read
235{
236// write me!
237return 0;
238}
239
240/* End 68k i/o handlers */
241
242/* Begin tms32010 i/o handlers */
243WRITE16_HANDLER( spc_latch_outfifo_error_stats ) // latch 74ls74 @ E64 upper and lower halves with d0 and fifo status respectively
244{
245    dectalk.outfifo_writable_latch = (dectalk.outfifo_tail_ptr == ((dectalk.outfifo_head_ptr-1)&0xF)?0:1); // may have polarity backwards
246    dectalk.spc_error_latch = data&1;
247}
248
249READ16_HANDLER( spc_infifo_data_r )
250{
251 UINT16 data = 0xFFFF;
252 data = dectalk.infifo[dectalk.infifo_tail_ptr];
253 //logerror("dsp read from infifo, data %x\n", data);
254 dectalk.infifo_tail_ptr++;
255 dectalk.infifo_tail_ptr&=0x1F;
256 return data;
257}
258
259WRITE16_HANDLER( spc_outfifo_data_w )
260{
261 // the low 4 data bits are thrown out on the real unit due to use of a 12 bit dac (and to save use of another 16x4 fifo chip), though technically they're probably valid, and with suitable hacking a dtc-01 could probably output full 16 bit samples at 10khz.
262 logerror("dsp write to outfifo, data %x\n", data);
263 dectalk.outfifo[dectalk.outfifo_head_ptr] = data;
264 dectalk.outfifo_head_ptr++;
265 dectalk.outfifo_head_ptr&=0xF;
266}
267
268READ16_HANDLER( spc_outfifo_writable_r ) // Return state of d-latch 74ls74 @ E64 'lower half' in d0 which indicates whether outfifo is writable
269{
270 return dectalk.outfifo_writable_latch;
271}
272/* end tms32010 i/o handlers */
273
274
189275/******************************************************************************
190276 Address Maps
191277******************************************************************************/
r5516r5517
216302    //AM_RANGE(0x094001, 0x094001) AM_READWRITE(x2212_read, x2212_write) AM_MIRROR(0x763C00) /* Xicor X2212 NVRAM (SRAM) */
217303    //AM_RANGE(0x094201, 0x094201) AM_READWRITE(x2212_recall, x2212_store) AM_MIRROR(0x763C00)  /* Xicor X2212 NVRAM (EEPROM commands) */
218304    //AM_RANGE(0x098000, 0x09bfff) AM_READWRITE(1) AM_MIRROR(0x760000) /* DUART */
219    //AM_RANGE(0x09C000, 0x09ffff) AM_READWRITE(1) AM_MIRROR(0x760000) /* TMS32010 */
305    AM_RANGE(0x09C000, 0x09C001) AM_READWRITE(m68k_spcflags_r, m68k_spcflags_w) AM_MIRROR(0x761FF8) /* SPC flags reg */
306    AM_RANGE(0x09C002, 0x09C003) AM_WRITE(m68k_infifo_w) AM_MIRROR(0x761FF8) /* SPC fifo reg */
307    AM_RANGE(0x09C004, 0x09C005) AM_READWRITE(m68k_tlcflags_r, m68k_tlcflags_w) AM_MIRROR(0x761FF8) /* telephone status flags */
308    AM_RANGE(0x09C006, 0x09C007) AM_READ(m68k_tlc_dtmf_r) AM_MIRROR(0x761FF8) /* telephone dtmf read */
220309ADDRESS_MAP_END
221310
311// do we even need this below?
222312static ADDRESS_MAP_START(m68k_io, ADDRESS_SPACE_IO, 16)
223313   ADDRESS_MAP_GLOBAL_MASK(0xff)
224314ADDRESS_MAP_END
225315
226316static ADDRESS_MAP_START(tms32010_mem, ADDRESS_SPACE_PROGRAM, 16)
227    ADDRESS_MAP_UNMAP_HIGH
228317    AM_RANGE(0x000, 0x7ff) AM_ROM /* ROM */
229318ADDRESS_MAP_END
230319
231320static ADDRESS_MAP_START(tms32010_io, ADDRESS_SPACE_IO, 16)
232    ADDRESS_MAP_UNMAP_HIGH
233    AM_RANGE(0, 0) AM_WRITE(latch_outfifo_error_stats) // latch fifo status to be read by outfifo_status_r, and also latch the error bit at D0.
234    AM_RANGE(1, 1) AM_WRITE(outfifo_data_w) //write to sound fifo
235    AM_RANGE(TMS32010_BIO, TMS32010_BIO) AM_READ(outfifo_status_r) //read output fifo status
321    AM_RANGE(0, 0) AM_WRITE(spc_latch_outfifo_error_stats) // latch fifo status to be read by outfifo_status_r, and also latch the error bit at D0.
322    AM_RANGE(1, 1) AM_READWRITE(spc_infifo_data_r, spc_outfifo_data_w) //read from input fifo, write to sound fifo
323    AM_RANGE(TMS32010_BIO, TMS32010_BIO) AM_READ(spc_outfifo_writable_r) //read output fifo writable status
236324ADDRESS_MAP_END
237325
238326/******************************************************************************
r5516r5517
250338    MDRV_CPU_ADD("maincpu", M68000, XTAL_20MHz/2)
251339    MDRV_CPU_PROGRAM_MAP(m68k_mem)
252340    MDRV_CPU_IO_MAP(m68k_io)
253    MDRV_QUANTUM_TIME(HZ(60))
341    MDRV_QUANTUM_TIME(HZ(10000))
254342    MDRV_MACHINE_RESET(dectalk)
255343
256344    MDRV_CPU_ADD("dsp", TMS32010, XTAL_20MHz)
257345    MDRV_CPU_PROGRAM_MAP(tms32010_mem)
258346    MDRV_CPU_IO_MAP(tms32010_io)
259    MDRV_QUANTUM_TIME(HZ(60))
347    MDRV_QUANTUM_TIME(HZ(10000))
260348
261349    /* video hardware */
262350   MDRV_DEFAULT_LAYOUT(layout_dectalk) // hack to avoid screenless system crash
263351
264352    /* sound hardware */
265353   //MDRV_SPEAKER_STANDARD_MONO("mono")
266   //MDRV_SOUND_ADD("dectalk_snd", SPEAKER, XTAL_20MHz/2)
354   //MDRV_SOUND_ADD("dectalk_snd", SPEAKER, XTAL_10Khz)
267355   //MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
268356
269357
r5516r5517
318406******************************************************************************/
319407
320408/*    YEAR   NAME      PARENT   COMPAT   MACHINE      INPUT   INIT      CONFIG      COMPANY      FULLNAME         FLAGS */
321COMP( 1982, dectalk,   0,      0,      dectalk,   0,      dectalk,   dectalk,   "DEC",      "DECTalk DTC-01",   GAME_NOT_WORKING )
409COMP( 1984, dectalk,   0,      0,      dectalk,   0,      dectalk,   dectalk,   "DEC",      "DECTalk DTC-01",   GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team