src/mess/drivers/dectalk.c
| r5636 | r5637 | |
| 6 | 6 | * from Kevin 'kevtris' Horton, without whom this driver would |
| 7 | 7 | * have been impossible. |
| 8 | 8 | * Special thanks to Al Kossow for archiving the DTC-01 schematic at bitsavers, |
| 9 | | * which is invaluable for work on this driver. |
| 9 | * http://bitsavers.org/pdf/dec/dectalk/MP-01820_DTC01_EngrDrws_Nov83.pdf |
| 10 | * which has been invaluable for work on this driver. |
| 10 | 11 | * Special thanks to leeeeee for helping figure out what the led selftest codes actually mean |
| 11 | 12 | * |
| 12 | 13 | * TODO: |
| 13 | | * * DUART: I suspect the duart test fails because modes 0-6 of the duart are currently unimplemented in 68681.c |
| 14 | * * DUART: |
| 14 | 15 | * * DUART needs its i/o pins connected as well: |
| 15 | 16 | * * pins IP0, IP2, and IP3 are connected to the primary serial port: |
| 16 | 17 | * * IP0 is CTS |
| r5636 | r5637 | |
| 25 | 26 | * * OP2 is DTR |
| 26 | 27 | * * Attach m68k interrupts properly; I suspect the DUART INT and SPC INTs are both hooked up wrong |
| 27 | 28 | * * Actually store the X2212 nvram's eeprom data to disk rather than throwing it out on exit |
| 28 | | * * force sync between both processors if either one pushes or pulls the fifo |
| 29 | | * or the shared error/fifo flag regs... How can I actually do this? CPU_BOOST_INTERLEAVE? |
| 30 | | * otherwise i need to have the two in some mad insane sync... |
| 31 | | * * Hook the 'output' FIFO up to the 10khz sampling rate generator xtal using SPEAKER |
| 29 | * * is there some way i can hook this up using &generic_nvram? |
| 32 | 30 | * * emulate/simulate the MT8060 dtmf decoder as a 16-key input device? |
| 33 | 31 | * * discuss and figure out how to have an external application send data to the two serial ports to be spoken |
| 34 | 32 | * |
| r5636 | r5637 | |
| 50 | 48 | * FE 03 - RAM check fail @ 0x88000-0x8bfff, ram at E34 or E47 " |
| 51 | 49 | * FE 04 - RAM check fail @ 0x8c000-0x8ffff, ram at E33 or E46 " |
| 52 | 50 | * FE 05 - RAM check fail @ 0x90000-0x93fff, ram at E32 or E44 " |
| 53 | | * FD 00 - DUART test (test code at $046C) |
| 54 | | * FC 00 - TMS32010 'SPC' and DTMF-decoder 'TLC' status register test (test code at $051E) [passes in mess] |
| 55 | | * FB 00 - TMS32010 extensive tests: make dtmf tone and be sure the decoder detects it and triggers an interrupt [fails in mess] |
| 51 | * FD 00 - DUART test & DUART interrupt test (test code at $046C) |
| 52 | * FC 00 - This test doesn't exist. Some vestiges of it may remain in code for the FD and FB tests. |
| 53 | * FB 00 - TMS32010 extensive tests (test code at $051E): test spc interrupt [works] and make dtmf tone to test tlc interrupt [fails in mess, requires dtmf detection on output] |
| 56 | 54 | * Jump to $102C to skip the self tests |
| 57 | 55 | * During normal operation: |
| 58 | | * D3 - ? some sort of failure |
| 59 | | * FF - normal, status OK |
| 60 | | * * figure out what all the other LED error codes actually mean, as DEC didn't document them anywhere. |
| 56 | (table taken from http://www3.sympatico.ca/n.rieck/docs/DECtalk_notes.html ) |
| 57 | DTC-01 LEDs |
| 58 | |
| 59 | 76543210 LEDs |
| 60 | |||||||| |
| 61 | |||||||+-------- set if host asserting CTS |
| 62 | ||||||+--------- set if DECtalk asserting RTS |
| 63 | |||||+---------- set if host asserting DSR |
| 64 | ||||+----------- set if host asserting DCD |
| 65 | |||+------------ set if DECtalk asserting DTR |
| 66 | +++------------- 3 bit state code |
| 67 | |
| 68 | 000 in state 5, first 500 ms; waiting for CD & CTS in first 500 ms when DECtalk is on-line |
| 69 | 001 timing 2 second CD=0 while in state 6 (moving data) |
| 70 | 010 waiting for DSR=0 while disconnecting (part of state 7) |
| 71 | 011 waiting for DSR=1 while connecting (state 3) |
| 72 | 100 delaying for UK modems during disconnect (part of state 7) |
| 73 | 101 waiting for CD and CTS (main part of state 5) |
| 74 | 110 moving data (state 6) |
| 75 | 111 disconnecting (start of state 7) |
| 76 | * Dectalk dtc-01 hardware and rom version history, from dtc-01 schematic at bitsavers and with additional info from |
| 77 | http://americanhistory.si.edu/archives/speechsynthesis/ss_dec1.htm |
| 78 | August 1983: Hardware version A done |
| 79 | unknown date: Version 1.0 roms finalized |
| 80 | unknown date: Version 1.1 roms released to fix a bug with insufficient stack space, see ss_dec1 above |
| 81 | March 1984: Hardware version B done (integrates the output fifo sync error check onto the pcb; Version A units are retrofitted when sent in for firmware upgrades) (most of the schematics come from this time) |
| 82 | <there might be a v1.2 or v1.3 in this period> |
| 83 | July 02 1984: Second half of Version 2.0 rom finalized |
| 84 | July 23 1984: First half of Version 2.0 rom finalized |
| 85 | October 1984 (the rest of the schematics come from this time) |
| 86 | unknown date: version 2.1 rom finalized |
| 87 | |
| 61 | 88 | *******************************************************************************/ |
| 62 | 89 | /*the 68k memory map is such: |
| 63 | 90 | 0x000000-0x007fff: E22 low, E8 high |
| r5636 | r5637 | |
| 77 | 104 | 0x090000-0x093fff: e32 low, e45 high |
| 78 | 105 | 0x094000-0x097fff: LED/SW/NVR |
| 79 | 106 | 0x098000-0x09bfff: DUART |
| 80 | | 0x09c000-0x09ffff: TMS32010 speech (TLC, SPC) |
| 107 | 0x09c000-0x09ffff: DTMF and TMS32010 (TLC, SPC) |
| 81 | 108 | mirrored at 0x0a0000-0x0fffff x3 |
| 82 | 109 | entire space mirrored at 0x100000-0x7fffff |
| 83 | 110 | 0x800000-0xffffff is open bus? |
| r5636 | r5637 | |
| 88 | 115 | SPC is INT level 5 |
| 89 | 116 | DUART is INT level 6 |
| 90 | 117 | */ |
| 91 | | #undef VERBOSE |
| 118 | // USE_LOOSE_TIMING makes the cpu interleave much lower and boosts it on fifo and flag writes by the 68k and semaphore sets by the dsp |
| 119 | #define USE_LOOSE_TIMING 1 |
| 120 | #undef VERBOSE |
| 121 | #undef SERIAL_TO_STDERR |
| 92 | 122 | |
| 93 | 123 | /* Core includes */ |
| 94 | 124 | #include "driver.h" |
| 95 | 125 | #include "cpu/m68000/m68000.h" |
| 96 | 126 | #include "cpu/tms32010/tms32010.h" |
| 97 | | #include "dectalk.lh" // nasty hack to avoid crash on screenless system |
| 127 | #include "dectalk.lh" // hack to avoid screenless system crash |
| 98 | 128 | #include "machine/68681.h" |
| 99 | 129 | #include "sound/dac.h" |
| 100 | 130 | |
| r5636 | r5637 | |
| 109 | 139 | //cputag_set_input_line_and_vector(device->machine, "maincpu", M68K_IRQ_6, HOLD_LINE, vector); |
| 110 | 140 | }; |
| 111 | 141 | |
| 142 | static UINT8 hack_self_test = 0; // temp variable for hack below |
| 143 | |
| 144 | static UINT8 duart_input(const device_config *device) |
| 145 | { |
| 146 | UINT8 data = 0xFF; |
| 147 | data &= 0x8F; // write me: handle bits 0, 2, 3 which are port a CTS, DSR and RLS(DCD?) respectively |
| 148 | //data |= input_port_read(device->machine, "duart_in"); |
| 149 | data |= (input_port_read(device->machine, "duart_in")&0x7f); |
| 150 | if ((hack_self_test == 1) && (input_port_read(device->machine, "duart_in")&0x80)) data |= 0x10; // hack to prevent hang if selftest disable bit is kept low past the first read; i suppose the proper use of this bit was an incremental switch, or perhaps its expecting an interrupt later from serial in or tone in? added a dipswitch to disable the hack for testing |
| 151 | hack_self_test = 1; |
| 152 | return data; |
| 153 | } |
| 154 | |
| 155 | static void duart_tx(const device_config *device, int channel, UINT8 data) |
| 156 | { |
| 157 | #ifdef SERIAL_TO_STDERR |
| 158 | fprintf(stderr, "%02X ",data); |
| 159 | #endif |
| 160 | } |
| 161 | |
| 112 | 162 | static const duart68681_config dectalk_duart68681_config = |
| 113 | 163 | { |
| 114 | 164 | duart_irq_handler, |
| 115 | | // duart_tx, |
| 116 | | NULL, |
| 165 | duart_tx, |
| 166 | duart_input, |
| 117 | 167 | NULL |
| 118 | 168 | }; |
| 119 | 169 | |
| r5636 | r5637 | |
| 137 | 187 | UINT8 simulate_outfifo_error; // simulate an error on the outfifo, which does something unusual to the dsp latches |
| 138 | 188 | UINT8 tlc_tonedetect; |
| 139 | 189 | UINT8 tlc_ringdetect; |
| 190 | UINT8 tlc_dtmf; // dtmf holding reg |
| 140 | 191 | } dectalk={ {0}}; |
| 141 | 192 | |
| 142 | 193 | #define SPC_INITIALIZE dectalk.m68k_spcflags_latch&0x1 // speech initialize flag |
| r5636 | r5637 | |
| 222 | 273 | /* Machine reset and friends: stuff that needs setting up which IS directly affected by reset */ |
| 223 | 274 | static void dectalk_reset(const device_config *device) |
| 224 | 275 | { |
| 276 | hack_self_test = 0; // hack |
| 225 | 277 | // stuff that is DIRECTLY affected by the RESET line |
| 226 | 278 | dectalk.statusLED = 0; // clear status led latch |
| 227 | 279 | dectalk_x2212_recall(device->machine); // nvram recall |
| r5636 | r5637 | |
| 236 | 288 | cputag_set_input_line(device->machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE); // speech reset forces the CLR line active on the tms32010 |
| 237 | 289 | dectalk.tlc_tonedetect = 0; // TODO, needed for selftest pass |
| 238 | 290 | dectalk.tlc_ringdetect = 0; // TODO |
| 291 | dectalk.tlc_dtmf = 0; // TODO |
| 239 | 292 | } |
| 240 | 293 | |
| 241 | 294 | MACHINE_RESET( dectalk ) |
| r5636 | r5637 | |
| 292 | 345 | |
| 293 | 346 | WRITE16_HANDLER( m68k_infifo_w ) // 68k write to the speech input fifo |
| 294 | 347 | { |
| 348 | #ifdef USE_LOOSE_TIMING |
| 349 | cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(50)); |
| 350 | cpuexec_trigger(space->machine, 100); |
| 351 | #endif |
| 295 | 352 | #ifdef VERBOSE |
| 296 | 353 | logerror("m68k: SPC infifo written with data = %04X, fifo head was: %02X; fifo tail: %02X\n",data, dectalk.infifo_head_ptr, dectalk.infifo_tail_ptr); |
| 297 | 354 | #endif |
| r5636 | r5637 | |
| 322 | 379 | |
| 323 | 380 | WRITE16_HANDLER( m68k_spcflags_w ) // 68k write to the speech flags (only 3 bits do anything) |
| 324 | 381 | { |
| 382 | #ifdef USE_LOOSE_TIMING |
| 383 | cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(50)); |
| 384 | cpuexec_trigger(space->machine, 100); |
| 385 | #endif |
| 325 | 386 | #ifdef VERBOSE |
| 326 | 387 | logerror("m68k: SPC flags written with %04X, only storing %04X\n",data, data&0x41); |
| 327 | 388 | #endif |
| r5636 | r5637 | |
| 367 | 428 | cputag_set_input_line_and_vector(space->machine, "maincpu", M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); // set int because semaphore was set |
| 368 | 429 | } |
| 369 | 430 | } |
| 370 | | else |
| 431 | else // data&0x40 == 0 |
| 371 | 432 | { |
| 372 | 433 | #ifdef VERBOSE |
| 373 | 434 | logerror(" | 0x40 = 0: speech int disabled\n"); |
| r5636 | r5637 | |
| 394 | 455 | logerror("m68k: TLC flags written with %04X, only storing %04X\n",data, data&0x4140); |
| 395 | 456 | #endif |
| 396 | 457 | dectalk.m68k_tlcflags_latch = data&0x4140; // ONLY store bits 6 8 and 14! |
| 397 | | // write me for the ring and tone int enables and answer phone |
| 458 | if ((data&0x40) == 0x40) // bit 6: tone detect interrupt enable |
| 459 | { |
| 460 | #ifdef VERBOSE |
| 461 | logerror(" | 0x40: tone detect int enabled\n"); |
| 462 | #endif |
| 463 | if ((dectalk.tlc_tonedetect == 1)) |
| 464 | { |
| 465 | #ifdef VERBOSE |
| 466 | logerror(" TLC int fired!\n"); |
| 467 | #endif |
| 468 | cputag_set_input_line_and_vector(space->machine, "maincpu", M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); // set int because tone detect was set |
| 469 | } |
| 470 | } |
| 471 | else // data&0x40 == 0 |
| 472 | { |
| 473 | #ifdef VERBOSE |
| 474 | logerror(" | 0x40 = 0: tone detect int disabled\n"); |
| 475 | #endif |
| 476 | if (((data&0x4000)!=0x4000) || (dectalk.tlc_ringdetect == 0)) // check to be sure we don't disable int if both ints fired at once |
| 477 | cputag_set_input_line_and_vector(space->machine, "maincpu", M68K_IRQ_4, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); // clear int because int is now disabled |
| 478 | } |
| 479 | if ((data&0x100) == 0x100) // bit 8: answer phone relay enable |
| 480 | { |
| 481 | #ifdef VERBOSE |
| 482 | logerror(" | 0x100: answer phone relay enabled\n"); |
| 483 | #endif |
| 484 | } |
| 485 | else // data&0x100 == 0 |
| 486 | { |
| 487 | #ifdef VERBOSE |
| 488 | logerror(" | 0x100 = 0: answer phone relay disabled\n"); |
| 489 | #endif |
| 490 | } |
| 491 | if ((data&0x4000) == 0x4000) // bit 14: ring int enable |
| 492 | { |
| 493 | #ifdef VERBOSE |
| 494 | logerror(" | 0x4000: ring detect int enabled\n"); |
| 495 | #endif |
| 496 | if ((dectalk.tlc_ringdetect == 1)) |
| 497 | { |
| 498 | #ifdef VERBOSE |
| 499 | logerror(" TLC int fired!\n"); |
| 500 | #endif |
| 501 | cputag_set_input_line_and_vector(space->machine, "maincpu", M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); // set int because tone detect was set |
| 502 | } |
| 503 | } |
| 504 | else // data&0x4000 == 0 |
| 505 | { |
| 506 | #ifdef VERBOSE |
| 507 | logerror(" | 0x4000 = 0: ring detect int disabled\n"); |
| 508 | #endif |
| 509 | if (((data&0x40)!=0x40) || (dectalk.tlc_tonedetect == 0)) // check to be sure we don't disable int if both ints fired at once |
| 510 | cputag_set_input_line_and_vector(space->machine, "maincpu", M68K_IRQ_4, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); // clear int because int is now disabled |
| 511 | } |
| 398 | 512 | } |
| 399 | 513 | |
| 400 | 514 | READ16_HANDLER( m68k_tlc_dtmf_r ) // dtmf chip read |
| 401 | 515 | { |
| 402 | | // write me! |
| 516 | UINT16 data = 0xFFFF; |
| 517 | data = dectalk.tlc_dtmf&0xF; |
| 403 | 518 | #ifdef VERBOSE |
| 404 | | logerror("m68k: TLC dtmf read, currently unhandled, returning data = 0"); |
| 519 | logerror("m68k: TLC dtmf detector read, returning data = %02X", data); |
| 405 | 520 | #endif |
| 406 | 521 | return 0; |
| 407 | 522 | } |
| r5636 | r5637 | |
| 410 | 525 | /* Begin tms32010 i/o handlers */ |
| 411 | 526 | WRITE16_HANDLER( spc_latch_outfifo_error_stats ) // latch 74ls74 @ E64 upper and lower halves with d0 and 1 respectively |
| 412 | 527 | { |
| 528 | #ifdef USE_LOOSE_TIMING |
| 529 | cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(50)); |
| 530 | cpuexec_trigger(space->machine, 100); |
| 531 | #endif |
| 413 | 532 | #ifdef VERBOSE |
| 414 | 533 | logerror("dsp: set fifo semaphore and set error status = %01X\n",data&1); |
| 415 | 534 | #endif |
| r5636 | r5637 | |
| 514 | 633 | /****************************************************************************** |
| 515 | 634 | Input Ports |
| 516 | 635 | ******************************************************************************/ |
| 636 | static INPUT_PORTS_START( dectalk ) |
| 637 | PORT_START("duart_in") // IP4, IP5, IP6 bits on duart are dipswitches (really unsoldered holes in the pcb where jumper wires can be soldered or shorted over) |
| 638 | PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // these bits are dealt with elsewhere |
| 639 | PORT_DIPNAME( 0x10, 0x00, "Skip Self Test (IP4)" ) |
| 640 | PORT_DIPSETTING( 0x10, "Open (VCC)" ) |
| 641 | PORT_DIPSETTING( 0x00, "Short to GND" ) |
| 642 | PORT_DIPNAME( 0x20, 0x20, "Unknown (IP5)" ) |
| 643 | PORT_DIPSETTING( 0x20, "Open (VCC)" ) |
| 644 | PORT_DIPSETTING( 0x00, "Short to GND" ) |
| 645 | PORT_DIPNAME( 0x40, 0x40, "Unknown (IP6)" ) |
| 646 | PORT_DIPSETTING( 0x40, "Open (VCC)" ) |
| 647 | PORT_DIPSETTING( 0x00, "Short to GND" ) |
| 648 | //PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // this pin (IP7) doesn't actually exist as a pin at all, reads as 1 |
| 649 | PORT_DIPNAME( 0x80, 0x80, "Hack to prevent hang when skip self test is shorted" ) |
| 650 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 651 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 652 | INPUT_PORTS_END |
| 517 | 653 | |
| 518 | | |
| 519 | | |
| 520 | 654 | /****************************************************************************** |
| 521 | 655 | Machine Drivers |
| 522 | 656 | ******************************************************************************/ |
| r5636 | r5637 | |
| 553 | 687 | MDRV_CPU_ADD("dsp", TMS32010, XTAL_20MHz) /* Y1 20MHz xtal */ |
| 554 | 688 | MDRV_CPU_PROGRAM_MAP(tms32010_mem) |
| 555 | 689 | MDRV_CPU_IO_MAP(tms32010_io) |
| 556 | | //MDRV_QUANTUM_TIME(HZ(750000)) |
| 557 | | MDRV_QUANTUM_PERFECT_CPU("dsp") |
| 690 | #ifdef USE_LOOSE_TIMING |
| 691 | MDRV_QUANTUM_TIME(HZ(200)) |
| 692 | #else |
| 693 | MDRV_QUANTUM_PERFECT_CPU("dsp") |
| 694 | #endif |
| 558 | 695 | |
| 696 | //MDRV_NVRAM_HANDLER(generic_0fill) |
| 697 | |
| 559 | 698 | /* video hardware */ |
| 560 | 699 | MDRV_DEFAULT_LAYOUT(layout_dectalk) // hack to avoid screenless system crash |
| 561 | 700 | |
| 562 | 701 | /* sound hardware */ |
| 563 | 702 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 564 | | MDRV_SOUND_ADD("dac", DAC, 0) /* E88 10KHz OSC, handled by timer */ |
| 703 | MDRV_SOUND_ADD("dac", DAC, 0) /* E88 10KHz OSC, handled by timer */ |
| 565 | 704 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.9) |
| 566 | 705 | |
| 567 | 706 | /* Y2 is a 3.579545 MHz xtal for the dtmf decoder chip */ |
| r5636 | r5637 | |
| 617 | 756 | Drivers |
| 618 | 757 | ******************************************************************************/ |
| 619 | 758 | |
| 620 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 621 | | COMP( 1984, dectalk, 0, 0, dectalk, 0, dectalk, dectalk, "DEC", "DECTalk DTC-01", GAME_NOT_WORKING ) |
| 759 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 760 | COMP( 1984, dectalk, 0, 0, dectalk, dectalk, dectalk, dectalk, "DEC", "DECTalk DTC-01", GAME_NOT_WORKING ) |