diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-05-13 08:59:08 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-05-13 08:59:08 -0400 |
commit | 3dda481107518a52cc5b26564a100a2bdc3ac34a (patch) | |
tree | 41d914a5ce40163849cecea2efa770c17955a758 /src/mame/video | |
parent | 48c4db053cfe85a4294dbe7e75323465194f71cd (diff) |
Eliminate some explicit device tag lookups (nw)
Diffstat (limited to 'src/mame/video')
-rw-r--r-- | src/mame/video/antic.cpp | 19 | ||||
-rw-r--r-- | src/mame/video/antic.h | 5 | ||||
-rw-r--r-- | src/mame/video/tia.cpp | 13 | ||||
-rw-r--r-- | src/mame/video/tia.h | 2 | ||||
-rw-r--r-- | src/mame/video/ygv608.cpp | 14 | ||||
-rw-r--r-- | src/mame/video/ygv608.h | 4 |
6 files changed, 28 insertions, 29 deletions
diff --git a/src/mame/video/antic.cpp b/src/mame/video/antic.cpp index 0da156a1ab0..4f698e214c0 100644 --- a/src/mame/video/antic.cpp +++ b/src/mame/video/antic.cpp @@ -311,7 +311,7 @@ DEFINE_DEVICE_TYPE(ATARI_ANTIC, antic_device, "antic", "Atari ANTIC") antic_device::antic_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ATARI_ANTIC, tag, owner, clock), device_video_interface(mconfig, *this), - m_gtia_tag(nullptr), + m_gtia(*this, finder_base::DUMMY_TAG), m_maincpu(*this, ":maincpu"), m_djoy_b(*this, ":djoy_b"), m_artifacts(*this, ":artifacts"), @@ -345,9 +345,6 @@ antic_device::antic_device(const machine_config &mconfig, const char *tag, devic void antic_device::device_start() { - m_gtia = machine().device<gtia_device>(m_gtia_tag); - assert(m_gtia); - m_bitmap = std::make_unique<bitmap_ind16>(screen().width(), screen().height()); m_cclk_expand = make_unique_clear<uint32_t[]>(21 * 256); @@ -1177,7 +1174,7 @@ READ8_MEMBER ( antic_device::read ) data = m_r.antic09; break; case 10: /* WSYNC read */ - machine().device("maincpu")->execute().spin_until_trigger(TRIGGER_HSYNC); + m_maincpu->spin_until_trigger(TRIGGER_HSYNC); m_w.wsync = 1; data = m_r.antic0a; break; @@ -1287,7 +1284,7 @@ WRITE8_MEMBER ( antic_device::write ) break; case 10: /* WSYNC write */ LOG(("ANTIC 0A write WSYNC $%02X\n", data)); - machine().device("maincpu")->execute().spin_until_trigger(TRIGGER_HSYNC); + m_maincpu->spin_until_trigger(TRIGGER_HSYNC); m_w.wsync = 1; break; case 11: @@ -1975,7 +1972,7 @@ TIMER_CALLBACK_MEMBER( antic_device::issue_dli ) { LOG((" @cycle #%3d issue DLI\n", cycle())); m_r.nmist |= DLI_NMI; - machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } else { @@ -2022,7 +2019,7 @@ TIMER_CALLBACK_MEMBER( antic_device::steal_cycles ) LOG((" @cycle #%3d steal %d cycles\n", cycle(), m_steal_cycles)); timer_set(ANTIC_TIME_FROM_CYCLES(m_steal_cycles), TIMER_LINE_DONE); m_steal_cycles = 0; - machine().device("maincpu")->execute().spin_until_trigger(TRIGGER_STEAL); + m_maincpu->spin_until_trigger(TRIGGER_STEAL); } @@ -2036,7 +2033,7 @@ TIMER_CALLBACK_MEMBER( antic_device::steal_cycles ) *****************************************************************************/ TIMER_CALLBACK_MEMBER( antic_device::scanline_render ) { - address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); LOG((" @cycle #%3d render mode $%X lines to go #%d\n", cycle(), (m_cmd & 0x0f), m_modelines)); @@ -2106,7 +2103,7 @@ void antic_device::LMS(int new_cmd) **************************************************************/ if( new_cmd & ANTIC_LMS ) { - address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); int addr = RDANTIC(space); m_doffs = (m_doffs + 1) & DOFFS; addr += 256 * RDANTIC(space); @@ -2131,7 +2128,7 @@ void antic_device::LMS(int new_cmd) *****************************************************************************/ void antic_device::scanline_dma(int param) { - address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); LOG((" @cycle #%3d DMA fetch\n", cycle())); if (m_scanline == VBL_END) m_r.nmist &= ~VBL_NMI; diff --git a/src/mame/video/antic.h b/src/mame/video/antic.h index fd8a3ebb4f9..7031d3b2e55 100644 --- a/src/mame/video/antic.h +++ b/src/mame/video/antic.h @@ -50,7 +50,7 @@ public: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - void set_gtia_tag(const char *tag) { m_gtia_tag = tag; } + void set_gtia_tag(const char *tag) { m_gtia.set_tag(tag); } DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -113,8 +113,7 @@ private: }; - const char *m_gtia_tag; - gtia_device *m_gtia; + required_device<gtia_device> m_gtia; required_device<cpu_device> m_maincpu; optional_ioport m_djoy_b; optional_ioport m_artifacts; diff --git a/src/mame/video/tia.cpp b/src/mame/video/tia.cpp index 52090e14d2d..f7efaa80ea7 100644 --- a/src/mame/video/tia.cpp +++ b/src/mame/video/tia.cpp @@ -358,6 +358,7 @@ tia_video_device::tia_video_device(const machine_config &mconfig, device_type ty , m_read_input_port_cb(*this) , m_databus_contents_cb(*this) , m_vsync_cb(*this) + , m_maincpu(*this, "^maincpu") { } @@ -658,13 +659,13 @@ int tia_video_device::collision_check(uint8_t* p1, uint8_t* p2, int x1, int x2) int tia_video_device::current_x() { - return 3 * ((machine().device<cpu_device>("maincpu")->total_cycles() - frame_cycles) % 76) - 68; + return 3 * ((m_maincpu->total_cycles() - frame_cycles) % 76) - 68; } int tia_video_device::current_y() { - return (machine().device<cpu_device>("maincpu")->total_cycles() - frame_cycles) / 76; + return (m_maincpu->total_cycles() - frame_cycles) / 76; } @@ -1003,11 +1004,11 @@ void tia_video_device::update_bitmap(int next_x, int next_y) WRITE8_MEMBER( tia_video_device::WSYNC_w ) { - int cycles = machine().device<cpu_device>("maincpu")->total_cycles() - frame_cycles; + int cycles = m_maincpu->total_cycles() - frame_cycles; if (cycles % 76) { - space.device().execute().adjust_icount(cycles % 76 - 76); + m_maincpu->adjust_icount(cycles % 76 - 76); } } @@ -1044,7 +1045,7 @@ WRITE8_MEMBER( tia_video_device::VBLANK_w ) { if (data & 0x80) { - paddle_start = machine().device<cpu_device>("maincpu")->total_cycles(); + paddle_start = m_maincpu->total_cycles(); } if ( ! ( VBLANK & 0x40 ) ) { INPT4 = 0x80; @@ -1797,7 +1798,7 @@ WRITE8_MEMBER( tia_video_device::GRP1_w ) READ8_MEMBER( tia_video_device::INPT_r ) { - uint64_t elapsed = machine().device<cpu_device>("maincpu")->total_cycles() - paddle_start; + uint64_t elapsed = m_maincpu->total_cycles() - paddle_start; uint16_t input = TIA_INPUT_PORT_ALWAYS_ON; if ( !m_read_input_port_cb.isnull() ) { diff --git a/src/mame/video/tia.h b/src/mame/video/tia.h index c718f4b0cb2..81226a2e693 100644 --- a/src/mame/video/tia.h +++ b/src/mame/video/tia.h @@ -116,6 +116,8 @@ private: devcb_read8 m_databus_contents_cb; devcb_write16 m_vsync_cb; + required_device<cpu_device> m_maincpu; + struct player_gfx p0gfx; struct player_gfx p1gfx; diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index 6f0a3866532..027ffa62fef 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -318,6 +318,7 @@ ygv608_device::ygv608_device( const machine_config &mconfig, const char *tag, de : device_t(mconfig, YGV608, tag, owner, clock), device_gfx_interface(mconfig, *this, GFXDECODE_NAME(ygv608)), device_memory_interface(mconfig, *this), + device_video_interface(mconfig, *this), m_io_space_config("io", ENDIANNESS_BIG, 8, 6, 0, address_map_constructor(FUNC(ygv608_device::regs_map), this)), m_vblank_handler(*this), m_raster_handler(*this) @@ -378,7 +379,6 @@ void ygv608_device::device_start() m_iospace = &space(AS_IO); // TODO: tagging configuration - m_screen = downcast<screen_device *>(machine().device("screen")); m_vblank_handler.resolve(); m_raster_handler.resolve(); m_vblank_timer = timer_alloc(VBLANK_TIMER); @@ -1386,7 +1386,7 @@ READ8_MEMBER(ygv608_device::register_data_r) READ8_MEMBER( ygv608_device::status_port_r ) { // TODO: we need to use h/vpos in case of border support instead due of how MAME framework works here. - return (m_screen_status & 0x1c) | (m_screen->hblank()<<1) | m_screen->vblank(); + return (m_screen_status & 0x1c) | (screen().hblank()<<1) | screen().vblank(); } // P#7R - system control port @@ -2085,7 +2085,7 @@ attotime ygv608_device::raster_sync_offset() } // TODO: actual sync not taken into account, needs a better test than NCV2 limited case - return m_screen->time_until_pos(m_raster_irq_vpos,m_raster_irq_hpos); + return screen().time_until_pos(m_raster_irq_vpos,m_raster_irq_hpos); } // R#17 / R#24 - base address @@ -2261,14 +2261,14 @@ void ygv608_device::screen_configure() // TODO: Dig Dug Original wants this to be 60.60 Hz (like original Namco HW), lets compensate somehow // (clock is really 6144000 x 8 = 49152000, so it must have same parameters in practice) - attoseconds_t period = HZ_TO_ATTOSECONDS(m_screen->clock()) * (m_crtc.vtotal + m_crtc.display_vsync) * ((m_crtc.htotal + 12 - m_crtc.display_hsync) / 2); + attoseconds_t period = HZ_TO_ATTOSECONDS(screen().clock()) * (m_crtc.vtotal + m_crtc.display_vsync) * ((m_crtc.htotal + 12 - m_crtc.display_hsync) / 2); - m_screen->configure(m_crtc.htotal / 2, m_crtc.vtotal, visarea, period ); + screen().configure(m_crtc.htotal / 2, m_crtc.vtotal, visarea, period ); // reset vblank timer m_vblank_timer->reset(); - //m_vblank_timer->adjust(m_screen->time_until_pos(m_crtc.display_vstart+m_crtc.display_height,0), 0, m_screen->frame_period()); - m_vblank_timer->adjust(m_screen->time_until_pos(m_crtc.display_height,0), 0, m_screen->frame_period()); + //m_vblank_timer->adjust(screen().time_until_pos(m_crtc.display_vstart+m_crtc.display_height,0), 0, screen().frame_period()); + m_vblank_timer->adjust(screen().time_until_pos(m_crtc.display_height,0), 0, screen().frame_period()); } diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h index 0a3b4ba9896..aedd5d9e78b 100644 --- a/src/mame/video/ygv608.h +++ b/src/mame/video/ygv608.h @@ -15,7 +15,8 @@ class ygv608_device : public device_t, public device_gfx_interface, - public device_memory_interface + public device_memory_interface, + public device_video_interface { public: // construction/destruction @@ -251,7 +252,6 @@ private: // screen section devcb_write_line m_vblank_handler; devcb_write_line m_raster_handler; - screen_device *m_screen; emu_timer *m_vblank_timer; emu_timer *m_raster_timer; |