From 83805a56ef0d9a3d1f4048acf8bb616dbc6f2afa Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 13 May 2018 13:12:24 -0400 Subject: [PATCH] pc_vga.cpp: machine().device cleanups (nw) --- src/devices/bus/isa/mach32.cpp | 12 ++---------- src/devices/bus/isa/mach32.h | 2 -- src/devices/video/pc_vga.cpp | 16 ++++------------ src/devices/video/pc_vga.h | 8 +++----- 4 files changed, 9 insertions(+), 29 deletions(-) diff --git a/src/devices/bus/isa/mach32.cpp b/src/devices/bus/isa/mach32.cpp index f2aa9d49872..8867a35d313 100644 --- a/src/devices/bus/isa/mach32.cpp +++ b/src/devices/bus/isa/mach32.cpp @@ -49,14 +49,10 @@ mach32_device::mach32_device(const machine_config &mconfig, device_type type, co MACHINE_CONFIG_START(mach32_device::device_add_mconfig) MCFG_DEVICE_ADD("8514a", ATIMACH32_8514A, 0) + downcast(device)->set_vga(DEVICE_SELF); MCFG_EEPROM_SERIAL_93C56_ADD("ati_eeprom") MACHINE_CONFIG_END -void mach32_8514a_device::device_config_complete() -{ - m_vga = dynamic_cast(owner()); -} - void mach32_8514a_device::device_start() { mach8_device::device_start(); @@ -339,14 +335,10 @@ mach64_device::mach64_device(const machine_config &mconfig, device_type type, co MACHINE_CONFIG_START(mach64_device::device_add_mconfig) MCFG_DEVICE_ADD("8514a", ATIMACH64_8514A, 0) + downcast(device)->set_vga(DEVICE_SELF); MCFG_EEPROM_SERIAL_93C56_ADD("ati_eeprom") MACHINE_CONFIG_END -void mach64_8514a_device::device_config_complete() -{ - m_vga = dynamic_cast(owner()); -} - void mach64_8514a_device::device_start() { mach32_8514a_device::device_start(); diff --git a/src/devices/bus/isa/mach32.h b/src/devices/bus/isa/mach32.h index 3ce09ccd029..18d4673ab0f 100644 --- a/src/devices/bus/isa/mach32.h +++ b/src/devices/bus/isa/mach32.h @@ -39,7 +39,6 @@ protected: virtual void device_start() override; virtual void device_reset() override; - virtual void device_config_complete() override; uint16_t m_chip_ID; uint16_t m_membounds; @@ -198,7 +197,6 @@ protected: virtual void device_start() override; virtual void device_reset() override; - virtual void device_config_complete() override; }; // main SVGA device diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp index 1da79ab034a..f7da6fded14 100644 --- a/src/devices/video/pc_vga.cpp +++ b/src/devices/video/pc_vga.cpp @@ -184,6 +184,7 @@ ibm8514a_device::ibm8514a_device(const machine_config &mconfig, const char *tag, ibm8514a_device::ibm8514a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) + , m_vga(*this, finder_base::DUMMY_TAG) { } @@ -415,14 +416,6 @@ void ibm8514a_device::device_start() ibm8514.write_mask = 0xffffffff; } -void ibm8514a_device::device_config_complete() -{ - if(m_vga_tag.length() != 0) - { - m_vga = machine().device(m_vga_tag.c_str()); - } -} - void mach8_device::device_start() { ibm8514a_device::device_start(); @@ -3311,7 +3304,7 @@ READ8_MEMBER(ati_vga_device::port_03c0_r) void ibm8514a_device::ibm8514_write_fg(uint32_t offset) { - address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().dummy_space(); offset %= m_vga->vga.svga_intf.vram_size; uint8_t dst = m_vga->mem_linear_r(space,offset,0xff); uint8_t src = 0; @@ -3400,7 +3393,7 @@ void ibm8514a_device::ibm8514_write_fg(uint32_t offset) void ibm8514a_device::ibm8514_write_bg(uint32_t offset) { - address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().dummy_space(); offset %= m_vga->vga.svga_intf.vram_size; uint8_t dst = m_vga->mem_linear_r(space,offset,0xff); uint8_t src = 0; @@ -3530,8 +3523,7 @@ void ibm8514a_device::ibm8514_write(uint32_t offset, uint32_t src) ibm8514.src_x = 0; break; case 0x00c0: // use source plane - address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM); - if(m_vga->mem_linear_r(space,src,0xff) != 0x00) + if (m_vga->mem_linear_r(machine().dummy_space(), src, 0xff) != 0x00) ibm8514_write_fg(offset); else ibm8514_write_bg(offset); diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h index c455b7ad68d..5675d8f4de7 100644 --- a/src/devices/video/pc_vga.h +++ b/src/devices/video/pc_vga.h @@ -278,8 +278,8 @@ class ibm8514a_device : public device_t public: ibm8514a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - void set_vga(const char* tag) { m_vga_tag.assign(tag); } - void set_vga_owner() { m_vga = dynamic_cast(owner()); } + void set_vga(const char *tag) { m_vga.set_tag(tag); } + void set_vga_owner() { m_vga.set_tag(DEVICE_SELF); } void enabled(); @@ -395,13 +395,11 @@ protected: ibm8514a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); virtual void device_start() override; - virtual void device_config_complete() override; void ibm8514_write(uint32_t offset, uint32_t src); void ibm8514_write_fg(uint32_t offset); void ibm8514_write_bg(uint32_t offset); - svga_device* m_vga; // for pass-through - std::string m_vga_tag; // pass-through device tag + required_device m_vga; // for pass-through private: void ibm8514_draw_vector(uint8_t len, uint8_t dir, bool draw); void ibm8514_wait_draw_ssv();