Previous 199869 Revisions Next

r28715 Wednesday 19th March, 2014 at 13:00:21 UTC by Curt Coder
(MESS) gime: devcb2. (nw)
[src/mess/drivers]coco3.c
[src/mess/video]gime.c gime.h

trunk/src/mess/drivers/coco3.c
r28714r28715
235235   MAINCPU_TAG,
236236   RAM_TAG,
237237   CARTRIDGE_TAG,
238
239   DEVCB_DEVICE_LINE_MEMBER(PIA0_TAG, pia6821_device, ca1_w),  /* horizontal sync */
240   DEVCB_DEVICE_LINE_MEMBER(PIA0_TAG, pia6821_device, cb1_w),  /* field sync */
241   DEVCB_DRIVER_LINE_MEMBER(coco3_state, gime_irq_w),
242   DEVCB_DRIVER_LINE_MEMBER(coco3_state, gime_firq_w),
243   DEVCB_DRIVER_MEMBER(coco_state, floating_bus_read)
244238};
245239
246240static MACHINE_CONFIG_START( coco3, coco3_state )
r28714r28715
274268   MCFG_COCO_VHD_ADD(VHD1_TAG)
275269
276270   // video hardware
271   MCFG_DEFAULT_LAYOUT(layout_coco3)
272
277273   MCFG_DEVICE_ADD(GIME_TAG, GIME_NTSC, XTAL_3_579545MHz)
278274   MCFG_DEVICE_CONFIG(coco_gime_config)
279   MCFG_DEFAULT_LAYOUT(layout_coco3)
275   MCFG_GIME_HSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, ca1_w)) // TODO not hooked up in gime.c
276   MCFG_GIME_FSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, cb1_w)) // TODO not hooked up in gime.c
277   MCFG_GIME_IRQ_CALLBACK(WRITELINE(coco3_state, gime_irq_w))
278   MCFG_GIME_FIRQ_CALLBACK(WRITELINE(coco3_state, gime_firq_w))
279   MCFG_GIME_FLOATING_BUS_CALLBACK(READ8(coco_state, floating_bus_read))
280280
281281   // composite monitor
282282   MCFG_SCREEN_ADD(COMPOSITE_SCREEN_TAG, RASTER)
trunk/src/mess/video/gime.c
r28714r28715
107107//-------------------------------------------------
108108
109109gime_base_device::gime_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const UINT8 *fontdata, const char *shortname, const char *source)
110   :   mc6847_friend_device(mconfig, type, name, tag, owner, clock, fontdata, true, 263, 25+192+26+3, false, shortname, source)
110   :   mc6847_friend_device(mconfig, type, name, tag, owner, clock, fontdata, true, 263, 25+192+26+3, false, shortname, source),
111      m_write_hsync(*this),
112      m_write_fsync(*this),
113      m_write_irq(*this),
114      m_write_firq(*this),
115      m_read_floating_bus(*this)
111116{
112117}
113118
r28714r28715
162167   }
163168
164169   // resolve callbacks
165   m_res_out_hsync_func.resolve(config->m_out_hsync_func, *this);
166   m_res_out_fsync_func.resolve(config->m_out_fsync_func, *this);
167   m_res_out_irq_func.resolve(config->m_out_irq_func, *this);
168   m_res_out_firq_func.resolve(config->m_out_firq_func, *this);
169   m_res_in_floating_bus_func.resolve(config->m_in_floating_bus_func, *this);
170   m_write_hsync.resolve_safe();
171   m_write_fsync.resolve_safe();
172   m_write_irq.resolve_safe();
173   m_write_firq.resolve_safe();
174   m_read_floating_bus.resolve_safe(0);
170175
171176   // set up ROM/RAM pointers
172177   m_rom = machine().root_device().memregion(config->m_maincpu_tag)->base();
r28714r28715
756761
757762ATTR_FORCE_INLINE UINT8 gime_base_device::read_floating_bus(void)
758763{
759   return m_res_in_floating_bus_func.isnull()
760      ? 0
761      : m_res_in_floating_bus_func(0);
764   return m_read_floating_bus(0);
762765}
763766
764767
r28714r28715
10961099
10971100void gime_base_device::recalculate_irq(void)
10981101{
1099   if (!m_res_out_irq_func.isnull())
1100      m_res_out_irq_func(irq_r());
1102   m_write_irq(irq_r());
11011103}
11021104
11031105
r28714r28715
11081110
11091111void gime_base_device::recalculate_firq(void)
11101112{
1111   if (!m_res_out_firq_func.isnull())
1112      m_res_out_firq_func(firq_r());
1113   m_write_firq(firq_r());
11131114}
11141115
11151116
trunk/src/mess/video/gime.h
r28714r28715
2121//  GIME CONFIG/INTERFACE
2222//**************************************************************************
2323
24#define MCFG_GIME_HSYNC_CALLBACK(_write) \
25   devcb = &gime_base_device::set_hsync_wr_callback(*device, DEVCB2_##_write);
26
27#define MCFG_GIME_FSYNC_CALLBACK(_write) \
28   devcb = &gime_base_device::set_fsync_wr_callback(*device, DEVCB2_##_write);
29
30#define MCFG_GIME_IRQ_CALLBACK(_write) \
31   devcb = &gime_base_device::set_irq_wr_callback(*device, DEVCB2_##_write);
32
33#define MCFG_GIME_FIRQ_CALLBACK(_write) \
34   devcb = &gime_base_device::set_irq_wr_callback(*device, DEVCB2_##_write);
35
36#define MCFG_GIME_FLOATING_BUS_CALLBACK(_read) \
37   devcb = &gime_base_device::set_floating_bus_rd_callback(*device, DEVCB2_##_read);
38
2439/* interface */
2540struct gime_interface
2641{
r28714r28715
2843   const char *m_maincpu_tag;  /* tag of main CPU */
2944   const char *m_ram_tag;      /* tag of RAM device */
3045   const char *m_ext_tag;      /* tag of expansion device */
31
32   /* if specified, this gets called for every change of the HSYNC pin */
33   devcb_write_line            m_out_hsync_func;
34
35   /* if specified, this gets called for every change of the FSYNC pin */
36   devcb_write_line            m_out_fsync_func;
37
38   /* if specified, this gets called for every change of the IRQ pin */
39   devcb_write_line            m_out_irq_func;
40
41   /* if specified, this gets called for every change of the FIRQ pin */
42   devcb_write_line            m_out_firq_func;
43
44   /* if specified, this reads from the floating bus */
45   devcb_read8                 m_in_floating_bus_func;
4646};
4747
4848
r28714r28715
5656class gime_base_device : public mc6847_friend_device, public sam6883_friend_device
5757{
5858public:
59   template<class _Object> static devcb2_base &set_hsync_wr_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_write_hsync.set_callback(object); }
60   template<class _Object> static devcb2_base &set_fsync_wr_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_write_fsync.set_callback(object); }
61   template<class _Object> static devcb2_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_write_irq.set_callback(object); }
62   template<class _Object> static devcb2_base &set_firq_wr_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_write_firq.set_callback(object); }
63   template<class _Object> static devcb2_base &set_floating_bus_rd_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_read_floating_bus.set_callback(object); }
64
5965   // read/write
6066   DECLARE_READ8_MEMBER( read ) { return read(offset); }
6167   DECLARE_WRITE8_MEMBER( write ) { write(offset, data); }
r28714r28715
156162   static const UINT8 hires_font[128][12];
157163
158164   // callbacks
159   devcb_resolved_write_line   m_res_out_irq_func;
160   devcb_resolved_write_line   m_res_out_firq_func;
161   devcb_resolved_read8        m_res_in_floating_bus_func;
165   devcb2_write_line   m_write_hsync;
166   devcb2_write_line   m_write_fsync;
167   devcb2_write_line   m_write_irq;
168   devcb2_write_line   m_write_firq;
169   devcb2_read8        m_read_floating_bus;
162170
163171   // device state
164172   UINT8                       m_gime_registers[16];

Previous 199869 Revisions Next


© 1997-2024 The MAME Team