trunk/src/emu/imagedev/printer.c
| r29536 | r29537 | |
| 19 | 19 | |
| 20 | 20 | printer_image_device::printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 21 | 21 | : 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) |
| 23 | 24 | { |
| 24 | 25 | } |
| 25 | 26 | |
| r29536 | r29537 | |
| 39 | 40 | |
| 40 | 41 | void printer_image_device::device_config_complete() |
| 41 | 42 | { |
| 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 | | |
| 53 | 43 | // set brief and instance name |
| 54 | 44 | update_names(); |
| 55 | 45 | } |
| r29536 | r29537 | |
| 61 | 51 | |
| 62 | 52 | void printer_image_device::device_start() |
| 63 | 53 | { |
| 64 | | m_online_func.resolve(m_online, *this); |
| 54 | m_online_cb.resolve(); |
| 65 | 55 | } |
| 66 | 56 | |
| 67 | 57 | /*************************************************************************** |
| r29536 | r29537 | |
| 107 | 97 | bool printer_image_device::call_load() |
| 108 | 98 | { |
| 109 | 99 | /* 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); |
| 112 | 102 | |
| 113 | 103 | /* we don't need to do anything special */ |
| 114 | 104 | return IMAGE_INIT_PASS; |
| r29536 | r29537 | |
| 121 | 111 | void printer_image_device::call_unload() |
| 122 | 112 | { |
| 123 | 113 | /* 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); |
| 126 | 116 | } |
trunk/src/emu/imagedev/printer.h
| r29536 | r29537 | |
| 10 | 10 | #define __PRINTER_H__ |
| 11 | 11 | |
| 12 | 12 | |
| 13 | #define MCFG_PRINTER_ONLINE_CB(_devcb) \ |
| 14 | devcb = &printer_image_device::set_online_callback(*device, DEVCB2_##_devcb); |
| 15 | |
| 16 | |
| 13 | 17 | /*************************************************************************** |
| 14 | 18 | TYPE DEFINITIONS |
| 15 | 19 | ***************************************************************************/ |
| 16 | 20 | |
| 17 | | // ======================> printer_interface |
| 18 | | |
| 19 | | struct printer_interface |
| 20 | | { |
| 21 | | devcb_write_line m_online; |
| 22 | | }; |
| 23 | | |
| 24 | 21 | // ======================> printer_image_device |
| 25 | 22 | |
| 26 | 23 | class printer_image_device : public device_t, |
| 27 | | public printer_interface, |
| 28 | 24 | public device_image_interface |
| 29 | 25 | { |
| 30 | 26 | public: |
| 31 | 27 | // construction/destruction |
| 32 | 28 | printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 33 | 29 | 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); } |
| 34 | 32 | |
| 35 | 33 | // image-level overrides |
| 36 | 34 | virtual bool call_load(); |
| r29536 | r29537 | |
| 56 | 54 | void output(UINT8 data); |
| 57 | 55 | protected: |
| 58 | 56 | // device-level overrides |
| 59 | | virtual void device_config_complete(); |
| 60 | 57 | virtual void device_start(); |
| 58 | virtual void device_config_complete(); |
| 61 | 59 | |
| 62 | | devcb_resolved_write_line m_online_func; |
| 60 | devcb2_write_line m_online_cb; |
| 63 | 61 | }; |
| 64 | 62 | |
| 65 | 63 | |
| 66 | 64 | // device type definition |
| 67 | 65 | extern const device_type PRINTER; |
| 68 | 66 | |
| 69 | | |
| 70 | | #define MCFG_PRINTER_ADD(_tag) \ |
| 71 | | MCFG_DEVICE_ADD(_tag, PRINTER, 0) |
| 72 | 67 | #endif /* __PRINTER_H__ */ |
trunk/src/emu/bus/centronics/image.c
| r29536 | r29537 | |
| 8 | 8 | // device type definition |
| 9 | 9 | const device_type CENTRONICS_PRINTER_IMAGE = &device_creator<centronics_printer_image_device>; |
| 10 | 10 | |
| 11 | | /***************************************************************************** |
| 12 | | PRINTER INTERFACE |
| 13 | | *****************************************************************************/ |
| 14 | | const struct printer_interface centronics_printer_config = |
| 15 | | { |
| 16 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, centronics_printer_image_device, printer_online) |
| 17 | | }; |
| 18 | 11 | |
| 19 | 12 | static 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)) |
| 22 | 15 | MACHINE_CONFIG_END |
| 23 | 16 | |
| 24 | 17 | |
trunk/src/mess/drivers/interact.c
| r29536 | r29537 | |
| 176 | 176 | MCFG_SOFTWARE_LIST_ADD("cass_list","interact") |
| 177 | 177 | |
| 178 | 178 | /* printer */ |
| 179 | | MCFG_PRINTER_ADD("printer") |
| 179 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 180 | 180 | |
| 181 | 181 | MACHINE_CONFIG_END |
| 182 | 182 | |
| r29536 | r29537 | |
| 218 | 218 | MCFG_CASSETTE_ADD( "cassette", interact_cassette_interface ) |
| 219 | 219 | |
| 220 | 220 | /* printer */ |
| 221 | | MCFG_PRINTER_ADD("printer") |
| 221 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 222 | 222 | |
| 223 | 223 | MACHINE_CONFIG_END |
| 224 | 224 | |
trunk/src/mess/drivers/mc10.c
| r29536 | r29537 | |
| 520 | 520 | MCFG_CASSETTE_ADD("cassette", mc10_cassette_interface) |
| 521 | 521 | |
| 522 | 522 | /* printer */ |
| 523 | | MCFG_PRINTER_ADD("printer") |
| 523 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 524 | 524 | |
| 525 | 525 | /* internal ram */ |
| 526 | 526 | MCFG_RAM_ADD(RAM_TAG) |
| r29536 | r29537 | |
| 555 | 555 | MCFG_CASSETTE_ADD("cassette", alice32_cassette_interface) |
| 556 | 556 | |
| 557 | 557 | /* printer */ |
| 558 | | MCFG_PRINTER_ADD("printer") |
| 558 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 559 | 559 | |
| 560 | 560 | /* internal ram */ |
| 561 | 561 | MCFG_RAM_ADD(RAM_TAG) |
trunk/src/mess/drivers/dragon.c
| r29536 | r29537 | |
| 162 | 162 | MCFG_SAM6883_ADD(SAM_TAG, XTAL_4_433619MHz, dragon_state::sam6883_config) |
| 163 | 163 | MCFG_SAM6883_RES_CALLBACK(READ8(dragon_state, sam_read)) |
| 164 | 164 | MCFG_CASSETTE_ADD("cassette", dragon_state::coco_cassette_interface) |
| 165 | | MCFG_PRINTER_ADD(PRINTER_TAG) |
| 165 | MCFG_DEVICE_ADD(PRINTER_TAG, PRINTER, 0) |
| 166 | 166 | |
| 167 | 167 | // video hardware |
| 168 | 168 | MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, VDG_TAG) |
trunk/src/mess/drivers/hec2hrp.c
| r29536 | r29537 | |
| 466 | 466 | MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface ) |
| 467 | 467 | |
| 468 | 468 | /* printer */ |
| 469 | | MCFG_PRINTER_ADD("printer") |
| 469 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 470 | 470 | |
| 471 | 471 | MACHINE_CONFIG_END |
| 472 | 472 | |
| r29536 | r29537 | |
| 510 | 510 | MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface ) |
| 511 | 511 | |
| 512 | 512 | /* printer */ |
| 513 | | MCFG_PRINTER_ADD("printer") |
| 513 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 514 | 514 | |
| 515 | 515 | MACHINE_CONFIG_END |
| 516 | 516 | |
| r29536 | r29537 | |
| 568 | 568 | MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface ) |
| 569 | 569 | |
| 570 | 570 | /* printer */ |
| 571 | | MCFG_PRINTER_ADD("printer") |
| 571 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 572 | 572 | |
| 573 | 573 | MACHINE_CONFIG_END |
| 574 | 574 | /*****************************************************************************/ |
| r29536 | r29537 | |
| 621 | 621 | MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface ) |
| 622 | 622 | |
| 623 | 623 | /* printer */ |
| 624 | | MCFG_PRINTER_ADD("printer") |
| 624 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 625 | 625 | |
| 626 | 626 | MACHINE_CONFIG_END |
| 627 | 627 | /*****************************************************************************/ |
| r29536 | r29537 | |
| 670 | 670 | MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface ) |
| 671 | 671 | |
| 672 | 672 | /* printer */ |
| 673 | | MCFG_PRINTER_ADD("printer") |
| 673 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 674 | 674 | |
| 675 | 675 | MACHINE_CONFIG_END |
| 676 | 676 | |
| r29536 | r29537 | |
| 724 | 724 | MCFG_CASSETTE_ADD( "cassette", hector_cassette_interface ) |
| 725 | 725 | |
| 726 | 726 | /* printer */ |
| 727 | | MCFG_PRINTER_ADD("printer") |
| 727 | MCFG_DEVICE_ADD("printer", PRINTER, 0) |
| 728 | 728 | |
| 729 | 729 | MACHINE_CONFIG_END |
| 730 | 730 | |