trunk/src/mess/drivers/tispeak.c
| r242529 | r242530 | |
| 10 | 10 | #include "cpu/tms0980/tms0980.h" |
| 11 | 11 | #include "sound/tms5110.h" |
| 12 | 12 | #include "machine/tms6100.h" |
| 13 | #include "bus/generic/slot.h" |
| 14 | #include "bus/generic/carts.h" |
| 13 | 15 | |
| 14 | 16 | #include "tispeak.lh" |
| 15 | 17 | |
| 18 | // The master clock is a single stage RC oscillator into TMS5100 RCOSC: |
| 19 | // C is 68pf, R is a 50kohm trimpot wich is set to 33.6kohm. CPUCLK is this/2, ROMCLK is this/4. |
| 20 | // The osc freq curve is unknown. Let's assume it is set to the default frequency, |
| 21 | // which is 640kHz according to the TMS5100 documentation. |
| 16 | 22 | |
| 23 | #define MASTER_CLOCK (640000) |
| 24 | |
| 25 | |
| 17 | 26 | class tispeak_state : public driver_device |
| 18 | 27 | { |
| 19 | 28 | public: |
| r242529 | r242530 | |
| 22 | 31 | m_maincpu(*this, "maincpu"), |
| 23 | 32 | m_tms5100(*this, "tms5100"), |
| 24 | 33 | m_tms6100(*this, "tms6100"), |
| 34 | m_cart(*this, "cartslot"), |
| 25 | 35 | m_filoff_timer(*this, "filoff"), |
| 26 | 36 | m_button_matrix(*this, "IN") |
| 27 | 37 | { } |
| r242529 | r242530 | |
| 29 | 39 | required_device<tms0270_cpu_device> m_maincpu; |
| 30 | 40 | required_device<tms5100_device> m_tms5100; |
| 31 | 41 | required_device<tms6100_device> m_tms6100; |
| 42 | optional_device<generic_slot_device> m_cart; |
| 32 | 43 | required_device<timer_device> m_filoff_timer; |
| 33 | 44 | required_ioport_array<9> m_button_matrix; |
| 34 | 45 | |
| r242529 | r242530 | |
| 50 | 61 | DECLARE_WRITE_LINE_MEMBER(auto_power_off); |
| 51 | 62 | void power_off(); |
| 52 | 63 | |
| 64 | DECLARE_DEVICE_IMAGE_LOAD_MEMBER(tispeak_cartridge); |
| 53 | 65 | virtual void machine_reset(); |
| 54 | 66 | virtual void machine_start(); |
| 55 | 67 | }; |
| r242529 | r242530 | |
| 58 | 70 | |
| 59 | 71 | /*************************************************************************** |
| 60 | 72 | |
| 73 | File Handling |
| 74 | |
| 75 | ***************************************************************************/ |
| 76 | |
| 77 | DEVICE_IMAGE_LOAD_MEMBER(tispeak_state, tispeak_cartridge) |
| 78 | { |
| 79 | UINT32 size = m_cart->common_get_size("rom"); |
| 80 | |
| 81 | // max size is 16KB |
| 82 | if (size > 0x4000) |
| 83 | { |
| 84 | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); |
| 85 | return IMAGE_INIT_FAIL; |
| 86 | } |
| 87 | |
| 88 | m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); |
| 89 | m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); |
| 90 | |
| 91 | return IMAGE_INIT_PASS; |
| 92 | } |
| 93 | |
| 94 | |
| 95 | |
| 96 | /*************************************************************************** |
| 97 | |
| 61 | 98 | VFD Display |
| 62 | 99 | |
| 63 | 100 | ***************************************************************************/ |
| r242529 | r242530 | |
| 188 | 225 | { |
| 189 | 226 | int on = (int)(FPTR)param; |
| 190 | 227 | |
| 191 | | if (on) |
| 228 | if (on && !m_power_on) |
| 192 | 229 | { |
| 193 | 230 | m_power_on = 1; |
| 194 | 231 | m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 195 | 232 | } |
| 196 | | else if (m_power_on) |
| 233 | else if (!on && m_power_on) |
| 197 | 234 | power_off(); |
| 198 | 235 | } |
| 199 | 236 | |
| r242529 | r242530 | |
| 345 | 382 | save_item(NAME(m_o)); |
| 346 | 383 | save_item(NAME(m_filament_on)); |
| 347 | 384 | save_item(NAME(m_power_on)); |
| 385 | |
| 386 | // init cartridge |
| 387 | astring region_tag; |
| 388 | memory_region *src = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 389 | if (src) |
| 390 | { |
| 391 | UINT8 *dest_ptr = memregion("tms6100")->base() + 0x8000; |
| 392 | memcpy(dest_ptr, src->base(), src->bytes()); |
| 393 | } |
| 348 | 394 | } |
| 349 | 395 | |
| 350 | 396 | |
| 351 | | static MACHINE_CONFIG_START( snspell, tispeak_state ) |
| 397 | static MACHINE_CONFIG_START( snmath, tispeak_state ) |
| 352 | 398 | |
| 353 | 399 | /* basic machine hardware */ |
| 354 | | MCFG_CPU_ADD("maincpu", TMS0270, XTAL_640kHz/2) |
| 400 | MCFG_CPU_ADD("maincpu", TMS0270, MASTER_CLOCK/2) |
| 355 | 401 | MCFG_TMS1XXX_READ_K_CB(READ8(tispeak_state, snspell_read_k)) |
| 356 | | MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snspell_write_o)) |
| 402 | MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snmath_write_o)) |
| 357 | 403 | MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, snspell_write_r)) |
| 358 | 404 | MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(tispeak_state, auto_power_off)) |
| 359 | 405 | |
| r242529 | r242530 | |
| 367 | 413 | /* no video! */ |
| 368 | 414 | |
| 369 | 415 | /* sound hardware */ |
| 370 | | MCFG_DEVICE_ADD("tms6100", TMS6100, 0) |
| 416 | MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) |
| 371 | 417 | |
| 372 | 418 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 373 | | MCFG_SOUND_ADD("tms5100", TMS5100, XTAL_640kHz) |
| 419 | MCFG_SOUND_ADD("tms5100", TMS5100, MASTER_CLOCK) |
| 374 | 420 | MCFG_TMS5110_M0_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m0_w)) |
| 375 | 421 | MCFG_TMS5110_M1_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m1_w)) |
| 376 | 422 | MCFG_TMS5110_ADDR_CB(DEVWRITE8("tms6100", tms6100_device, tms6100_addr_w)) |
| r242529 | r242530 | |
| 379 | 425 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 380 | 426 | MACHINE_CONFIG_END |
| 381 | 427 | |
| 382 | | static MACHINE_CONFIG_DERIVED( snmath, snspell ) |
| 428 | static MACHINE_CONFIG_DERIVED( snspell, snmath ) |
| 383 | 429 | |
| 384 | 430 | /* basic machine hardware */ |
| 385 | 431 | MCFG_CPU_MODIFY("maincpu") |
| 386 | | MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snmath_write_o)) |
| 432 | MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snspell_write_o)) |
| 433 | |
| 434 | /* cartridge */ |
| 435 | MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "snspell") |
| 436 | MCFG_GENERIC_EXTENSIONS("vsm") |
| 437 | MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) |
| 438 | |
| 439 | MCFG_SOFTWARE_LIST_ADD("cart_list", "snspell") |
| 387 | 440 | MACHINE_CONFIG_END |
| 388 | 441 | |
| 389 | 442 | |
| r242529 | r242530 | |
| 405 | 458 | ROM_REGION( 1246, "maincpu:opla", 0 ) |
| 406 | 459 | ROM_LOAD( "tms0270_tmc0271_opla.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) |
| 407 | 460 | |
| 408 | | ROM_REGION( 0x8000, "tms6100", 0 ) |
| 461 | ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge |
| 409 | 462 | ROM_LOAD( "tmc0351.vsm", 0x0000, 0x4000, CRC(beea3373) SHA1(8b0f7586d2f12c3d4a885fdb528cf23feffa1a3b) ) |
| 410 | 463 | ROM_LOAD( "tmc0352.vsm", 0x4000, 0x4000, CRC(d51f0587) SHA1(ddaa484be1bba5fef46b481cafae517e4acaa8ed) ) |
| 411 | 464 | ROM_END |
| 412 | 465 | |
| 413 | 466 | ROM_START( snmath ) |
| 414 | 467 | ROM_REGION( 0x1000, "maincpu", 0 ) |
| 415 | | ROM_LOAD( "us4946391_t2074", 0x0000, 0x1000, BAD_DUMP CRC(011f0c2d) SHA1(d2e14d72e03ca864abd51da78ffb71a9da82f624) ) // typed in from patent 4946391, verified with source code (mark BAD_DUMP just to be unsure) |
| 468 | // typed in from patent 4946391, verified with source code (mark BAD_DUMP just to be unsure) |
| 469 | // BTANB note: Mix It does not work at all, this is an original bug in the prototype. There are probably other minor bugs too. |
| 470 | ROM_LOAD( "us4946391_t2074", 0x0000, 0x1000, BAD_DUMP CRC(011f0c2d) SHA1(d2e14d72e03ca864abd51da78ffb71a9da82f624) ) |
| 416 | 471 | |
| 417 | 472 | ROM_REGION( 1246, "maincpu:ipla", 0 ) |
| 418 | 473 | ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) |