Previous 199869 Revisions Next

r28759 Thursday 20th March, 2014 at 17:21:02 UTC by Osso
Converted hd44352_device to devcb2 (nw)
[src/emu/video]hd44352.c hd44352.h
[src/mess/drivers]pb1000.c

trunk/src/emu/video/hd44352.c
r28758r28759
3535//-------------------------------------------------
3636
3737hd44352_device::hd44352_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock):
38   device_t(mconfig, HD44352, "hd44352", tag, owner, clock, "hd44352", __FILE__)
38   device_t(mconfig, HD44352, "hd44352", tag, owner, clock, "hd44352", __FILE__),
39   m_on_cb(*this)
3940{
4041}
4142
4243//-------------------------------------------------
43//  device_config_complete - perform any
44//  operations now that the configuration is
45//  complete
46//-------------------------------------------------
47
48void hd44352_device::device_config_complete()
49{
50   // inherit a copy of the static data
51   const hd44352_interface *intf = reinterpret_cast<const hd44352_interface *>(static_config());
52   if (intf != NULL)
53      *static_cast<hd44352_interface *>(this) = *intf;
54
55   // or initialize to defaults if none provided
56   else
57   {
58      memset(&m_on, 0, sizeof(m_on));
59   }
60}
61
62//-------------------------------------------------
6344//  device_validity_check - perform validity checks
6445//  on this device
6546//-------------------------------------------------
r28758r28759
7354
7455void hd44352_device::device_start()
7556{
76   m_on.resolve(m_on_cb, *this);
57   m_on_cb.resolve_safe();
7758
7859   m_on_timer = timer_alloc(ON_TIMER);
7960   m_on_timer->adjust(attotime::from_hz(m_clock/16384), 0, attotime::from_hz(m_clock/16384));
r28758r28759
140121      case ON_TIMER:
141122         if (m_control_lines & 0x40)
142123         {
143            m_on(ASSERT_LINE);
144            m_on(CLEAR_LINE);
124            m_on_cb(ASSERT_LINE);
125            m_on_cb(CLEAR_LINE);
145126         }
146127         break;
147128   }
trunk/src/emu/video/hd44352.h
r28758r28759
1212#define __hd44352_H__
1313
1414
15#define MCFG_HD44352_ADD( _tag, _clock, _config) \
16   MCFG_DEVICE_ADD( _tag, HD44352, _clock ) \
17   MCFG_DEVICE_CONFIG( _config )
15#define MCFG_HD44352_ON_CB(_devcb) \
16   devcb = &hd44352_device::set_on_callback(*device, DEVCB2_##_devcb);
1817
18
1919//**************************************************************************
2020//  TYPE DEFINITIONS
2121//**************************************************************************
2222
23
24// ======================> hd44352_interface
25
26struct hd44352_interface
27{
28   devcb_write_line    m_on_cb;        // ON line
29};
30
3123// ======================> hd44352_device
3224
3325class hd44352_device :
34                  public device_t,
35                  public hd44352_interface
26                  public device_t
3627{
3728public:
3829   // construction/destruction
3930   hd44352_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4031
32   template<class _Object> static devcb2_base &set_on_callback(device_t &device, _Object object) { return downcast<hd44352_device &>(device).m_on_cb.set_callback(object); }
33   
4134   // device interface
4235   UINT8 data_read();
4336   void data_write(UINT8 data);
r28758r28759
5043   virtual void device_start();
5144   virtual void device_reset();
5245   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
53   virtual void device_config_complete();
5446   virtual void device_validity_check(validity_checker &valid) const;
5547
5648private:
r28758r28759
8072   UINT8 m_cursor_y;
8173   UINT8 m_cursor_lcd;
8274
83   devcb_resolved_write_line m_on;         // ON line callback
75   devcb2_write_line    m_on_cb;        // ON line callback
8476};
8577
8678// device type definition
trunk/src/mess/drivers/pb1000.c
r28758r28759
500500   m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192));
501501}
502502
503static const hd44352_interface hd44352_pb1000_conf =
504{
505   DEVCB_CPU_INPUT_LINE("maincpu", HD61700_ON_INT)
506};
507
508503static MACHINE_CONFIG_START( pb1000, pb1000_state )
509504   /* basic machine hardware */
510505   MCFG_CPU_ADD("maincpu", HD61700, 910000)
r28758r28759
525520   MCFG_PALETTE_INIT_OWNER(pb1000_state, pb1000)
526521   MCFG_GFXDECODE_ADD("gfxdecode", "palette", pb1000 )
527522
528   MCFG_HD44352_ADD("hd44352", 910000, hd44352_pb1000_conf)
523   MCFG_DEVICE_ADD("hd44352", HD44352, 910000)
524   MCFG_HD44352_ON_CB(INPUTLINE("maincpu", HD61700_ON_INT))
529525
530526   MCFG_NVRAM_ADD_0FILL("nvram1")
531527   MCFG_NVRAM_ADD_0FILL("nvram2")

Previous 199869 Revisions Next


© 1997-2024 The MAME Team