diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-05-13 13:31:20 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-05-13 13:31:20 -0400 |
commit | 1d6813713596cbdbbd9fe592cd3367f1551aadaf (patch) | |
tree | 160efa0bf863dca994f974b8418381d11bf67a04 /src/devices/video | |
parent | 05ca2a543b8871123a4ead1518029ab8f824cab6 (diff) |
huc6261, huc6272: Use required_device instead of explicit lookups (nw)
Diffstat (limited to 'src/devices/video')
-rw-r--r-- | src/devices/video/huc6261.cpp | 18 | ||||
-rw-r--r-- | src/devices/video/huc6261.h | 16 | ||||
-rw-r--r-- | src/devices/video/huc6272.cpp | 6 | ||||
-rw-r--r-- | src/devices/video/huc6272.h | 6 |
4 files changed, 12 insertions, 34 deletions
diff --git a/src/devices/video/huc6261.cpp b/src/devices/video/huc6261.cpp index 90c7a7884da..5776b388e8a 100644 --- a/src/devices/video/huc6261.cpp +++ b/src/devices/video/huc6261.cpp @@ -34,8 +34,9 @@ DEFINE_DEVICE_TYPE(HUC6261, huc6261_device, "huc6261", "Hudson HuC6261 VCE") huc6261_device::huc6261_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, HUC6261, tag, owner, clock), device_video_interface(mconfig, *this), - m_huc6270_a_tag(nullptr), m_huc6270_b_tag(nullptr), m_huc6272_tag(nullptr), - m_huc6270_a(nullptr), m_huc6270_b(nullptr), m_huc6272(nullptr), + m_huc6270_a(*this, finder_base::DUMMY_TAG), + m_huc6270_b(*this, finder_base::DUMMY_TAG), + m_huc6272(*this, finder_base::DUMMY_TAG), m_last_h(0), m_last_v(0), m_height(0), m_address(0), m_palette_latch(0), m_register(0), m_control(0), m_pixels_per_clock(0), m_pixel_data_a(0), m_pixel_data_b(0), m_pixel_clock(0), m_timer(nullptr), m_bmp(nullptr) { // Set up UV lookup table @@ -413,23 +414,10 @@ WRITE16_MEMBER( huc6261_device::write ) void huc6261_device::device_start() { - /* Make sure we are supplied all our mandatory tags */ - assert( m_huc6270_a_tag != nullptr ); - assert( m_huc6270_b_tag != nullptr ); - assert( m_huc6272_tag != nullptr ); - m_timer = timer_alloc(); - m_huc6270_a = machine().device<huc6270_device>(m_huc6270_a_tag); - m_huc6270_b = machine().device<huc6270_device>(m_huc6270_b_tag); - m_huc6272 = machine().device<huc6272_device>(m_huc6272_tag); m_bmp = std::make_unique<bitmap_rgb32>(WPF, LPF); - /* We want to have valid devices */ - assert( m_huc6270_a != nullptr ); - assert( m_huc6270_b != nullptr ); - assert( m_huc6272 != nullptr ); - save_item(NAME(m_last_h)); save_item(NAME(m_last_v)); save_item(NAME(m_height)); diff --git a/src/devices/video/huc6261.h b/src/devices/video/huc6261.h index 99ad5e422d6..f3621688d44 100644 --- a/src/devices/video/huc6261.h +++ b/src/devices/video/huc6261.h @@ -36,9 +36,9 @@ public: // construction/destruction huc6261_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - void set_vdc1_tag(const char *tag) { m_huc6270_a_tag = tag; } - void set_vdc2_tag(const char *tag) { m_huc6270_b_tag = tag; } - void set_king_tag(const char *tag) { m_huc6272_tag = tag; } + void set_vdc1_tag(const char *tag) { m_huc6270_a.set_tag(tag); } + void set_vdc2_tag(const char *tag) { m_huc6270_b.set_tag(tag); } + void set_king_tag(const char *tag) { m_huc6272.set_tag(tag); } void video_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_READ16_MEMBER( read ); @@ -51,13 +51,9 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: - const char *m_huc6270_a_tag; - const char *m_huc6270_b_tag; - const char *m_huc6272_tag; - - huc6270_device *m_huc6270_a; - huc6270_device *m_huc6270_b; - huc6272_device *m_huc6272; + required_device<huc6270_device> m_huc6270_a; + required_device<huc6270_device> m_huc6270_b; + required_device<huc6272_device> m_huc6272; int m_last_h; int m_last_v; int m_height; diff --git a/src/devices/video/huc6272.cpp b/src/devices/video/huc6272.cpp index b4cc4c7b1e7..839bf285e20 100644 --- a/src/devices/video/huc6272.cpp +++ b/src/devices/video/huc6272.cpp @@ -45,6 +45,7 @@ void huc6272_device::kram_map(address_map &map) huc6272_device::huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, HUC6272, tag, owner, clock), device_memory_interface(mconfig, *this), + m_huc6271(*this, finder_base::DUMMY_TAG), m_program_space_config("microprg", ENDIANNESS_LITTLE, 16, 4, 0, address_map_constructor(), address_map_constructor(FUNC(huc6272_device::microprg_map), this)), m_data_space_config("kram", ENDIANNESS_LITTLE, 32, 21, 0, address_map_constructor(), address_map_constructor(FUNC(huc6272_device::kram_map), this)), m_microprg_ram(*this, "microprg_ram"), @@ -76,11 +77,6 @@ void huc6272_device::device_validity_check(validity_checker &valid) const void huc6272_device::device_start() { m_irq_changed_cb.resolve_safe(); - - assert( m_huc6271_tag != nullptr ); - - m_huc6271 = machine().device<huc6271_device>(m_huc6271_tag); - } diff --git a/src/devices/video/huc6272.h b/src/devices/video/huc6272.h index 58a601837dc..22f93c7456c 100644 --- a/src/devices/video/huc6272.h +++ b/src/devices/video/huc6272.h @@ -41,7 +41,7 @@ public: huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); template <class Object> devcb_base &set_irq_changed_callback(Object &&cb) { return m_irq_changed_cb.set_callback(std::forward<Object>(cb)); } - void set_rainbow_tag(const char *tag) { m_huc6271_tag = tag; } + void set_rainbow_tag(const char *tag) { m_huc6271.set_tag(tag); } // I/O operations DECLARE_WRITE32_MEMBER( write ); @@ -56,9 +56,7 @@ protected: virtual space_config_vector memory_space_config() const override; private: - const char *m_huc6271_tag; - - huc6271_device *m_huc6271; + required_device<huc6271_device> m_huc6271; uint8_t m_register; uint32_t m_kram_addr_r, m_kram_addr_w; |