trunk/src/mess/drivers/ti74.c
| r31461 | r31462 | |
| 62 | 62 | TODO: |
| 63 | 63 | - it runs too fast due to missing clock divider emulation in TMS70C46 |
| 64 | 64 | - external ram cartridge |
| 65 | | - battery low/ok status.. setting INT1 on reset seems to clear it |
| 66 | 65 | - DOCK-BUS interface and peripherals, compatible with both TI-74 and TI-95 |
| 67 | 66 | * CI-7 cassette interface |
| 68 | 67 | * PC-324 thermal printer |
| r31461 | r31462 | |
| 85 | 84 | public: |
| 86 | 85 | ti74_state(const machine_config &mconfig, device_type type, const char *tag) |
| 87 | 86 | : driver_device(mconfig, type, tag), |
| 88 | | m_maincpu(*this, "maincpu") |
| 87 | m_maincpu(*this, "maincpu"), |
| 88 | m_battery_inp(*this, "BATTERY") |
| 89 | 89 | { } |
| 90 | 90 | |
| 91 | 91 | required_device<tms70c46_device> m_maincpu; |
| 92 | required_ioport m_battery_inp; |
| 92 | 93 | |
| 93 | 94 | ioport_port *m_key_matrix[8]; |
| 94 | 95 | |
| r31461 | r31462 | |
| 96 | 97 | UINT8 m_power; |
| 97 | 98 | |
| 98 | 99 | void update_lcd_indicator(UINT8 y, UINT8 x, int state); |
| 100 | void update_battery_status(int state); |
| 99 | 101 | |
| 100 | 102 | DECLARE_READ8_MEMBER(keyboard_r); |
| 101 | 103 | DECLARE_WRITE8_MEMBER(keyboard_w); |
| r31461 | r31462 | |
| 104 | 106 | virtual void machine_reset(); |
| 105 | 107 | virtual void machine_start(); |
| 106 | 108 | DECLARE_PALETTE_INIT(ti74); |
| 109 | DECLARE_INPUT_CHANGED_MEMBER(battery_status_changed); |
| 107 | 110 | DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ti74_cartridge); |
| 108 | 111 | }; |
| 109 | 112 | |
| r31461 | r31462 | |
| 272 | 275 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, ti74_state ) |
| 273 | 276 | ADDRESS_MAP_UNMAP_HIGH |
| 274 | 277 | AM_RANGE(0x1000, 0x1001) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) |
| 275 | | AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("6264.ic3") |
| 278 | AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("sysram.ic3") |
| 276 | 279 | AM_RANGE(0x4000, 0xbfff) AM_ROM AM_REGION("user1", 0) |
| 277 | 280 | AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("sysbank") |
| 278 | 281 | ADDRESS_MAP_END |
| r31461 | r31462 | |
| 291 | 294 | |
| 292 | 295 | ***************************************************************************/ |
| 293 | 296 | |
| 297 | INPUT_CHANGED_MEMBER(ti74_state::battery_status_changed) |
| 298 | { |
| 299 | if (machine().phase() == MACHINE_PHASE_RUNNING) |
| 300 | update_battery_status(newval); |
| 301 | } |
| 302 | |
| 294 | 303 | static INPUT_PORTS_START( ti74 ) |
| 304 | PORT_START("BATTERY") |
| 305 | PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ti74_state, battery_status_changed, 0) |
| 306 | PORT_CONFSETTING( 0x00, "Low" ) |
| 307 | PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) |
| 308 | |
| 295 | 309 | // 8x8 keyboard matrix, RESET and ON buttons are not on it. Unused entries are not connected, but some have a purpose for factory testing. |
| 296 | 310 | // For convenience, number keys are mapped to number row too. |
| 297 | 311 | // PORT_NAME lists functions under [SHIFT] and [MODE] or [STAT] as secondaries. |
| r31461 | r31462 | |
| 377 | 391 | INPUT_PORTS_END |
| 378 | 392 | |
| 379 | 393 | static INPUT_PORTS_START( ti95 ) |
| 394 | PORT_START("BATTERY") |
| 395 | PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ti74_state, battery_status_changed, 0) |
| 396 | PORT_CONFSETTING( 0x00, "Low" ) |
| 397 | PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) |
| 398 | |
| 380 | 399 | // 8x8 keyboard matrix, RESET and ON buttons are not on it. |
| 381 | 400 | // For convenience, number keys are mapped to number row too. |
| 382 | 401 | // PORT_NAME lists functions under [ALPHA] and [2nd] as secondaries. |
| r31461 | r31462 | |
| 469 | 488 | |
| 470 | 489 | ***************************************************************************/ |
| 471 | 490 | |
| 491 | void ti74_state::update_battery_status(int state) |
| 492 | { |
| 493 | // battery ok/low status is on int1 line! |
| 494 | m_maincpu->set_input_line(TMS7000_INT1_LINE, state ? ASSERT_LINE : CLEAR_LINE); |
| 495 | } |
| 496 | |
| 472 | 497 | void ti74_state::machine_reset() |
| 473 | 498 | { |
| 474 | 499 | m_power = 1; |
| 500 | |
| 501 | update_battery_status(m_battery_inp->read()); |
| 475 | 502 | } |
| 476 | 503 | |
| 477 | 504 | void ti74_state::machine_start() |
| r31461 | r31462 | |
| 485 | 512 | |
| 486 | 513 | // zerofill |
| 487 | 514 | m_key_select = 0; |
| 488 | | m_power = 1; |
| 515 | m_power = 0; |
| 489 | 516 | |
| 490 | 517 | // register for savestates |
| 491 | 518 | save_item(NAME(m_key_select)); |
| r31461 | r31462 | |
| 499 | 526 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 500 | 527 | MCFG_CPU_IO_MAP(main_io_map) |
| 501 | 528 | |
| 502 | | MCFG_NVRAM_ADD_0FILL("6264.ic3") |
| 529 | MCFG_NVRAM_ADD_0FILL("sysram.ic3") |
| 503 | 530 | |
| 504 | 531 | /* video hardware */ |
| 505 | 532 | MCFG_SCREEN_ADD("screen", LCD) |
| r31461 | r31462 | |
| 534 | 561 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 535 | 562 | MCFG_CPU_IO_MAP(main_io_map) |
| 536 | 563 | |
| 537 | | MCFG_NVRAM_ADD_0FILL("6264.ic3") |
| 564 | MCFG_NVRAM_ADD_0FILL("sysram.ic3") |
| 538 | 565 | |
| 539 | 566 | /* video hardware */ |
| 540 | 567 | MCFG_SCREEN_ADD("screen", LCD) |
trunk/src/mess/drivers/cc40.c
| r31461 | r31462 | |
| 88 | 88 | cc40_state(const machine_config &mconfig, device_type type, const char *tag) |
| 89 | 89 | : driver_device(mconfig, type, tag), |
| 90 | 90 | m_maincpu(*this, "maincpu"), |
| 91 | | m_dac(*this, "dac") |
| 91 | m_dac(*this, "dac"), |
| 92 | m_battery_inp(*this, "BATTERY") |
| 92 | 93 | { |
| 93 | 94 | m_sysram[0] = NULL; |
| 94 | 95 | m_sysram[1] = NULL; |
| r31461 | r31462 | |
| 96 | 97 | |
| 97 | 98 | required_device<tms70c20_device> m_maincpu; |
| 98 | 99 | required_device<dac_device> m_dac; |
| 100 | required_ioport m_battery_inp; |
| 99 | 101 | |
| 100 | 102 | nvram_device *m_nvram[2]; |
| 101 | 103 | ioport_port *m_key_matrix[8]; |
| r31461 | r31462 | |
| 303 | 305 | READ8_MEMBER(cc40_state::battery_r) |
| 304 | 306 | { |
| 305 | 307 | // d0: low battery sense line (0 = low power) |
| 306 | | return 1; |
| 308 | return m_battery_inp->read(); |
| 307 | 309 | } |
| 308 | 310 | |
| 309 | 311 | READ8_MEMBER(cc40_state::bankswitch_r) |
| r31461 | r31462 | |
| 415 | 417 | PORT_CONFSETTING( 0x10, "2KB" ) |
| 416 | 418 | PORT_CONFSETTING( 0x40, "8KB" ) |
| 417 | 419 | |
| 420 | PORT_START("BATTERY") |
| 421 | PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) |
| 422 | PORT_CONFSETTING( 0x00, "Low" ) |
| 423 | PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) |
| 424 | |
| 418 | 425 | // 8x8 keyboard matrix, RESET and ON buttons are not on it. Unused entries are not connected, but some might have a purpose for factory testing(?) |
| 419 | 426 | // The numpad number keys are shared with the ones on the main keyboard, also on the real machine. |
| 420 | 427 | // PORT_NAME lists functions under [SHIFT] as secondaries. |