Previous 199869 Revisions Next

r31462 Tuesday 29th July, 2014 at 00:35:23 UTC by hap
added battery status to UI system config
[src/mess/drivers]cc40.c ti74.c

trunk/src/mess/drivers/ti74.c
r31461r31462
6262  TODO:
6363  - it runs too fast due to missing clock divider emulation in TMS70C46
6464  - external ram cartridge
65  - battery low/ok status.. setting INT1 on reset seems to clear it
6665  - DOCK-BUS interface and peripherals, compatible with both TI-74 and TI-95
6766    * CI-7 cassette interface
6867    * PC-324 thermal printer
r31461r31462
8584public:
8685   ti74_state(const machine_config &mconfig, device_type type, const char *tag)
8786      : driver_device(mconfig, type, tag),
88      m_maincpu(*this, "maincpu")
87      m_maincpu(*this, "maincpu"),
88      m_battery_inp(*this, "BATTERY")
8989   { }
9090
9191   required_device<tms70c46_device> m_maincpu;
92   required_ioport m_battery_inp;
9293
9394   ioport_port *m_key_matrix[8];
9495
r31461r31462
9697   UINT8 m_power;
9798
9899   void update_lcd_indicator(UINT8 y, UINT8 x, int state);
100   void update_battery_status(int state);
99101
100102   DECLARE_READ8_MEMBER(keyboard_r);
101103   DECLARE_WRITE8_MEMBER(keyboard_w);
r31461r31462
104106   virtual void machine_reset();
105107   virtual void machine_start();
106108   DECLARE_PALETTE_INIT(ti74);
109   DECLARE_INPUT_CHANGED_MEMBER(battery_status_changed);
107110   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ti74_cartridge);
108111};
109112
r31461r31462
272275static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, ti74_state )
273276   ADDRESS_MAP_UNMAP_HIGH
274277   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")
276279   AM_RANGE(0x4000, 0xbfff) AM_ROM AM_REGION("user1", 0)
277280   AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("sysbank")
278281ADDRESS_MAP_END
r31461r31462
291294
292295***************************************************************************/
293296
297INPUT_CHANGED_MEMBER(ti74_state::battery_status_changed)
298{
299   if (machine().phase() == MACHINE_PHASE_RUNNING)
300      update_battery_status(newval);
301}
302
294303static 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
295309   // 8x8 keyboard matrix, RESET and ON buttons are not on it. Unused entries are not connected, but some have a purpose for factory testing.
296310   // For convenience, number keys are mapped to number row too.
297311   // PORT_NAME lists functions under [SHIFT] and [MODE] or [STAT] as secondaries.
r31461r31462
377391INPUT_PORTS_END
378392
379393static 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
380399   // 8x8 keyboard matrix, RESET and ON buttons are not on it.
381400   // For convenience, number keys are mapped to number row too.
382401   // PORT_NAME lists functions under [ALPHA] and [2nd] as secondaries.
r31461r31462
469488
470489***************************************************************************/
471490
491void 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
472497void ti74_state::machine_reset()
473498{
474499   m_power = 1;
500   
501   update_battery_status(m_battery_inp->read());
475502}
476503
477504void ti74_state::machine_start()
r31461r31462
485512
486513   // zerofill
487514   m_key_select = 0;
488   m_power = 1;
515   m_power = 0;
489516
490517   // register for savestates
491518   save_item(NAME(m_key_select));
r31461r31462
499526   MCFG_CPU_PROGRAM_MAP(main_map)
500527   MCFG_CPU_IO_MAP(main_io_map)
501528
502   MCFG_NVRAM_ADD_0FILL("6264.ic3")
529   MCFG_NVRAM_ADD_0FILL("sysram.ic3")
503530
504531   /* video hardware */
505532   MCFG_SCREEN_ADD("screen", LCD)
r31461r31462
534561   MCFG_CPU_PROGRAM_MAP(main_map)
535562   MCFG_CPU_IO_MAP(main_io_map)
536563
537   MCFG_NVRAM_ADD_0FILL("6264.ic3")
564   MCFG_NVRAM_ADD_0FILL("sysram.ic3")
538565
539566   /* video hardware */
540567   MCFG_SCREEN_ADD("screen", LCD)
trunk/src/mess/drivers/cc40.c
r31461r31462
8888   cc40_state(const machine_config &mconfig, device_type type, const char *tag)
8989      : driver_device(mconfig, type, tag),
9090      m_maincpu(*this, "maincpu"),
91      m_dac(*this, "dac")
91      m_dac(*this, "dac"),
92      m_battery_inp(*this, "BATTERY")
9293   {
9394      m_sysram[0] = NULL;
9495      m_sysram[1] = NULL;
r31461r31462
9697
9798   required_device<tms70c20_device> m_maincpu;
9899   required_device<dac_device> m_dac;
100   required_ioport m_battery_inp;
99101
100102   nvram_device *m_nvram[2];
101103   ioport_port *m_key_matrix[8];
r31461r31462
303305READ8_MEMBER(cc40_state::battery_r)
304306{
305307   // d0: low battery sense line (0 = low power)
306   return 1;
308   return m_battery_inp->read();
307309}
308310
309311READ8_MEMBER(cc40_state::bankswitch_r)
r31461r31462
415417   PORT_CONFSETTING(    0x10, "2KB" )
416418   PORT_CONFSETTING(    0x40, "8KB" )
417419
420   PORT_START("BATTERY")
421   PORT_CONFNAME( 0x01, 0x01, "Battery Status" )
422   PORT_CONFSETTING(    0x00, "Low" )
423   PORT_CONFSETTING(    0x01, DEF_STR( Normal ) )
424
418425   // 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(?)
419426   // The numpad number keys are shared with the ones on the main keyboard, also on the real machine.
420427   // PORT_NAME lists functions under [SHIFT] as secondaries.

Previous 199869 Revisions Next


© 1997-2024 The MAME Team