huc6261, huc6272: Use required_device instead of explicit lookups (nw)

This commit is contained in:
AJR 2018-05-13 13:31:20 -04:00
parent 05ca2a543b
commit 1d68137135
4 changed files with 12 additions and 34 deletions

View File

@ -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));

View File

@ -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;

View File

@ -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);
}

View File

@ -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;