src/mess/drivers/dectalk.c
| r5516 | r5517 | |
| 5 | 5 | * with major help (dumping, tech questions answered, etc) |
| 6 | 6 | * from Kevin 'kevtris' Horton, without whom this driver would |
| 7 | 7 | * 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. |
| 8 | 10 | * |
| 9 | 11 | * TODO: |
| 10 | 12 | * * Attach 2681(M68681 clone?) DUART |
| r5516 | r5517 | |
| 12 | 14 | * * Figure out why status LEDS are flashing 00 FD 00 FD etc... some sort of 68k selftest DUART error? |
| 13 | 15 | * * NICETOHAVE: figure out what all the LED error codes actually mean, as DEC didn't document them anywhere. |
| 14 | 16 | * * 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 |
| 17 | 18 | * 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... |
| 18 | 20 | * * Hook the 'output' FIFO up to the 10khz sampling rate generator xtal using SPEAKER |
| 19 | | * * hook up the SPC(tms32010 interface) status flags properly |
| 20 | 21 | * * emulate/simulate the MT8060 dtmf decoder as an input device |
| 21 | 22 | * * discuss and figure out how to have an external application send data to the two serial ports to be spoken |
| 22 | 23 | * |
| r5516 | r5517 | |
| 77 | 78 | UINT16 outfifo[16]; // technically three 74LS224 4bit*16stage FIFO chips, arranged as a 16 stage, 12-bit wide fifo |
| 78 | 79 | UINT8 outfifo_tail_ptr; |
| 79 | 80 | UINT8 outfifo_head_ptr; |
| 80 | | UINT8 outfifo_status_latch; // latch for status of output fifo, d-latch 74ls74 @ E64 'lower half' |
| 81 | UINT8 outfifo_writable_latch; // latch for status of output fifo, d-latch 74ls74 @ E64 'lower half' |
| 81 | 82 | UINT8 spc_error_latch; // latch for error status of speech dsp, d-latch 74ls74 @ E64 'upper half' |
| 83 | UINT8 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! |
| 84 | UINT8 m68k_tlcflags_latch; // latch for telephone interface stuff, d-latches 74ls74 @ E93 'upper half' and @ 103 'upper and lower halves' |
| 82 | 85 | } dectalk={ {0}}; |
| 83 | 86 | |
| 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 | |
| 84 | 90 | static void dectalk_clear_all_fifos( running_machine *machine ) |
| 85 | 91 | { |
| 86 | 92 | // clear fifos (TODO: memset would work better here...) |
| r5516 | r5517 | |
| 113 | 119 | DRIVER_INIT( dectalk ) |
| 114 | 120 | { |
| 115 | 121 | dectalk_clear_all_fifos(machine); |
| 116 | | dectalk.outfifo_status_latch = 0; |
| 122 | dectalk.outfifo_writable_latch = 0; |
| 117 | 123 | dectalk.spc_error_latch = 0; |
| 118 | 124 | } |
| 119 | 125 | |
| r5516 | r5517 | |
| 123 | 129 | // stuff that is affected by the RESET generator on the pcb: the status LED latch, the novram (forced load from eeprom to tempram) |
| 124 | 130 | dectalk.statusLED = 0; // clear status led latch |
| 125 | 131 | 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 |
| 126 | 136 | } |
| 127 | 137 | |
| 128 | | WRITE16_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 */ |
| 133 | 139 | |
| 134 | | WRITE16_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 | | |
| 140 | | READ8_HANDLER( outfifo_status_r ) // Return state of d-latch 74ls74 @ E64 'lower half' in d0 |
| 141 | | { |
| 142 | | return dectalk.spc_error_latch; |
| 143 | | } |
| 144 | | |
| 145 | 140 | /* x2212 nvram/sram chip and led array demunger due to interleaved addresses */ |
| 146 | 141 | /* 0x400 long: anything at offset&0x1 = 0 is open bus read, write to leds; everything else is nvram*/ |
| 147 | 142 | READ16_HANDLER( led_sw_nvr_read ) |
| r5516 | r5517 | |
| 184 | 179 | } |
| 185 | 180 | } |
| 186 | 181 | |
| 182 | WRITE16_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 | } |
| 187 | 188 | |
| 189 | READ16_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 | } |
| 188 | 197 | |
| 198 | WRITE16_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 | |
| 219 | READ16_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 | |
| 228 | WRITE16_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 | |
| 234 | READ16_HANDLER( m68k_tlc_dtmf_r ) // dtmf chip read |
| 235 | { |
| 236 | // write me! |
| 237 | return 0; |
| 238 | } |
| 239 | |
| 240 | /* End 68k i/o handlers */ |
| 241 | |
| 242 | /* Begin tms32010 i/o handlers */ |
| 243 | WRITE16_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 | |
| 249 | READ16_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 | |
| 259 | WRITE16_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 | |
| 268 | READ16_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 | |
| 189 | 275 | /****************************************************************************** |
| 190 | 276 | Address Maps |
| 191 | 277 | ******************************************************************************/ |
| r5516 | r5517 | |
| 216 | 302 | //AM_RANGE(0x094001, 0x094001) AM_READWRITE(x2212_read, x2212_write) AM_MIRROR(0x763C00) /* Xicor X2212 NVRAM (SRAM) */ |
| 217 | 303 | //AM_RANGE(0x094201, 0x094201) AM_READWRITE(x2212_recall, x2212_store) AM_MIRROR(0x763C00) /* Xicor X2212 NVRAM (EEPROM commands) */ |
| 218 | 304 | //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 */ |
| 220 | 309 | ADDRESS_MAP_END |
| 221 | 310 | |
| 311 | // do we even need this below? |
| 222 | 312 | static ADDRESS_MAP_START(m68k_io, ADDRESS_SPACE_IO, 16) |
| 223 | 313 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 224 | 314 | ADDRESS_MAP_END |
| 225 | 315 | |
| 226 | 316 | static ADDRESS_MAP_START(tms32010_mem, ADDRESS_SPACE_PROGRAM, 16) |
| 227 | | ADDRESS_MAP_UNMAP_HIGH |
| 228 | 317 | AM_RANGE(0x000, 0x7ff) AM_ROM /* ROM */ |
| 229 | 318 | ADDRESS_MAP_END |
| 230 | 319 | |
| 231 | 320 | static 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 |
| 236 | 324 | ADDRESS_MAP_END |
| 237 | 325 | |
| 238 | 326 | /****************************************************************************** |
| r5516 | r5517 | |
| 250 | 338 | MDRV_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) |
| 251 | 339 | MDRV_CPU_PROGRAM_MAP(m68k_mem) |
| 252 | 340 | MDRV_CPU_IO_MAP(m68k_io) |
| 253 | | MDRV_QUANTUM_TIME(HZ(60)) |
| 341 | MDRV_QUANTUM_TIME(HZ(10000)) |
| 254 | 342 | MDRV_MACHINE_RESET(dectalk) |
| 255 | 343 | |
| 256 | 344 | MDRV_CPU_ADD("dsp", TMS32010, XTAL_20MHz) |
| 257 | 345 | MDRV_CPU_PROGRAM_MAP(tms32010_mem) |
| 258 | 346 | MDRV_CPU_IO_MAP(tms32010_io) |
| 259 | | MDRV_QUANTUM_TIME(HZ(60)) |
| 347 | MDRV_QUANTUM_TIME(HZ(10000)) |
| 260 | 348 | |
| 261 | 349 | /* video hardware */ |
| 262 | 350 | MDRV_DEFAULT_LAYOUT(layout_dectalk) // hack to avoid screenless system crash |
| 263 | 351 | |
| 264 | 352 | /* sound hardware */ |
| 265 | 353 | //MDRV_SPEAKER_STANDARD_MONO("mono") |
| 266 | | //MDRV_SOUND_ADD("dectalk_snd", SPEAKER, XTAL_20MHz/2) |
| 354 | //MDRV_SOUND_ADD("dectalk_snd", SPEAKER, XTAL_10Khz) |
| 267 | 355 | //MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 268 | 356 | |
| 269 | 357 | |
| r5516 | r5517 | |
| 318 | 406 | ******************************************************************************/ |
| 319 | 407 | |
| 320 | 408 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 321 | | COMP( 1982, dectalk, 0, 0, dectalk, 0, dectalk, dectalk, "DEC", "DECTalk DTC-01", GAME_NOT_WORKING ) |
| 409 | COMP( 1984, dectalk, 0, 0, dectalk, 0, dectalk, dectalk, "DEC", "DECTalk DTC-01", GAME_NOT_WORKING ) |