Previous 199869 Revisions Next

r29537 Friday 11th April, 2014 at 16:30:02 UTC by Osso
printer_image_device: converted to devcb2 (nw)
[src/emu/bus/centronics]image.c
[src/emu/bus/iq151]staper.c
[src/emu/imagedev]printer.c printer.h
[src/mess/drivers]dragon.c hec2hrp.c interact.c mc10.c ql.c vg5k.c x07.c

trunk/src/emu/imagedev/printer.c
r29536r29537
1919
2020printer_image_device::printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2121   : device_t(mconfig, PRINTER, "Printer", tag, owner, clock, "printer_image", __FILE__),
22      device_image_interface(mconfig, *this)
22      device_image_interface(mconfig, *this),
23      m_online_cb(*this)
2324{
2425}
2526
r29536r29537
3940
4041void printer_image_device::device_config_complete()
4142{
42   // inherit a copy of the static data
43   const printer_interface *intf = reinterpret_cast<const printer_interface *>(static_config());
44   if (intf != NULL)
45      *static_cast<printer_interface *>(this) = *intf;
46
47   // or initialize to defaults if none provided
48   else
49   {
50      memset(&m_online, 0, sizeof(m_online));
51   }
52
5343   // set brief and instance name
5444   update_names();
5545}
r29536r29537
6151
6252void printer_image_device::device_start()
6353{
64   m_online_func.resolve(m_online, *this);
54   m_online_cb.resolve();
6555}
6656
6757/***************************************************************************
r29536r29537
10797bool printer_image_device::call_load()
10898{
10999   /* send notify that the printer is now online */
110   if (!m_online_func.isnull())
111      m_online_func(TRUE);
100   if (!m_online_cb.isnull())
101      m_online_cb(TRUE);
112102
113103   /* we don't need to do anything special */
114104   return IMAGE_INIT_PASS;
r29536r29537
121111void printer_image_device::call_unload()
122112{
123113   /* send notify that the printer is now offline */
124   if (!m_online_func.isnull())
125      m_online_func(FALSE);
114   if (!m_online_cb.isnull())
115      m_online_cb(FALSE);
126116}
trunk/src/emu/imagedev/printer.h
r29536r29537
1010#define __PRINTER_H__
1111
1212
13#define MCFG_PRINTER_ONLINE_CB(_devcb) \
14   devcb = &printer_image_device::set_online_callback(*device, DEVCB2_##_devcb);
15   
16
1317/***************************************************************************
1418    TYPE DEFINITIONS
1519***************************************************************************/
1620
17// ======================> printer_interface
18
19struct printer_interface
20{
21   devcb_write_line m_online;
22};
23
2421// ======================> printer_image_device
2522
2623class printer_image_device :    public device_t,
27                        public printer_interface,
2824                        public device_image_interface
2925{
3026public:
3127   // construction/destruction
3228   printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3329   virtual ~printer_image_device();
30   
31   template<class _Object> static devcb2_base &set_online_callback(device_t &device, _Object object) { return downcast<printer_image_device &>(device).m_online_cb.set_callback(object); }
3432
3533   // image-level overrides
3634   virtual bool call_load();
r29536r29537
5654   void output(UINT8 data);
5755protected:
5856   // device-level overrides
59   virtual void device_config_complete();
6057   virtual void device_start();
58   virtual void device_config_complete();
6159
62   devcb_resolved_write_line m_online_func;
60   devcb2_write_line m_online_cb;
6361};
6462
6563
6664// device type definition
6765extern const device_type PRINTER;
6866
69
70#define MCFG_PRINTER_ADD(_tag) \
71   MCFG_DEVICE_ADD(_tag, PRINTER, 0)
7267#endif /* __PRINTER_H__ */
trunk/src/emu/bus/iq151/staper.c
r29536r29537
3434static MACHINE_CONFIG_FRAGMENT( iq151_staper )
3535   MCFG_I8255A_ADD("ppi8255", iq151_staper_ppi_intf)
3636
37   MCFG_PRINTER_ADD("printer")
37   MCFG_DEVICE_ADD("printer", PRINTER, 0)
3838MACHINE_CONFIG_END
3939
4040//**************************************************************************
trunk/src/emu/bus/centronics/image.c
r29536r29537
88// device type definition
99const device_type CENTRONICS_PRINTER_IMAGE = &device_creator<centronics_printer_image_device>;
1010
11/*****************************************************************************
12    PRINTER INTERFACE
13*****************************************************************************/
14const struct printer_interface centronics_printer_config =
15{
16   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, centronics_printer_image_device, printer_online)
17};
1811
1912static MACHINE_CONFIG_FRAGMENT( centronics_printer )
20   MCFG_PRINTER_ADD("printer")
21   MCFG_DEVICE_CONFIG(centronics_printer_config)
13   MCFG_DEVICE_ADD("printer", PRINTER, 0)
14   MCFG_PRINTER_ONLINE_CB(WRITELINE(centronics_printer_image_device, printer_online))
2215MACHINE_CONFIG_END
2316
2417
trunk/src/mess/drivers/ql.c
r29536r29537
11751175   MCFG_RAM_EXTRA_OPTIONS("192K,256K,384K,640K,896K")
11761176
11771177   // Parallel printer port on Sandy disk interface
1178   MCFG_PRINTER_ADD(PRINTER_TAG)
1178   MCFG_DEVICE_ADD(PRINTER_TAG, PRINTER, 0)
11791179MACHINE_CONFIG_END
11801180
11811181
trunk/src/mess/drivers/interact.c
r29536r29537
176176   MCFG_SOFTWARE_LIST_ADD("cass_list","interact")
177177
178178   /* printer */
179   MCFG_PRINTER_ADD("printer")
179   MCFG_DEVICE_ADD("printer", PRINTER, 0)
180180
181181MACHINE_CONFIG_END
182182
r29536r29537
218218   MCFG_CASSETTE_ADD( "cassette", interact_cassette_interface )
219219
220220   /* printer */
221   MCFG_PRINTER_ADD("printer")
221   MCFG_DEVICE_ADD("printer", PRINTER, 0)
222222
223223MACHINE_CONFIG_END
224224
trunk/src/mess/drivers/mc10.c
r29536r29537
520520   MCFG_CASSETTE_ADD("cassette", mc10_cassette_interface)
521521
522522   /* printer */
523   MCFG_PRINTER_ADD("printer")
523   MCFG_DEVICE_ADD("printer", PRINTER, 0)
524524
525525   /* internal ram */
526526   MCFG_RAM_ADD(RAM_TAG)
r29536r29537
555555   MCFG_CASSETTE_ADD("cassette", alice32_cassette_interface)
556556
557557   /* printer */
558   MCFG_PRINTER_ADD("printer")
558   MCFG_DEVICE_ADD("printer", PRINTER, 0)
559559
560560   /* internal ram */
561561   MCFG_RAM_ADD(RAM_TAG)
trunk/src/mess/drivers/vg5k.c
r29536r29537
405405   MCFG_CASSETTE_ADD( "cassette", vg5k_cassette_interface )
406406
407407   /* printer */
408   MCFG_PRINTER_ADD("printer")
408   MCFG_DEVICE_ADD("printer", PRINTER, 0)
409409
410410   /* internal ram */
411411   MCFG_RAM_ADD(RAM_TAG)
trunk/src/mess/drivers/dragon.c
r29536r29537
162162   MCFG_SAM6883_ADD(SAM_TAG, XTAL_4_433619MHz, dragon_state::sam6883_config)
163163   MCFG_SAM6883_RES_CALLBACK(READ8(dragon_state, sam_read))
164164   MCFG_CASSETTE_ADD("cassette", dragon_state::coco_cassette_interface)
165   MCFG_PRINTER_ADD(PRINTER_TAG)
165   MCFG_DEVICE_ADD(PRINTER_TAG, PRINTER, 0)
166166
167167   // video hardware
168168   MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, VDG_TAG)
trunk/src/mess/drivers/x07.c
r29536r29537
14951495   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
14961496
14971497   /* printer */
1498   MCFG_PRINTER_ADD("printer")
1498   MCFG_DEVICE_ADD("printer", PRINTER, 0)
14991499
15001500   MCFG_TIMER_DRIVER_ADD_PERIODIC("blink_timer", x07_state, blink_timer, attotime::from_msec(300))
15011501
trunk/src/mess/drivers/hec2hrp.c
r29536r29537
466466   MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface )
467467
468468   /* printer */
469   MCFG_PRINTER_ADD("printer")
469   MCFG_DEVICE_ADD("printer", PRINTER, 0)
470470
471471MACHINE_CONFIG_END
472472
r29536r29537
510510   MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface )
511511
512512   /* printer */
513   MCFG_PRINTER_ADD("printer")
513   MCFG_DEVICE_ADD("printer", PRINTER, 0)
514514
515515MACHINE_CONFIG_END
516516
r29536r29537
568568   MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface )
569569
570570   /* printer */
571   MCFG_PRINTER_ADD("printer")
571   MCFG_DEVICE_ADD("printer", PRINTER, 0)
572572
573573MACHINE_CONFIG_END
574574/*****************************************************************************/
r29536r29537
621621   MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface )
622622
623623   /* printer */
624   MCFG_PRINTER_ADD("printer")
624   MCFG_DEVICE_ADD("printer", PRINTER, 0)
625625
626626MACHINE_CONFIG_END
627627/*****************************************************************************/
r29536r29537
670670   MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface )
671671
672672   /* printer */
673   MCFG_PRINTER_ADD("printer")
673   MCFG_DEVICE_ADD("printer", PRINTER, 0)
674674
675675MACHINE_CONFIG_END
676676
r29536r29537
724724   MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface )
725725
726726   /* printer */
727   MCFG_PRINTER_ADD("printer")
727   MCFG_DEVICE_ADD("printer", PRINTER, 0)
728728
729729   MACHINE_CONFIG_END
730730

Previous 199869 Revisions Next


© 1997-2024 The MAME Team