From aa45e908bbf1c6ac8141b1990500817699888b59 Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 5 Jan 2018 10:47:21 -0500 Subject: Privatize m_screen and other variables of device_video_interface (nw) --- src/devices/bus/macpds/pds_tpdfpd.cpp | 6 ++-- src/devices/bus/nubus/nubus_48gc.cpp | 2 +- src/devices/bus/nubus/nubus_m2hires.cpp | 6 ++-- src/devices/bus/nubus/nubus_m2video.cpp | 6 ++-- src/devices/bus/nubus/nubus_radiustpd.cpp | 6 ++-- src/devices/bus/nubus/nubus_spec8.cpp | 6 ++-- src/devices/bus/nubus/nubus_specpdq.cpp | 6 ++-- src/devices/bus/nubus/nubus_wsportrait.cpp | 6 ++-- src/devices/bus/nubus/pds30_30hr.cpp | 6 ++-- src/devices/bus/nubus/pds30_cb264.cpp | 6 ++-- src/devices/bus/nubus/pds30_mc30.cpp | 6 ++-- src/devices/bus/nubus/pds30_procolor816.cpp | 6 ++-- src/devices/bus/nubus/pds30_sigmalview.cpp | 6 ++-- src/devices/bus/sms_ctrl/lphaser.cpp | 14 ++++---- src/devices/cpu/tms34010/34010gfx.hxx | 18 +++++----- src/devices/cpu/tms34010/tms34010.cpp | 28 ++++++++-------- src/devices/machine/k053252.cpp | 6 ++-- src/devices/machine/laserdsc.cpp | 4 +-- src/devices/machine/s2636.cpp | 10 +++--- src/devices/sound/cdp1864.cpp | 24 ++++++------- src/devices/sound/cdp1869.cpp | 4 +-- src/devices/sound/mos6560.cpp | 4 +-- src/devices/sound/mos7360.cpp | 6 ++-- src/devices/video/315_5124.cpp | 50 +++++++++++++-------------- src/devices/video/315_5124.h | 2 +- src/devices/video/315_5313.cpp | 8 ++--- src/devices/video/cdp1861.cpp | 24 ++++++------- src/devices/video/cdp1862.cpp | 6 ++-- src/devices/video/crt9007.cpp | 32 +++++++++--------- src/devices/video/crt9021.cpp | 4 +-- src/devices/video/crtc_ega.cpp | 8 ++--- src/devices/video/ef9340_1.cpp | 6 ++-- src/devices/video/ef9345.cpp | 16 ++++----- src/devices/video/ef9364.cpp | 8 ++--- src/devices/video/ef9365.cpp | 8 ++--- src/devices/video/gb_lcd.cpp | 6 ++-- src/devices/video/gba_lcd.cpp | 2 +- src/devices/video/hd61830.cpp | 2 +- src/devices/video/hd63484.cpp | 8 ++--- src/devices/video/hp1ll3.cpp | 2 +- src/devices/video/huc6260.cpp | 12 +++---- src/devices/video/huc6261.cpp | 16 ++++----- src/devices/video/i8244.cpp | 20 +++++------ src/devices/video/i8244.h | 1 - src/devices/video/i82730.cpp | 12 +++---- src/devices/video/i8275.cpp | 22 ++++++------ src/devices/video/imagetek_i4100.cpp | 2 +- src/devices/video/m50458.cpp | 2 +- src/devices/video/mc6845.cpp | 8 ++--- src/devices/video/mos6566.cpp | 2 +- src/devices/video/ppu2c0x.cpp | 8 ++--- src/devices/video/psx.cpp | 14 ++++---- src/devices/video/scn2674.cpp | 16 ++++----- src/devices/video/snes_ppu.cpp | 30 ++++++++--------- src/devices/video/snes_ppu.h | 4 +-- src/devices/video/tms34061.cpp | 8 ++--- src/devices/video/tms9928a.cpp | 8 ++--- src/devices/video/upd3301.cpp | 8 ++--- src/devices/video/upd7220.cpp | 12 +++---- src/devices/video/v9938.cpp | 8 ++--- src/devices/video/vic4567.cpp | 10 +++--- src/devices/video/zeus2.cpp | 25 +++++++------- src/devices/video/zeus2.h | 4 +-- src/emu/divideo.h | 2 ++ src/mame/machine/atarigen.cpp | 22 ++++++------ src/mame/machine/n64.cpp | 10 +++--- src/mame/machine/nb1414m4.cpp | 4 +-- src/mame/video/antic.cpp | 14 ++++---- src/mame/video/atarimo.cpp | 8 ++--- src/mame/video/atarirle.cpp | 20 +++++------ src/mame/video/decmxc06.cpp | 2 +- src/mame/video/deco16ic.cpp | 2 +- src/mame/video/decospr.cpp | 14 ++++---- src/mame/video/fuukifg.cpp | 9 +++-- src/mame/video/gic.cpp | 4 +-- src/mame/video/gic.h | 1 - src/mame/video/k001005.cpp | 2 +- src/mame/video/k037122.cpp | 2 +- src/mame/video/k053246_k053247_k055673.cpp | 2 +- src/mame/video/k053246_k053247_k055673.h | 10 +++--- src/mame/video/k053250.cpp | 2 +- src/mame/video/k1ge.cpp | 14 ++++---- src/mame/video/kan_pand.cpp | 6 ++-- src/mame/video/kaneko_spr.cpp | 8 ++--- src/mame/video/mcd212.cpp | 14 ++++---- src/mame/video/nick.cpp | 8 ++--- src/mame/video/powervr2.cpp | 52 ++++++++++++++--------------- src/mame/video/segaic16.cpp | 14 ++++---- src/mame/video/sknsspr.cpp | 4 +-- src/mame/video/tc0780fpa.cpp | 2 +- src/mame/video/tia.cpp | 8 ++--- src/mame/video/uv201.cpp | 16 ++++----- src/mame/video/zx8301.cpp | 4 +-- 93 files changed, 456 insertions(+), 460 deletions(-) diff --git a/src/devices/bus/macpds/pds_tpdfpd.cpp b/src/devices/bus/macpds/pds_tpdfpd.cpp index a6d39106c8b..b6ccb6c802a 100644 --- a/src/devices/bus/macpds/pds_tpdfpd.cpp +++ b/src/devices/bus/macpds/pds_tpdfpd.cpp @@ -95,7 +95,7 @@ macpds_sedisplay_device::macpds_sedisplay_device(const machine_config &mconfig, m_vram(nullptr), m_vbl_disable(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, SEDISPLAY_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -118,7 +118,7 @@ void macpds_sedisplay_device::device_start() m_macpds->install_device(0xc10000, 0xc2ffff, read16_delegate(FUNC(macpds_sedisplay_device::sedisplay_r), this), write16_delegate(FUNC(macpds_sedisplay_device::sedisplay_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(879, 0), 0); + m_timer->adjust(screen().time_until_pos(879, 0), 0); } //------------------------------------------------- @@ -145,7 +145,7 @@ void macpds_sedisplay_device::device_timer(emu_timer &timer, device_timer_id tid m_macpds->set_irq_line(M68K_IRQ_2, ASSERT_LINE); } - m_timer->adjust(m_screen->time_until_pos(879, 0), 0); + m_timer->adjust(screen().time_until_pos(879, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp index e454b8cbcec..8e1bd9306fd 100644 --- a/src/devices/bus/nubus/nubus_48gc.cpp +++ b/src/devices/bus/nubus/nubus_48gc.cpp @@ -79,7 +79,7 @@ jmfb_device::jmfb_device(const machine_config &mconfig, device_type type, const m_is824(is824), m_assembled_tag(util::string_format("%s:%s", tag, GC48_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } nubus_48gc_device::nubus_48gc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : diff --git a/src/devices/bus/nubus/nubus_m2hires.cpp b/src/devices/bus/nubus/nubus_m2hires.cpp index 4c0481b16fc..da2964b0b45 100644 --- a/src/devices/bus/nubus/nubus_m2hires.cpp +++ b/src/devices/bus/nubus/nubus_m2hires.cpp @@ -73,7 +73,7 @@ nubus_m2hires_device::nubus_m2hires_device(const machine_config &mconfig, device m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, M2HIRES_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -100,7 +100,7 @@ void nubus_m2hires_device::device_start() m_nubus->install_device(slotspace+0x80000, slotspace+0xeffff, read32_delegate(FUNC(nubus_m2hires_device::m2hires_r), this), write32_delegate(FUNC(nubus_m2hires_device::m2hires_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } //------------------------------------------------- @@ -128,7 +128,7 @@ void nubus_m2hires_device::device_timer(emu_timer &timer, device_timer_id tid, i raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/nubus_m2video.cpp b/src/devices/bus/nubus/nubus_m2video.cpp index a61859f0f40..38d86ef808a 100644 --- a/src/devices/bus/nubus/nubus_m2video.cpp +++ b/src/devices/bus/nubus/nubus_m2video.cpp @@ -75,7 +75,7 @@ nubus_m2video_device::nubus_m2video_device(const machine_config &mconfig, device m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, M2VIDEO_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -102,7 +102,7 @@ void nubus_m2video_device::device_start() m_nubus->install_device(slotspace+0x80000, slotspace+0xeffff, read32_delegate(FUNC(nubus_m2video_device::m2video_r), this), write32_delegate(FUNC(nubus_m2video_device::m2video_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } //------------------------------------------------- @@ -130,7 +130,7 @@ void nubus_m2video_device::device_timer(emu_timer &timer, device_timer_id tid, i raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/nubus_radiustpd.cpp b/src/devices/bus/nubus/nubus_radiustpd.cpp index 46676a99f37..dcf0ac1e660 100644 --- a/src/devices/bus/nubus/nubus_radiustpd.cpp +++ b/src/devices/bus/nubus/nubus_radiustpd.cpp @@ -76,7 +76,7 @@ nubus_radiustpd_device::nubus_radiustpd_device(const machine_config &mconfig, de m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, RADIUSTPD_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -104,7 +104,7 @@ void nubus_radiustpd_device::device_start() m_nubus->install_device(slotspace+0x980000, slotspace+0x9effff, read32_delegate(FUNC(nubus_radiustpd_device::radiustpd_r), this), write32_delegate(FUNC(nubus_radiustpd_device::radiustpd_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } //------------------------------------------------- @@ -132,7 +132,7 @@ void nubus_radiustpd_device::device_timer(emu_timer &timer, device_timer_id tid, raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/nubus_spec8.cpp b/src/devices/bus/nubus/nubus_spec8.cpp index d9c19173914..6217e4d8abc 100644 --- a/src/devices/bus/nubus/nubus_spec8.cpp +++ b/src/devices/bus/nubus/nubus_spec8.cpp @@ -78,7 +78,7 @@ nubus_spec8s3_device::nubus_spec8s3_device(const machine_config &mconfig, device m_assembled_tag(util::string_format("%s:%s", tag, SPEC8S3_SCREEN_NAME)), m_vbl_pending(false), m_parameter(0) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -104,7 +104,7 @@ void nubus_spec8s3_device::device_start() m_nubus->install_device(slotspace+0xd0000, slotspace+0xfffff, read32_delegate(FUNC(nubus_spec8s3_device::spec8s3_r), this), write32_delegate(FUNC(nubus_spec8s3_device::spec8s3_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(767, 0), 0); + m_timer->adjust(screen().time_until_pos(767, 0), 0); } //------------------------------------------------- @@ -135,7 +135,7 @@ void nubus_spec8s3_device::device_timer(emu_timer &timer, device_timer_id tid, i m_vbl_pending = true; } - m_timer->adjust(m_screen->time_until_pos(767, 0), 0); + m_timer->adjust(screen().time_until_pos(767, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/nubus_specpdq.cpp b/src/devices/bus/nubus/nubus_specpdq.cpp index 7cc46f46987..bf4c231e5c3 100644 --- a/src/devices/bus/nubus/nubus_specpdq.cpp +++ b/src/devices/bus/nubus/nubus_specpdq.cpp @@ -92,7 +92,7 @@ nubus_specpdq_device::nubus_specpdq_device(const machine_config &mconfig, device m_width(0), m_height(0), m_patofsx(0), m_patofsy(0), m_vram_addr(0), m_vram_src(0), m_palette(*this, "palette") { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -117,7 +117,7 @@ void nubus_specpdq_device::device_start() m_nubus->install_device(slotspace+0x400000, slotspace+0xfbffff, read32_delegate(FUNC(nubus_specpdq_device::specpdq_r), this), write32_delegate(FUNC(nubus_specpdq_device::specpdq_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(843, 0), 0); + m_timer->adjust(screen().time_until_pos(843, 0), 0); } //------------------------------------------------- @@ -145,7 +145,7 @@ void nubus_specpdq_device::device_timer(emu_timer &timer, device_timer_id tid, i raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(843, 0), 0); + m_timer->adjust(screen().time_until_pos(843, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/nubus_wsportrait.cpp b/src/devices/bus/nubus/nubus_wsportrait.cpp index 64dc4c0db7d..22b055e8336 100644 --- a/src/devices/bus/nubus/nubus_wsportrait.cpp +++ b/src/devices/bus/nubus/nubus_wsportrait.cpp @@ -76,7 +76,7 @@ nubus_wsportrait_device::nubus_wsportrait_device(const machine_config &mconfig, m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, WSPORTRAIT_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -103,7 +103,7 @@ void nubus_wsportrait_device::device_start() m_nubus->install_device(slotspace+0x80000, slotspace+0xeffff, read32_delegate(FUNC(nubus_wsportrait_device::wsportrait_r), this), write32_delegate(FUNC(nubus_wsportrait_device::wsportrait_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(869, 0), 0); + m_timer->adjust(screen().time_until_pos(869, 0), 0); } //------------------------------------------------- @@ -128,7 +128,7 @@ void nubus_wsportrait_device::device_timer(emu_timer &timer, device_timer_id tid raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(869, 0), 0); + m_timer->adjust(screen().time_until_pos(869, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/pds30_30hr.cpp b/src/devices/bus/nubus/pds30_30hr.cpp index 31e764cd5f6..0a351e5138b 100644 --- a/src/devices/bus/nubus/pds30_30hr.cpp +++ b/src/devices/bus/nubus/pds30_30hr.cpp @@ -76,7 +76,7 @@ nubus_xceed30hr_device::nubus_xceed30hr_device(const machine_config &mconfig, de m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, XCEED30HR_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -102,7 +102,7 @@ void nubus_xceed30hr_device::device_start() m_nubus->install_device(slotspace+0x800000, slotspace+0xefffff, read32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_r), this), write32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } //------------------------------------------------- @@ -130,7 +130,7 @@ void nubus_xceed30hr_device::device_timer(emu_timer &timer, device_timer_id tid, raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/pds30_cb264.cpp b/src/devices/bus/nubus/pds30_cb264.cpp index 86079675739..1e730ddb5c3 100644 --- a/src/devices/bus/nubus/pds30_cb264.cpp +++ b/src/devices/bus/nubus/pds30_cb264.cpp @@ -70,7 +70,7 @@ nubus_cb264se30_device::nubus_cb264se30_device(const machine_config &mconfig, de m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, CB264SE30_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -96,7 +96,7 @@ void nubus_cb264se30_device::device_start() m_nubus->install_device(slotspace+0xf00000, slotspace+0xfeffff, read32_delegate(FUNC(nubus_cb264se30_device::cb264se30_r), this), write32_delegate(FUNC(nubus_cb264se30_device::cb264se30_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } //------------------------------------------------- @@ -124,7 +124,7 @@ void nubus_cb264se30_device::device_timer(emu_timer &timer, device_timer_id tid, raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/pds30_mc30.cpp b/src/devices/bus/nubus/pds30_mc30.cpp index 2d48fdc5231..c66f219b13f 100644 --- a/src/devices/bus/nubus/pds30_mc30.cpp +++ b/src/devices/bus/nubus/pds30_mc30.cpp @@ -72,7 +72,7 @@ nubus_xceedmc30_device::nubus_xceedmc30_device(const machine_config &mconfig, de m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, XCEEDMC30_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -98,7 +98,7 @@ void nubus_xceedmc30_device::device_start() m_nubus->install_device(slotspace+0x800000, slotspace+0xefffff, read32_delegate(FUNC(nubus_xceedmc30_device::xceedmc30_r), this), write32_delegate(FUNC(nubus_xceedmc30_device::xceedmc30_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } //------------------------------------------------- @@ -126,7 +126,7 @@ void nubus_xceedmc30_device::device_timer(emu_timer &timer, device_timer_id tid, raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/pds30_procolor816.cpp b/src/devices/bus/nubus/pds30_procolor816.cpp index 2333637761d..80691948af5 100644 --- a/src/devices/bus/nubus/pds30_procolor816.cpp +++ b/src/devices/bus/nubus/pds30_procolor816.cpp @@ -75,7 +75,7 @@ nubus_procolor816_device::nubus_procolor816_device(const machine_config &mconfig m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, PROCOLOR816_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -102,7 +102,7 @@ void nubus_procolor816_device::device_start() m_nubus->install_device(slotspace+0xf00000, slotspace+0xff7fff, read32_delegate(FUNC(nubus_procolor816_device::procolor816_r), this), write32_delegate(FUNC(nubus_procolor816_device::procolor816_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } //------------------------------------------------- @@ -130,7 +130,7 @@ void nubus_procolor816_device::device_timer(emu_timer &timer, device_timer_id ti raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + m_timer->adjust(screen().time_until_pos(479, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/nubus/pds30_sigmalview.cpp b/src/devices/bus/nubus/pds30_sigmalview.cpp index 860775b2e5d..5917d0f13b0 100644 --- a/src/devices/bus/nubus/pds30_sigmalview.cpp +++ b/src/devices/bus/nubus/pds30_sigmalview.cpp @@ -70,7 +70,7 @@ nubus_lview_device::nubus_lview_device(const machine_config &mconfig, device_typ m_vram32(nullptr), m_vbl_disable(0), m_toggle(0), m_timer(nullptr), m_protstate(0), m_assembled_tag(util::string_format("%s:%s", tag, LVIEW_SCREEN_NAME)) { - m_screen_tag = m_assembled_tag.c_str(); + static_set_screen(*this, m_assembled_tag.c_str()); } //------------------------------------------------- @@ -97,7 +97,7 @@ void nubus_lview_device::device_start() m_nubus->install_device(slotspace+0xb0000, slotspace+0xbffff, read32_delegate(FUNC(nubus_lview_device::lview_r), this), write32_delegate(FUNC(nubus_lview_device::lview_w), this)); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(m_screen->time_until_pos(599, 0), 0); + m_timer->adjust(screen().time_until_pos(599, 0), 0); } //------------------------------------------------- @@ -123,7 +123,7 @@ void nubus_lview_device::device_timer(emu_timer &timer, device_timer_id tid, int raise_slot_irq(); } - m_timer->adjust(m_screen->time_until_pos(599, 0), 0); + m_timer->adjust(screen().time_until_pos(599, 0), 0); } /*************************************************************************** diff --git a/src/devices/bus/sms_ctrl/lphaser.cpp b/src/devices/bus/sms_ctrl/lphaser.cpp index 264f74151a1..1782a75a689 100644 --- a/src/devices/bus/sms_ctrl/lphaser.cpp +++ b/src/devices/bus/sms_ctrl/lphaser.cpp @@ -93,7 +93,7 @@ sms_light_phaser_device::sms_light_phaser_device(const machine_config &mconfig, { // Workaround for failed validation that occurs when running on a driver // with Sega Scope emulation, which adds 2 screens (left/right lenses). - m_screen_tag = ":screen"; + static_set_screen(*this, ":screen"); } @@ -150,10 +150,10 @@ uint8_t sms_light_phaser_device::peripheral_r() int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int lgun_y ) { const int r_x_r = LGUN_RADIUS * LGUN_RADIUS; - const rectangle &visarea = m_screen->visible_area(); + const rectangle &visarea = screen().visible_area(); rectangle aim_area; - int beam_x = m_screen->hpos(); - int beam_y = m_screen->vpos(); + int beam_x = screen().hpos(); + int beam_y = screen().vpos(); int beam_x_orig = beam_x; int beam_y_orig = beam_y; int dy, result = 1; @@ -256,14 +256,14 @@ int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int } } - timer->adjust(m_screen->time_until_pos(beam_y, beam_x)); + timer->adjust(screen().time_until_pos(beam_y, beam_x)); return result; } uint16_t sms_light_phaser_device::screen_hpos_nonscaled(int scaled_hpos) { - const rectangle &visarea = m_screen->visible_area(); + const rectangle &visarea = screen().visible_area(); int offset_x = (scaled_hpos * (visarea.max_x - visarea.min_x)) / 255; return visarea.min_x + offset_x; } @@ -271,7 +271,7 @@ uint16_t sms_light_phaser_device::screen_hpos_nonscaled(int scaled_hpos) uint16_t sms_light_phaser_device::screen_vpos_nonscaled(int scaled_vpos) { - const rectangle &visarea = m_screen->visible_area(); + const rectangle &visarea = screen().visible_area(); int offset_y = (scaled_vpos * (visarea.max_y - visarea.min_y)) / 255; return visarea.min_y + offset_y; } diff --git a/src/devices/cpu/tms34010/34010gfx.hxx b/src/devices/cpu/tms34010/34010gfx.hxx index 5d508380772..80d9aa0669f 100644 --- a/src/devices/cpu/tms34010/34010gfx.hxx +++ b/src/devices/cpu/tms34010/34010gfx.hxx @@ -27,7 +27,7 @@ void tms340x0_device::line(uint16_t op) m_st |= STBIT_P; TEMP() = (op & 0x80) ? 1 : 0; /* boundary value depends on the algorithm */ - LOGGFX(("%08X(%3d):LINE (%d,%d)-(%d,%d)\n", m_pc, m_screen->vpos(), DADDR_X(), DADDR_Y(), DADDR_X() + DYDX_X(), DADDR_Y() + DYDX_Y())); + LOGGFX(("%08X(%3d):LINE (%d,%d)-(%d,%d)\n", m_pc, screen().vpos(), DADDR_X(), DADDR_Y(), DADDR_X() + DYDX_X(), DADDR_Y() + DYDX_Y())); } if (COUNT() > 0) @@ -835,7 +835,7 @@ void tms340x0_device::pixblt_b_l(uint16_t op) int trans = (IOREG(REG_CONTROL) & 0x20) >> 5; int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT B,L (%dx%d) depth=%d\n", m_pc, m_screen->vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT B,L (%dx%d) depth=%d\n", m_pc, screen().vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); m_pixel_op = s_pixel_op_table[rop]; m_pixel_op_timing = s_pixel_op_timing_table[rop]; (this->*s_pixblt_b_op_table[ix])(1); @@ -847,7 +847,7 @@ void tms340x0_device::pixblt_b_xy(uint16_t op) int trans = (IOREG(REG_CONTROL) & 0x20) >> 5; int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT B,XY (%d,%d) (%dx%d) depth=%d\n", m_pc, m_screen->vpos(), DADDR_X(), DADDR_Y(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT B,XY (%d,%d) (%dx%d) depth=%d\n", m_pc, screen().vpos(), DADDR_X(), DADDR_Y(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); m_pixel_op = s_pixel_op_table[rop]; m_pixel_op_timing = s_pixel_op_timing_table[rop]; (this->*s_pixblt_b_op_table[ix])(0); @@ -860,7 +860,7 @@ void tms340x0_device::pixblt_l_l(uint16_t op) int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int pbh = (IOREG(REG_CONTROL) >> 8) & 1; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT L,L (%dx%d) depth=%d\n", m_pc, m_screen->vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT L,L (%dx%d) depth=%d\n", m_pc, screen().vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); m_pixel_op = s_pixel_op_table[rop]; m_pixel_op_timing = s_pixel_op_timing_table[rop]; if (!pbh) @@ -876,7 +876,7 @@ void tms340x0_device::pixblt_l_xy(uint16_t op) int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int pbh = (IOREG(REG_CONTROL) >> 8) & 1; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT L,XY (%d,%d) (%dx%d) depth=%d\n", m_pc, m_screen->vpos(), DADDR_X(), DADDR_Y(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT L,XY (%d,%d) (%dx%d) depth=%d\n", m_pc, screen().vpos(), DADDR_X(), DADDR_Y(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); m_pixel_op = s_pixel_op_table[rop]; m_pixel_op_timing = s_pixel_op_timing_table[rop]; if (!pbh) @@ -892,7 +892,7 @@ void tms340x0_device::pixblt_xy_l(uint16_t op) int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int pbh = (IOREG(REG_CONTROL) >> 8) & 1; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT XY,L (%dx%d) depth=%d\n", m_pc, m_screen->vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT XY,L (%dx%d) depth=%d\n", m_pc, screen().vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); m_pixel_op = s_pixel_op_table[rop]; m_pixel_op_timing = s_pixel_op_timing_table[rop]; if (!pbh) @@ -908,7 +908,7 @@ void tms340x0_device::pixblt_xy_xy(uint16_t op) int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int pbh = (IOREG(REG_CONTROL) >> 8) & 1; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT XY,XY (%dx%d) depth=%d\n", m_pc, m_screen->vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG()) LOGGFX(("%08X(%3d):PIXBLT XY,XY (%dx%d) depth=%d\n", m_pc, screen().vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); m_pixel_op = s_pixel_op_table[rop]; m_pixel_op_timing = s_pixel_op_timing_table[rop]; if (!pbh) @@ -923,7 +923,7 @@ void tms340x0_device::fill_l(uint16_t op) int trans = (IOREG(REG_CONTROL) & 0x20) >> 5; int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG()) LOGGFX(("%08X(%3d):FILL L (%dx%d) depth=%d\n", m_pc, m_screen->vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG()) LOGGFX(("%08X(%3d):FILL L (%dx%d) depth=%d\n", m_pc, screen().vpos(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); m_pixel_op = s_pixel_op_table[rop]; m_pixel_op_timing = s_pixel_op_timing_table[rop]; (this->*s_fill_op_table[ix])(1); @@ -935,7 +935,7 @@ void tms340x0_device::fill_xy(uint16_t op) int trans = (IOREG(REG_CONTROL) & 0x20) >> 5; int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG()) LOGGFX(("%08X(%3d):FILL XY (%d,%d) (%dx%d) depth=%d\n", m_pc, m_screen->vpos(), DADDR_X(), DADDR_Y(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG()) LOGGFX(("%08X(%3d):FILL XY (%d,%d) (%dx%d) depth=%d\n", m_pc, screen().vpos(), DADDR_X(), DADDR_Y(), DYDX_X(), DYDX_Y(), IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); m_pixel_op = s_pixel_op_table[rop]; m_pixel_op_timing = s_pixel_op_timing_table[rop]; (this->*s_fill_op_table[ix])(0); diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp index ffee2be42c9..6efb36980d2 100644 --- a/src/devices/cpu/tms34010/tms34010.cpp +++ b/src/devices/cpu/tms34010/tms34010.cpp @@ -849,7 +849,7 @@ TIMER_CALLBACK_MEMBER( tms340x0_device::scanline_callback ) int master; /* fetch the core timing parameters */ - const rectangle ¤t_visarea = m_screen->visible_area(); + const rectangle ¤t_visarea = screen().visible_area(); enabled = SMART_IOREG(DPYCTL) & 0x8000; master = (m_is_34020 || (SMART_IOREG(DPYCTL) & 0x2000)); vsblnk = SMART_IOREG(VSBLNK); @@ -857,8 +857,8 @@ TIMER_CALLBACK_MEMBER( tms340x0_device::scanline_callback ) vtotal = SMART_IOREG(VTOTAL); if (!master) { - vtotal = std::min(m_screen->height() - 1, vtotal); - vcount = m_screen->vpos(); + vtotal = std::min(screen().height() - 1, vtotal); + vcount = screen().vpos(); } /* update the VCOUNT */ @@ -916,13 +916,13 @@ TIMER_CALLBACK_MEMBER( tms340x0_device::scanline_callback ) /* because many games play with the HEBLNK/HSBLNK for effects, we don't change if they are the only thing that has changed, unless they are stable for a couple of frames */ - int current_width = m_screen->width(); - int current_height = m_screen->height(); + int current_width = screen().width(); + int current_height = screen().height(); if (width != current_width || height != current_height || visarea.min_y != current_visarea.min_y || visarea.max_y != current_visarea.max_y || (m_hblank_stable > 2 && (visarea.min_x != current_visarea.min_x || visarea.max_x != current_visarea.max_x))) { - m_screen->configure(width, height, visarea, refresh); + screen().configure(width, height, visarea, refresh); } m_hblank_stable++; } @@ -939,7 +939,7 @@ TIMER_CALLBACK_MEMBER( tms340x0_device::scanline_callback ) /* force a partial update within the visible area */ if (vcount >= current_visarea.min_y && vcount <= current_visarea.max_y && (!m_scanline_ind16_cb.isnull() || !m_scanline_rgb32_cb.isnull())) - m_screen->update_partial(vcount); + screen().update_partial(vcount); /* if we are in the visible area, increment DPYADR by DUDATE */ if (vcount >= veblnk && vcount < vsblnk) @@ -975,7 +975,7 @@ TIMER_CALLBACK_MEMBER( tms340x0_device::scanline_callback ) /* note that we add !master (0 or 1) as a attoseconds value; this makes no practical difference */ /* but helps ensure that masters are updated first before slaves */ - m_scantimer->adjust(m_screen->time_until_pos(vcount) + attotime(0, !master), vcount); + m_scantimer->adjust(screen().time_until_pos(vcount) + attotime(0, !master), vcount); } @@ -1210,7 +1210,7 @@ WRITE16_MEMBER( tms34010_device::io_register_w ) break; } - LOGCONTROLREGS("%s: %s = %04X (%d)\n", machine().describe_context(), ioreg_name[offset], IOREG(offset), m_screen->vpos()); + LOGCONTROLREGS("%s: %s = %04X (%d)\n", machine().describe_context(), ioreg_name[offset], IOREG(offset), screen().vpos()); } @@ -1245,7 +1245,7 @@ WRITE16_MEMBER( tms34020_device::io_register_w ) oldreg = IOREG(offset); IOREG(offset) = data; - LOGCONTROLREGS("%s: %s = %04X (%d)\n", machine().describe_context(), ioreg020_name[offset], IOREG(offset), m_screen->vpos()); + LOGCONTROLREGS("%s: %s = %04X (%d)\n", machine().describe_context(), ioreg020_name[offset], IOREG(offset), screen().vpos()); switch (offset) { @@ -1408,9 +1408,9 @@ READ16_MEMBER( tms34010_device::io_register_r ) { case REG_HCOUNT: /* scale the horizontal position from screen width to HTOTAL */ - result = m_screen->hpos(); + result = screen().hpos(); total = IOREG(REG_HTOTAL) + 1; - result = result * total / m_screen->width(); + result = result * total / screen().width(); /* offset by the HBLANK end */ result += IOREG(REG_HEBLNK); @@ -1449,9 +1449,9 @@ READ16_MEMBER( tms34020_device::io_register_r ) { case REG020_HCOUNT: /* scale the horizontal position from screen width to HTOTAL */ - result = m_screen->hpos(); + result = screen().hpos(); total = IOREG(REG020_HTOTAL) + 1; - result = result * total / m_screen->width(); + result = result * total / screen().width(); /* offset by the HBLANK end */ result += IOREG(REG020_HEBLNK); diff --git a/src/devices/machine/k053252.cpp b/src/devices/machine/k053252.cpp index 09f554d9146..f219c26f3cb 100644 --- a/src/devices/machine/k053252.cpp +++ b/src/devices/machine/k053252.cpp @@ -143,9 +143,9 @@ READ8_MEMBER( k053252_device::read ) /* VCT read-back */ // TODO: correct? case 0x0e: - return ((m_screen->vpos()-m_vc) >> 8) & 1; + return ((screen().vpos()-m_vc) >> 8) & 1; case 0x0f: - return (m_screen->vpos()-m_vc) & 0xff; + return (screen().vpos()-m_vc) & 0xff; default: //popmessage("Warning: k053252 read %02x, contact MAMEdev",offset); break; @@ -171,7 +171,7 @@ void k053252_device::res_change() visarea.max_x = m_offsx + m_hc - m_hfp - m_hbp - 8*(m_hsw) - 1; visarea.max_y = m_offsy + m_vc - m_vfp - m_vbp - (m_vsw) - 1; - m_screen->configure(m_hc, m_vc, visarea, refresh); + screen().configure(m_hc, m_vc, visarea, refresh); if (m_slave_screen.found()) m_slave_screen->configure(m_hc, m_vc, visarea, refresh); diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp index 49227fa13cc..72ac3d42ab4 100644 --- a/src/devices/machine/laserdsc.cpp +++ b/src/devices/machine/laserdsc.cpp @@ -485,7 +485,7 @@ void laserdisc_device::set_slider_speed(int32_t tracks_per_vsync) update_slider_pos(); // if 0, set the time to 0 - attotime vsyncperiod = m_screen->frame_period(); + attotime vsyncperiod = screen().frame_period(); if (tracks_per_vsync == 0) m_attospertrack = 0; @@ -792,7 +792,7 @@ void laserdisc_device::init_disc() void laserdisc_device::init_video() { // register for VBLANK callbacks - m_screen->register_vblank_callback(vblank_state_delegate(&laserdisc_device::vblank_state_changed, this)); + screen().register_vblank_callback(vblank_state_delegate(&laserdisc_device::vblank_state_changed, this)); // allocate palette for applying brightness/contrast/gamma m_videopalette = palette_t::alloc(256); diff --git a/src/devices/machine/s2636.cpp b/src/devices/machine/s2636.cpp index 5fda7f586c1..b0eb09aefa4 100644 --- a/src/devices/machine/s2636.cpp +++ b/src/devices/machine/s2636.cpp @@ -186,7 +186,7 @@ s2636_device::s2636_device(const machine_config &mconfig, const char *tag, devic void s2636_device::device_start() { - m_bitmap.resize(m_screen->width(), m_screen->height()); + m_bitmap.resize(screen().width(), screen().height()); save_item(NAME(m_bitmap)); @@ -218,8 +218,8 @@ void s2636_device::device_start() bitmap_ind16 const &s2636_device::update(const rectangle &cliprect) { m_vrst = true; - m_screen_line = m_screen->visible_area().min_y; - while (m_screen_line <= m_screen->visible_area().max_y) + m_screen_line = screen().visible_area().min_y; + while (m_screen_line <= screen().visible_area().max_y) render_next_line(); return m_bitmap; @@ -246,7 +246,7 @@ void s2636_device::render_next_line() assert(m_screen_line < m_bitmap.height()); // pre-clear the line for convenience - rectangle const &vis_area = m_screen->visible_area(); + rectangle const &vis_area = screen().visible_area(); uint16_t *const row = &m_bitmap.pix16(m_screen_line); m_bitmap.plot_box(0, m_screen_line, m_bitmap.width(), 1, 0); @@ -459,7 +459,7 @@ void s2636_device::sound_stream_update(sound_stream &stream, stream_sample_t **i { if (m_registers[REG_SND_PERIOD]) { - m_sample_cnt = (machine().sample_rate() * (m_registers[REG_SND_PERIOD] + 1) * m_screen->scan_period()).seconds(); + m_sample_cnt = (machine().sample_rate() * (m_registers[REG_SND_PERIOD] + 1) * screen().scan_period()).seconds(); m_sound_lvl = !m_sound_lvl; } else diff --git a/src/devices/sound/cdp1864.cpp b/src/devices/sound/cdp1864.cpp index 4f4689761a9..07a52d4d8a5 100644 --- a/src/devices/sound/cdp1864.cpp +++ b/src/devices/sound/cdp1864.cpp @@ -108,7 +108,7 @@ void cdp1864_device::device_start() m_hsync_timer = timer_alloc(TIMER_HSYNC); // find devices - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); // register for state saving save_item(NAME(m_disp)); @@ -128,8 +128,8 @@ void cdp1864_device::device_start() void cdp1864_device::device_reset() { - m_int_timer->adjust(m_screen->time_until_pos(SCANLINE_INT_START, 0)); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_TOP_START, 0)); + m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_START, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_START, 0)); m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_START)); m_disp = 0; @@ -148,7 +148,7 @@ void cdp1864_device::device_reset() void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - int scanline = m_screen->vpos(); + int scanline = screen().vpos(); switch (id) { @@ -160,7 +160,7 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para m_write_irq(ASSERT_LINE); } - m_int_timer->adjust(m_screen->time_until_pos(SCANLINE_INT_END, 0)); + m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_END, 0)); } else { @@ -169,7 +169,7 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para m_write_irq(CLEAR_LINE); } - m_int_timer->adjust(m_screen->time_until_pos(SCANLINE_INT_START, 0)); + m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_START, 0)); } break; @@ -178,22 +178,22 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para { case SCANLINE_EFX_TOP_START: m_write_efx(ASSERT_LINE); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_TOP_END, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_END, 0)); break; case SCANLINE_EFX_TOP_END: m_write_efx(CLEAR_LINE); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_BOTTOM_START, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_START, 0)); break; case SCANLINE_EFX_BOTTOM_START: m_write_efx(ASSERT_LINE); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_BOTTOM_END, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_END, 0)); break; case SCANLINE_EFX_BOTTOM_END: m_write_efx(CLEAR_LINE); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_TOP_START, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_START, 0)); break; } break; @@ -339,8 +339,8 @@ WRITE8_MEMBER( cdp1864_device::tone_latch_w ) WRITE8_MEMBER( cdp1864_device::dma_w ) { int rdata = 1, bdata = 1, gdata = 1; - int sx = m_screen->hpos() + 4; - int y = m_screen->vpos(); + int sx = screen().hpos() + 4; + int y = screen().vpos(); if (!m_con) { diff --git a/src/devices/sound/cdp1869.cpp b/src/devices/sound/cdp1869.cpp index fa9cdff2d84..61d7765a93e 100644 --- a/src/devices/sound/cdp1869.cpp +++ b/src/devices/sound/cdp1869.cpp @@ -177,7 +177,7 @@ inline void cdp1869_device::update_prd_changed_timer() int start = SCANLINE_PREDISPLAY_START_PAL; int end = SCANLINE_PREDISPLAY_END_PAL; int next_state; - int scanline = m_screen->vpos(); + int scanline = screen().vpos(); int next_scanline; if (is_ntsc()) @@ -207,7 +207,7 @@ inline void cdp1869_device::update_prd_changed_timer() next_state = CLEAR_LINE; } - attotime duration = m_screen->time_until_pos(next_scanline); + attotime duration = screen().time_until_pos(next_scanline); m_prd_timer->adjust(duration, next_state); } diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp index e37c65ba8e5..f6746750ec6 100644 --- a/src/devices/sound/mos6560.cpp +++ b/src/devices/sound/mos6560.cpp @@ -737,7 +737,7 @@ device_memory_interface::space_config_vector mos6560_device::memory_space_config void mos6560_device::device_start() { - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); // resolve callbacks m_read_potx.resolve_safe(0xff); @@ -769,7 +769,7 @@ void mos6560_device::device_start() // allocate timers m_line_timer = timer_alloc(TIMER_LINE); - m_line_timer->adjust(m_screen->scan_period(), 0, m_screen->scan_period()); + m_line_timer->adjust(screen().scan_period(), 0, screen().scan_period()); // initialize sound sound_start(); diff --git a/src/devices/sound/mos7360.cpp b/src/devices/sound/mos7360.cpp index d50368f3e54..8f153ec9551 100644 --- a/src/devices/sound/mos7360.cpp +++ b/src/devices/sound/mos7360.cpp @@ -291,12 +291,12 @@ void mos7360_device::device_start() m_timer2 = timer_alloc(TIMER_ID_2); m_timer3 = timer_alloc(TIMER_ID_3); m_line_timer = timer_alloc(TIMER_LINE); - m_line_timer->adjust(m_screen->scan_period(), 0, m_screen->scan_period()); + m_line_timer->adjust(screen().scan_period(), 0, screen().scan_period()); m_frame_timer = timer_alloc(TIMER_FRAME); - m_frame_timer->adjust(m_screen->frame_period(), 0, m_screen->frame_period()); + m_frame_timer->adjust(screen().frame_period(), 0, screen().frame_period()); // allocate screen bitmap - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); // create sound stream m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate()); diff --git a/src/devices/video/315_5124.cpp b/src/devices/video/315_5124.cpp index 3603e018953..3425cd9875f 100644 --- a/src/devices/video/315_5124.cpp +++ b/src/devices/video/315_5124.cpp @@ -294,13 +294,13 @@ void sega315_5124_device::set_frame_timing() READ8_MEMBER( sega315_5124_device::vcount_read ) { const int active_scr_start = m_frame_timing[VERTICAL_SYNC] + m_frame_timing[TOP_BLANKING] + m_frame_timing[TOP_BORDER]; - int vpos = m_screen->vpos(); + int vpos = screen().vpos(); - if (m_screen->hpos() < VCOUNT_CHANGE_HPOS) + if (screen().hpos() < VCOUNT_CHANGE_HPOS) { vpos--; if (vpos < 0) - vpos += m_screen->height(); + vpos += screen().height(); } return (vpos - active_scr_start) & 0xff; @@ -349,7 +349,7 @@ void sega315_5124_device::device_timer(emu_timer &timer, device_timer_id id, int case TIMER_DRAW: update_palette(); - draw_scanline( LBORDER_START + LBORDER_WIDTH, param, m_screen->vpos() - param ); + draw_scanline( LBORDER_START + LBORDER_WIDTH, param, screen().vpos() - param ); break; case TIMER_LBORDER: @@ -418,7 +418,7 @@ void sega315_5124_device::device_timer(emu_timer &timer, device_timer_id id, int void sega315_5124_device::process_line_timer() { - const int vpos = m_screen->vpos(); + const int vpos = screen().vpos(); int vpos_limit = m_frame_timing[VERTICAL_SYNC] + m_frame_timing[TOP_BLANKING] + m_frame_timing[TOP_BORDER] + m_frame_timing[ACTIVE_DISPLAY_V] + m_frame_timing[BOTTOM_BORDER] + m_frame_timing[BOTTOM_BLANKING]; @@ -462,7 +462,7 @@ void sega315_5124_device::process_line_timer() if (m_line_counter == 0x00) { m_line_counter = m_reg[0x0a]; - m_hint_timer->adjust( m_screen->time_until_pos( vpos, HINT_HPOS ) ); + m_hint_timer->adjust( screen().time_until_pos( vpos, HINT_HPOS ) ); m_pending_status |= STATUS_HINT; } else @@ -477,19 +477,19 @@ void sega315_5124_device::process_line_timer() if (vpos == vpos_limit + 1) { - m_vint_timer->adjust( m_screen->time_until_pos( vpos, VINT_HPOS ) ); + m_vint_timer->adjust( screen().time_until_pos( vpos, VINT_HPOS ) ); m_pending_status |= STATUS_VINT; } /* Draw borders */ - m_lborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START ), vpos ); - m_rborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START + LBORDER_WIDTH + 256 ), vpos ); + m_lborder_timer->adjust( screen().time_until_pos( vpos, LBORDER_START ), vpos ); + m_rborder_timer->adjust( screen().time_until_pos( vpos, LBORDER_START + LBORDER_WIDTH + 256 ), vpos ); /* Draw middle of the border */ /* We need to do this through the regular drawing function */ /* so sprite collisions can occur on the border. */ select_sprites( vpos - (vpos_limit - m_frame_timing[ACTIVE_DISPLAY_V]) ); - m_draw_timer->adjust( m_screen->time_until_pos( vpos, m_draw_time ), vpos_limit - m_frame_timing[ACTIVE_DISPLAY_V] ); + m_draw_timer->adjust( screen().time_until_pos( vpos, m_draw_time ), vpos_limit - m_frame_timing[ACTIVE_DISPLAY_V] ); return; } @@ -506,7 +506,7 @@ void sega315_5124_device::process_line_timer() if (m_line_counter == 0x00) { m_line_counter = m_reg[0x0a]; - m_hint_timer->adjust( m_screen->time_until_pos( vpos, HINT_HPOS ) ); + m_hint_timer->adjust( screen().time_until_pos( vpos, HINT_HPOS ) ); m_pending_status |= STATUS_HINT; } else @@ -515,12 +515,12 @@ void sega315_5124_device::process_line_timer() } /* Draw borders */ - m_lborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START ), vpos ); - m_rborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START + LBORDER_WIDTH + 256 ), vpos ); + m_lborder_timer->adjust( screen().time_until_pos( vpos, LBORDER_START ), vpos ); + m_rborder_timer->adjust( screen().time_until_pos( vpos, LBORDER_START + LBORDER_WIDTH + 256 ), vpos ); /* Draw active display */ select_sprites( vpos - vpos_limit ); - m_draw_timer->adjust( m_screen->time_until_pos( vpos, m_draw_time ), vpos_limit ); + m_draw_timer->adjust( screen().time_until_pos( vpos, m_draw_time ), vpos_limit ); return; } @@ -534,18 +534,18 @@ void sega315_5124_device::process_line_timer() /* Check if we're on the last line of the top border */ if (vpos == vpos_limit + m_frame_timing[TOP_BORDER] - 1) { - m_nmi_timer->adjust( m_screen->time_until_pos( vpos, NMI_HPOS ) ); + m_nmi_timer->adjust( screen().time_until_pos( vpos, NMI_HPOS ) ); } /* Draw borders */ - m_lborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START ), vpos ); - m_rborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START + LBORDER_WIDTH + 256 ), vpos ); + m_lborder_timer->adjust( screen().time_until_pos( vpos, LBORDER_START ), vpos ); + m_rborder_timer->adjust( screen().time_until_pos( vpos, LBORDER_START + LBORDER_WIDTH + 256 ), vpos ); /* Draw middle of the border */ /* We need to do this through the regular drawing function */ /* so sprite collisions can occur on the border. */ select_sprites( vpos - (vpos_limit + m_frame_timing[TOP_BORDER]) ); - m_draw_timer->adjust( m_screen->time_until_pos( vpos, m_draw_time ), vpos_limit + m_frame_timing[TOP_BORDER] ); + m_draw_timer->adjust( screen().time_until_pos( vpos, m_draw_time ), vpos_limit + m_frame_timing[TOP_BORDER] ); return; } @@ -600,7 +600,7 @@ void sega315_5124_device::check_pending_flags() } else { - hpos = m_screen->hpos(); + hpos = screen().hpos(); } if ((m_pending_status & STATUS_HINT) && hpos >= HINT_HPOS) @@ -721,11 +721,11 @@ WRITE8_MEMBER( sega315_5124_device::register_write ) break; case 1: set_display_settings(); - if (m_screen->hpos() <= DISPLAY_DISABLED_HPOS) + if (screen().hpos() <= DISPLAY_DISABLED_HPOS) m_display_disabled = !(m_reg[0x01] & 0x40); break; case 8: - if (m_screen->hpos() <= XSCROLL_HPOS) + if (screen().hpos() <= XSCROLL_HPOS) m_reg8copy = m_reg[0x08]; } @@ -1602,13 +1602,13 @@ void sega315_5124_device::device_start() m_frame_timing = (m_is_pal) ? pal_192 : ntsc_192; /* Make temp bitmap for rendering */ - m_screen->register_screen_bitmap(m_tmpbitmap); - m_screen->register_screen_bitmap(m_y1_bitmap); + screen().register_screen_bitmap(m_tmpbitmap); + screen().register_screen_bitmap(m_y1_bitmap); m_display_timer = timer_alloc(TIMER_LINE); - m_display_timer->adjust(m_screen->time_until_pos(0, DISPLAY_CB_HPOS), 0, m_screen->scan_period()); + m_display_timer->adjust(screen().time_until_pos(0, DISPLAY_CB_HPOS), 0, screen().scan_period()); m_pending_flags_timer = timer_alloc(TIMER_FLAGS); - m_pending_flags_timer->adjust(m_screen->time_until_pos(0, WIDTH - 1), 0, m_screen->scan_period()); + m_pending_flags_timer->adjust(screen().time_until_pos(0, WIDTH - 1), 0, screen().scan_period()); m_draw_timer = timer_alloc(TIMER_DRAW); m_lborder_timer = timer_alloc(TIMER_LBORDER); m_rborder_timer = timer_alloc(TIMER_RBORDER); diff --git a/src/devices/video/315_5124.h b/src/devices/video/315_5124.h index 4f2f618caed..ea0f68acb74 100644 --- a/src/devices/video/315_5124.h +++ b/src/devices/video/315_5124.h @@ -67,7 +67,7 @@ public: DECLARE_PALETTE_INIT( sega315_5124 ); - void hcount_latch() { hcount_latch_at_hpos(m_screen->hpos()); }; + void hcount_latch() { hcount_latch_at_hpos(screen().hpos()); }; void hcount_latch_at_hpos(int hpos); void stop_timers(); diff --git a/src/devices/video/315_5313.cpp b/src/devices/video/315_5313.cpp index c77939f5c1c..12737fe9192 100644 --- a/src/devices/video/315_5313.cpp +++ b/src/devices/video/315_5313.cpp @@ -1267,7 +1267,7 @@ uint16_t sega315_5313_device::get_hposition() } else { - value4 = m_screen->hpos(); + value4 = screen().hpos(); } return value4; @@ -1278,7 +1278,7 @@ int sega315_5313_device::get_scanline_counter() if (!m_use_alt_timing) return m_scanline_counter; else - return m_screen->vpos(); + return screen().vpos(); } @@ -2849,7 +2849,7 @@ void sega315_5313_device::vdp_handle_eof() visarea.set(0, scr_width - 1, 0, m_visible_scanlines - 1); - m_screen->configure(480, m_total_scanlines, visarea, m_screen->frame_period().attoseconds()); + screen().configure(480, m_total_scanlines, visarea, screen().frame_period().attoseconds()); } @@ -2875,7 +2875,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( sega315_5313_device::megadriv_scanline_timer_callb { if (param==0) { - //printf("where are we? %d %d\n", m_screen->vpos(), screen().hpos()); + //printf("where are we? %d %d\n", screen().vpos(), screen().hpos()); vdp_handle_eof(); //vdp_clear_bitmap(); } diff --git a/src/devices/video/cdp1861.cpp b/src/devices/video/cdp1861.cpp index 0b3101d8352..53d1b4fb658 100644 --- a/src/devices/video/cdp1861.cpp +++ b/src/devices/video/cdp1861.cpp @@ -69,7 +69,7 @@ void cdp1861_device::device_start() m_dma_timer = timer_alloc(TIMER_DMA); // find devices - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); // register for state saving save_item(NAME(m_disp)); @@ -85,8 +85,8 @@ void cdp1861_device::device_start() void cdp1861_device::device_reset() { - m_int_timer->adjust(m_screen->time_until_pos(SCANLINE_INT_START, 0)); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_TOP_START, 0)); + m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_START, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_START, 0)); m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_START)); m_disp = 0; @@ -105,7 +105,7 @@ void cdp1861_device::device_reset() void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - int scanline = m_screen->vpos(); + int scanline = screen().vpos(); switch (id) { @@ -117,7 +117,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para m_write_irq(ASSERT_LINE); } - m_int_timer->adjust(m_screen->time_until_pos( SCANLINE_INT_END, 0)); + m_int_timer->adjust(screen().time_until_pos( SCANLINE_INT_END, 0)); } else { @@ -126,7 +126,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para m_write_irq(CLEAR_LINE); } - m_int_timer->adjust(m_screen->time_until_pos(SCANLINE_INT_START, 0)); + m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_START, 0)); } break; @@ -135,22 +135,22 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para { case SCANLINE_EFX_TOP_START: m_write_efx(ASSERT_LINE); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_TOP_END, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_END, 0)); break; case SCANLINE_EFX_TOP_END: m_write_efx(CLEAR_LINE); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_BOTTOM_START, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_START, 0)); break; case SCANLINE_EFX_BOTTOM_START: m_write_efx(ASSERT_LINE); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_BOTTOM_END, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_END, 0)); break; case SCANLINE_EFX_BOTTOM_END: m_write_efx(CLEAR_LINE); - m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_TOP_START, 0)); + m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_START, 0)); break; } break; @@ -195,8 +195,8 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para WRITE8_MEMBER( cdp1861_device::dma_w ) { - int sx = m_screen->hpos() + 4; - int y = m_screen->vpos(); + int sx = screen().hpos() + 4; + int y = screen().vpos(); int x; for (x = 0; x < 8; x++) diff --git a/src/devices/video/cdp1862.cpp b/src/devices/video/cdp1862.cpp index 498bb4a8584..78985db211c 100644 --- a/src/devices/video/cdp1862.cpp +++ b/src/devices/video/cdp1862.cpp @@ -100,7 +100,7 @@ void cdp1862_device::device_start() m_read_gd.resolve_safe(0); // find devices - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); // init palette initialize_palette(); @@ -129,8 +129,8 @@ void cdp1862_device::device_reset() WRITE8_MEMBER( cdp1862_device::dma_w ) { int rd = 1, bd = 1, gd = 1; - int sx = m_screen->hpos() + 4; - int y = m_screen->vpos(); + int sx = screen().hpos() + 4; + int y = screen().vpos(); int x; if (!m_con) diff --git a/src/devices/video/crt9007.cpp b/src/devices/video/crt9007.cpp index 9eba3705e4f..5d85a58df6f 100644 --- a/src/devices/video/crt9007.cpp +++ b/src/devices/video/crt9007.cpp @@ -269,8 +269,8 @@ inline void crt9007_device::trigger_interrupt(int line) inline void crt9007_device::update_cblank_line() { - int x = m_screen->hpos(); - int y = m_screen->vpos(); + int x = screen().hpos(); + int y = screen().vpos(); // composite blank int cblank = !(m_hs & m_vs); @@ -292,12 +292,12 @@ inline void crt9007_device::update_cblank_line() inline void crt9007_device::update_hsync_timer(int state) { - int y = m_screen->vpos(); + int y = screen().vpos(); int next_x = state ? m_hsync_start : m_hsync_end; int next_y = state ? (y + 1) % SCAN_LINES_PER_FRAME : y; - attotime duration = m_screen->time_until_pos(next_y, next_x); + attotime duration = screen().time_until_pos(next_y, next_x); m_hsync_timer->adjust(duration, !state); } @@ -311,7 +311,7 @@ inline void crt9007_device::update_vsync_timer(int state) { int next_y = state ? m_vsync_start : m_vsync_end; - attotime duration = m_screen->time_until_pos(next_y, 0); + attotime duration = screen().time_until_pos(next_y, 0); m_vsync_timer->adjust(duration, !state); } @@ -324,12 +324,12 @@ inline void crt9007_device::update_vsync_timer(int state) inline void crt9007_device::update_vlt_timer(int state) { // this signal is active during all visible scan lines and during the horizontal trace at vertical retrace - int y = m_screen->vpos(); + int y = screen().vpos(); int next_x = state ? m_vlt_end : m_vlt_start; int next_y = state ? y : ((y == m_vlt_bottom) ? 0 : (y + 1)); - attotime duration = m_screen->time_until_pos(next_y, next_x); + attotime duration = screen().time_until_pos(next_y, next_x); m_vlt_timer->adjust(duration, !state); } @@ -354,7 +354,7 @@ inline void crt9007_device::update_drb_timer(int state) { // this signal is active for 1 full scan line (VLT edge to edge) at the top scan line of each new row // there is 1 extra DRB signal during the 1st scanline of the vertical retrace interval - int y = m_screen->vpos(); + int y = screen().vpos(); int next_x = m_vlt_end; int next_y = y ? y + 1 : y; @@ -376,7 +376,7 @@ inline void crt9007_device::update_drb_timer(int state) } } - attotime duration = m_screen->time_until_pos(next_y, next_x); + attotime duration = screen().time_until_pos(next_y, next_x); m_drb_timer->adjust(duration, !state); } @@ -432,12 +432,12 @@ inline void crt9007_device::recompute_parameters() //LOG("CRT9007 Screen: %u x %u @ %f Hz\n", horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh)); //LOG("CRT9007 Visible Area: (%u, %u) - (%u, %u)\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y); - //m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh); + //screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh); - m_hsync_timer->adjust(m_screen->time_until_pos(0, 0)); - m_vsync_timer->adjust(m_screen->time_until_pos(0, 0)); - m_vlt_timer->adjust(m_screen->time_until_pos(0, m_vlt_start), 1); - m_drb_timer->adjust(m_screen->time_until_pos(0, 0)); + m_hsync_timer->adjust(screen().time_until_pos(0, 0)); + m_vsync_timer->adjust(screen().time_until_pos(0, 0)); + m_vlt_timer->adjust(screen().time_until_pos(0, m_vlt_start), 1); + m_drb_timer->adjust(screen().time_until_pos(0, 0)); } @@ -563,8 +563,8 @@ void crt9007_device::device_clock_changed() void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - int x = m_screen->hpos(); - int y = m_screen->vpos(); + int x = screen().hpos(); + int y = screen().vpos(); switch (id) { diff --git a/src/devices/video/crt9021.cpp b/src/devices/video/crt9021.cpp index 5b4d7195cde..a0dabe4d1c3 100644 --- a/src/devices/video/crt9021.cpp +++ b/src/devices/video/crt9021.cpp @@ -95,7 +95,7 @@ crt9021_device::crt9021_device(const machine_config &mconfig, const char *tag, d void crt9021_device::device_start() { // register bitmap - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); // state saving save_item(NAME(m_data)); @@ -159,7 +159,7 @@ WRITE_LINE_MEMBER( crt9021_device::ld_sh_w ) // TODO } - m_display_cb(m_bitmap, m_screen->vpos(), m_screen->hpos(), m_sr, m_intout); + m_display_cb(m_bitmap, screen().vpos(), screen().hpos(), m_sr, m_intout); } } diff --git a/src/devices/video/crtc_ega.cpp b/src/devices/video/crtc_ega.cpp index b7318d33f99..01ee629ad43 100644 --- a/src/devices/video/crtc_ega.cpp +++ b/src/devices/video/crtc_ega.cpp @@ -201,8 +201,8 @@ void crtc_ega_device::recompute_parameters(bool postload) LOG("CRTC_EGA config screen: HTOTAL: 0x%x VTOTAL: 0x%x MAX_X: 0x%x MAX_Y: 0x%x HSYNC: 0x%x-0x%x VSYNC: 0x%x-0x%x Freq: %ffps\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1, 1 / ATTOSECONDS_TO_DOUBLE(refresh)); - if ( m_screen != nullptr ) - m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh); + if (has_screen()) + screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh); m_has_valid_parameters = true; } @@ -355,8 +355,8 @@ void crtc_ega_device::handle_line_timer() /* also update the cursor state now */ update_cursor_state(); - if (m_screen != nullptr) - m_screen->reset_origin(); + if (has_screen()) + screen().reset_origin(); } if ( m_line_enable_ff ) diff --git a/src/devices/video/ef9340_1.cpp b/src/devices/video/ef9340_1.cpp index 54c6f651dac..98aa0741c11 100644 --- a/src/devices/video/ef9340_1.cpp +++ b/src/devices/video/ef9340_1.cpp @@ -39,10 +39,10 @@ ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, void ef9340_1_device::device_start() { // Let the screen create our temporary bitmap with the screen's dimensions - m_screen->register_screen_bitmap(m_tmp_bitmap); + screen().register_screen_bitmap(m_tmp_bitmap); m_line_timer = timer_alloc(TIMER_LINE); - m_line_timer->adjust( m_screen->time_until_pos(0, 0), 0, m_screen->scan_period() ); + m_line_timer->adjust( screen().time_until_pos(0, 0), 0, screen().scan_period() ); // register our state save_item(NAME(m_ef9341.TA)); @@ -81,7 +81,7 @@ void ef9340_1_device::device_timer(emu_timer &timer, device_timer_id id, int par switch ( id ) { case TIMER_LINE: - ef9340_scanline(m_screen->vpos()); + ef9340_scanline(screen().vpos()); break; } } diff --git a/src/devices/video/ef9345.cpp b/src/devices/video/ef9345.cpp index 66adfdfb12d..f3f867d6b1f 100644 --- a/src/devices/video/ef9345.cpp +++ b/src/devices/video/ef9345.cpp @@ -145,7 +145,7 @@ void ef9345_device::device_start() m_videoram = &space(0); - m_screen_out.allocate(496, m_screen->height()); + m_screen_out.allocate(496, screen().height()); m_blink_timer->adjust(attotime::from_msec(500), 0, attotime::from_msec(500)); @@ -228,8 +228,8 @@ void ef9345_device::set_busy_flag(int period) void ef9345_device::draw_char_40(uint8_t *c, uint16_t x, uint16_t y) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const int scan_xsize = std::min( m_screen->width() - (x * 8), 8); - const int scan_ysize = std::min( m_screen->height() - (y * 10), 10); + const int scan_xsize = std::min( screen().width() - (x * 8), 8); + const int scan_ysize = std::min( screen().height() - (y * 10), 10); for(int i = 0; i < scan_ysize; i++) for(int j = 0; j < scan_xsize; j++) @@ -240,8 +240,8 @@ void ef9345_device::draw_char_40(uint8_t *c, uint16_t x, uint16_t y) void ef9345_device::draw_char_80(uint8_t *c, uint16_t x, uint16_t y) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const int scan_xsize = std::min( m_screen->width() - (x * 6), 6); - const int scan_ysize = std::min( m_screen->height() - (y * 10), 10); + const int scan_xsize = std::min( screen().width() - (x * 6), 6); + const int scan_ysize = std::min( screen().height() - (y * 10), 10); for(int i = 0; i < scan_ysize; i++) for(int j = 0; j < scan_xsize; j++) @@ -265,12 +265,12 @@ void ef9345_device::set_video_mode(void) uint16_t new_width = (m_char_mode == MODE12x80 || m_char_mode == MODE8x80) ? 492 : 336; - if (m_screen->width() != new_width) + if (screen().width() != new_width) { - rectangle visarea = m_screen->visible_area(); + rectangle visarea = screen().visible_area(); visarea.max_x = new_width - 1; - m_screen->configure(new_width, m_screen->height(), visarea, m_screen->frame_period().attoseconds()); + screen().configure(new_width, screen().height(), visarea, screen().frame_period().attoseconds()); } //border color diff --git a/src/devices/video/ef9364.cpp b/src/devices/video/ef9364.cpp index 0bbde3e72d7..bd9d5003448 100644 --- a/src/devices/video/ef9364.cpp +++ b/src/devices/video/ef9364.cpp @@ -128,7 +128,7 @@ void ef9364_device::device_start() palette[0] = rgb_t(0, 0, 0); palette[1] = rgb_t(255, 255, 255); - m_screen_out.allocate( bitplane_xres, m_screen->height() ); + m_screen_out.allocate( bitplane_xres, screen().height() ); cursor_cnt = 0; cursor_state = 0; @@ -171,12 +171,12 @@ void ef9364_device::set_video_mode(void) { uint16_t new_width = bitplane_xres; - if (m_screen->width() != new_width) + if (screen().width() != new_width) { - rectangle visarea = m_screen->visible_area(); + rectangle visarea = screen().visible_area(); visarea.max_x = new_width - 1; - m_screen->configure(new_width, m_screen->height(), visarea, m_screen->frame_period().attoseconds()); + screen().configure(new_width, screen().height(), visarea, screen().frame_period().attoseconds()); } //border color diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp index d2ccde9205c..350305ed042 100644 --- a/src/devices/video/ef9365.cpp +++ b/src/devices/video/ef9365.cpp @@ -338,7 +338,7 @@ void ef9365_device::device_start() palette[i] = rgb_t(255, 255, 255); } - m_screen_out.allocate( bitplane_xres, m_screen->height() ); + m_screen_out.allocate( bitplane_xres, screen().height() ); save_item(NAME(m_border)); save_item(NAME(m_registers)); @@ -472,12 +472,12 @@ void ef9365_device::set_video_mode(void) { uint16_t new_width = bitplane_xres; - if (m_screen->width() != new_width) + if (screen().width() != new_width) { - rectangle visarea = m_screen->visible_area(); + rectangle visarea = screen().visible_area(); visarea.max_x = new_width - 1; - m_screen->configure(new_width, m_screen->height(), visarea, m_screen->frame_period().attoseconds()); + screen().configure(new_width, screen().height(), visarea, screen().frame_period().attoseconds()); } //border color diff --git a/src/devices/video/gb_lcd.cpp b/src/devices/video/gb_lcd.cpp index 769ac63030c..1ac18932086 100644 --- a/src/devices/video/gb_lcd.cpp +++ b/src/devices/video/gb_lcd.cpp @@ -359,7 +359,7 @@ cgb_ppu_device::cgb_ppu_device(const machine_config &mconfig, const char *tag, d void dmg_ppu_device::common_start() { - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); save_item(NAME(m_bitmap)); m_oam = make_unique_clear(m_oam_size); m_vram = make_unique_clear(m_vram_size); @@ -1268,7 +1268,7 @@ void dmg_ppu_device::update_scanline(uint32_t cycles_to_go) { if (m_current_line < 144) { - const rectangle &r = m_screen->visible_area(); + const rectangle &r = screen().visible_area(); rectangle r1(r.min_x, r.max_x, m_current_line, m_current_line); m_bitmap.fill(0, r1); } @@ -1889,7 +1889,7 @@ void cgb_ppu_device::update_scanline(uint32_t cycles_to_go) { if (m_current_line < 144) { - const rectangle &r1 = m_screen->visible_area(); + const rectangle &r1 = screen().visible_area(); rectangle r(r1.min_x, r1.max_x, m_current_line, m_current_line); m_bitmap.fill((!m_gbc_mode) ? 0 : 32767 , r); } diff --git a/src/devices/video/gba_lcd.cpp b/src/devices/video/gba_lcd.cpp index ba63bca0008..53b2bca2124 100644 --- a/src/devices/video/gba_lcd.cpp +++ b/src/devices/video/gba_lcd.cpp @@ -1763,7 +1763,7 @@ void gba_lcd_device::device_start() m_vram = make_unique_clear(0x18000 / 4); m_oam = make_unique_clear(0x400 / 4); - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); /* create a timer to fire scanline functions */ m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_lcd_device::perform_scan),this)); diff --git a/src/devices/video/hd61830.cpp b/src/devices/video/hd61830.cpp index 52fc9c4164b..11c10f3b93b 100644 --- a/src/devices/video/hd61830.cpp +++ b/src/devices/video/hd61830.cpp @@ -450,7 +450,7 @@ void hd61830_device::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, pixel = m_cursor ? 1 : 0; } - if (sy < m_screen->height() && sx < m_screen->width()) + if (sy < screen().height() && sx < screen().width()) bitmap.pix16(sy, sx) = pixel; } } diff --git a/src/devices/video/hd63484.cpp b/src/devices/video/hd63484.cpp index 0b383bd927b..189eaa89367 100644 --- a/src/devices/video/hd63484.cpp +++ b/src/devices/video/hd63484.cpp @@ -528,10 +528,10 @@ inline void hd63484_device::recompute_parameters() if (BIT(m_dcr, 13)) vbstart += m_sp[0]; if (BIT(m_dcr, 11)) vbstart += m_sp[2]; - rectangle visarea = m_screen->visible_area(); + rectangle visarea = screen().visible_area(); visarea.set((m_hsw + m_hds) * ppmc, (m_hsw + m_hds + m_hdw) * ppmc - 1, m_vds, vbstart - 1); - attoseconds_t frame_period = m_screen->frame_period().attoseconds(); // TODO: use clock() to calculate the frame_period - m_screen->configure(m_hc * ppmc, m_vc, visarea, frame_period); + attoseconds_t frame_period = screen().frame_period().attoseconds(); // TODO: use clock() to calculate the frame_period + screen().configure(m_hc * ppmc, m_vc, visarea, frame_period); } @@ -1785,7 +1785,7 @@ uint16_t hd63484_device::video_registers_r(int offset) break; case 0x80: - res = m_screen->vpos() & 0xfff; // Raster Count + res = screen().vpos() & 0xfff; // Raster Count break; default: diff --git a/src/devices/video/hp1ll3.cpp b/src/devices/video/hp1ll3.cpp index 21b6a2b4550..ada8f48404d 100644 --- a/src/devices/video/hp1ll3.cpp +++ b/src/devices/video/hp1ll3.cpp @@ -508,7 +508,7 @@ READ8_MEMBER( hp1ll3_device::read ) case 0: data = m_busy ? 1 : 0; data |= 2; - data |= (m_screen->vblank() ? 8 : 0); + data |= (screen().vblank() ? 8 : 0); break; case 2: diff --git a/src/devices/video/huc6260.cpp b/src/devices/video/huc6260.cpp index ec99e8417eb..ee2943896dd 100644 --- a/src/devices/video/huc6260.cpp +++ b/src/devices/video/huc6260.cpp @@ -66,8 +66,8 @@ huc6260_device::huc6260_device(const machine_config &mconfig, const char *tag, d void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - int vpos = m_screen->vpos(); - int hpos = m_screen->hpos(); + int vpos = screen().vpos(); + int hpos = screen().hpos(); int h = m_last_h; int v = m_last_v; uint16_t *bitmap_line = &m_bmp->pix16(v); @@ -177,7 +177,7 @@ void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int para } } - m_timer->adjust( m_screen->time_until_pos( v, h ) ); + m_timer->adjust( screen().time_until_pos( v, h ) ); } @@ -294,9 +294,9 @@ void huc6260_device::device_reset() m_pixel_clock = 0; memset(m_palette, 0x00, sizeof(m_palette)); - m_last_v = m_screen->vpos(); - m_last_h = m_screen->hpos(); - m_timer->adjust( m_screen->time_until_pos( ( m_screen->vpos() + 1 ) % 263, 0 ) ); + m_last_v = screen().vpos(); + m_last_h = screen().hpos(); + m_timer->adjust( screen().time_until_pos( ( screen().vpos() + 1 ) % 263, 0 ) ); } //------------------------------------------------- diff --git a/src/devices/video/huc6261.cpp b/src/devices/video/huc6261.cpp index 9029b57d54f..90c7a7884da 100644 --- a/src/devices/video/huc6261.cpp +++ b/src/devices/video/huc6261.cpp @@ -95,8 +95,8 @@ void huc6261_device::apply_pal_offs(uint16_t *pix_data) void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - int vpos = m_screen->vpos(); - int hpos = m_screen->hpos(); + int vpos = screen().vpos(); + int hpos = screen().hpos(); int h = m_last_h; int v = m_last_v; uint32_t *bitmap_line = &m_bmp->pix32(v); @@ -219,7 +219,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para } } - m_timer->adjust( m_screen->time_until_pos( v, h ) ); + m_timer->adjust( screen().time_until_pos( v, h ) ); } @@ -238,8 +238,8 @@ READ16_MEMBER( huc6261_device::read ) /* Status info */ case 0x00: { - uint16_t vpos = m_screen->vpos(); - uint16_t hpos = m_screen->hpos(); + uint16_t vpos = screen().vpos(); + uint16_t hpos = screen().hpos(); data = ( vpos << 5 ) | ( m_register & 0x1F); @@ -455,7 +455,7 @@ void huc6261_device::device_reset() memset(m_palette, 0, sizeof(m_palette)); - m_last_v = m_screen->vpos(); - m_last_h = m_screen->hpos(); - m_timer->adjust( m_screen->time_until_pos( ( m_screen->vpos() + 1 ) % 263, 0 ) ); + m_last_v = screen().vpos(); + m_last_h = screen().hpos(); + m_timer->adjust( screen().time_until_pos( ( screen().vpos() + 1 ) % 263, 0 ) ); } diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp index 8ca44d172a2..de90b4f4937 100644 --- a/src/devices/video/i8244.cpp +++ b/src/devices/video/i8244.cpp @@ -136,13 +136,13 @@ i8245_device::i8245_device(const machine_config &mconfig, const char *tag, devic void i8244_device::device_start() { // Let the screen create our temporary bitmap with the screen's dimensions - m_screen->register_screen_bitmap(m_tmp_bitmap); + screen().register_screen_bitmap(m_tmp_bitmap); m_line_timer = timer_alloc(TIMER_LINE); - m_line_timer->adjust( m_screen->time_until_pos(1, START_ACTIVE_SCAN ), 0, m_screen->scan_period() ); + m_line_timer->adjust( screen().time_until_pos(1, START_ACTIVE_SCAN ), 0, screen().scan_period() ); m_hblank_timer = timer_alloc(TIMER_HBLANK); - m_hblank_timer->adjust( m_screen->time_until_pos(1, END_ACTIVE_SCAN + 18 ), 0, m_screen->scan_period() ); + m_hblank_timer->adjust( screen().time_until_pos(1, END_ACTIVE_SCAN + 18 ), 0, screen().scan_period() ); m_irq_func.resolve_safe(); m_postprocess_func.resolve_safe(); @@ -209,7 +209,7 @@ PALETTE_INIT_MEMBER(i8244_device, i8244) void i8244_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - int vpos = m_screen->vpos(); + int vpos = screen().vpos(); switch ( id ) { @@ -236,10 +236,10 @@ void i8244_device::device_timer(emu_timer &timer, device_timer_id id, int param, int i8244_device::get_y_beam() { - int y = m_screen->vpos() - m_start_vpos; + int y = screen().vpos() - m_start_vpos; // The Y register becomes 0 only when the VBlank signal is turned off! - if ( y < 0 || ( y == 0 && m_screen->hpos() < 366+42 ) ) + if ( y < 0 || ( y == 0 && screen().hpos() < 366+42 ) ) { y += m_screen_lines; } @@ -250,7 +250,7 @@ int i8244_device::get_y_beam() int i8244_device::get_x_beam() { - int x = m_screen->hpos() - START_ACTIVE_SCAN; + int x = screen().hpos() - START_ACTIVE_SCAN; if ( x < 0 ) { @@ -356,7 +356,7 @@ WRITE8_MEMBER(i8244_device::write) READ_LINE_MEMBER(i8244_device::vblank) { - if ( m_screen->vpos() > m_start_vpos && m_screen->vpos() < m_start_vblank ) + if ( screen().vpos() > m_start_vpos && screen().vpos() < m_start_vblank ) { return 0; } @@ -366,8 +366,8 @@ READ_LINE_MEMBER(i8244_device::vblank) READ_LINE_MEMBER(i8244_device::hblank) { - int hpos = m_screen->hpos(); - int vpos = m_screen->vpos(); + int hpos = screen().hpos(); + int vpos = screen().vpos(); if ( hpos >= START_ACTIVE_SCAN && hpos < END_ACTIVE_SCAN ) { diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h index a67652fd1e4..543712883e3 100644 --- a/src/devices/video/i8244.h +++ b/src/devices/video/i8244.h @@ -50,7 +50,6 @@ public: i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // static configuration helpers - static void set_screen_tag(device_t &device, const char *screen_tag) { downcast(device).m_screen_tag = screen_tag; } template static devcb_base &set_irq_cb(device_t &device, Object &&cb) { return downcast(device).m_irq_func.set_callback(std::forward(cb)); } template static devcb_base &set_postprocess_cb(device_t &device, Object &&cb) { return downcast(device).m_postprocess_func.set_callback(std::forward(cb)); } diff --git a/src/devices/video/i82730.cpp b/src/devices/video/i82730.cpp index c9a3aee6744..c43e02555a7 100644 --- a/src/devices/video/i82730.cpp +++ b/src/devices/video/i82730.cpp @@ -89,7 +89,7 @@ void i82730_device::set_cpu_tag(device_t &device, device_t *owner, const char *t void i82730_device::device_start() { // register bitmap - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); // resolve callbacks m_sint_handler.resolve_safe(); @@ -224,13 +224,13 @@ void i82730_device::mode_set() // setup screen mode rectangle visarea(hbrdstrt * 16, hbrdstp * 16 - 1, m_vsyncstp, m_vfldstp + m_margin + 1 + m_lpr - 1); attoseconds_t period = HZ_TO_ATTOSECONDS(clock() * 16) * line_length * 16 * frame_length; - m_screen->configure(line_length * 16, frame_length, visarea, period); + screen().configure(line_length * 16, frame_length, visarea, period); // start display is now valid m_mode_set = true; // adjust timer for the new mode - m_row_timer->adjust(m_screen->time_until_pos(0)); + m_row_timer->adjust(screen().time_until_pos(0)); // output some debug info if (VERBOSE) @@ -394,7 +394,7 @@ void i82730_device::load_row() TIMER_CALLBACK_MEMBER( i82730_device::row_update ) { - int y = m_screen->vpos(); + int y = screen().vpos(); if (y == 0) { @@ -454,7 +454,7 @@ TIMER_CALLBACK_MEMBER( i82730_device::row_update ) // todo: check ca // frame interrupt? - if ((m_screen->frame_number() % m_frame_int_count) == 0) + if ((screen().frame_number() % m_frame_int_count) == 0) m_status |= EONF; // check interrupts @@ -465,7 +465,7 @@ TIMER_CALLBACK_MEMBER( i82730_device::row_update ) // vblank } - m_row_timer->adjust(m_screen->time_until_pos((y + 1) % m_screen->height())); + m_row_timer->adjust(screen().time_until_pos((y + 1) % screen().height())); } WRITE_LINE_MEMBER( i82730_device::ca_w ) diff --git a/src/devices/video/i8275.cpp b/src/devices/video/i8275.cpp index ee146c92519..c962768e17f 100644 --- a/src/devices/video/i8275.cpp +++ b/src/devices/video/i8275.cpp @@ -133,7 +133,7 @@ i8275_device::i8275_device(const machine_config &mconfig, const char *tag, devic void i8275_device::device_start() { // get the screen device - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); // resolve callbacks m_display_cb.bind_relative_to(*owner()); @@ -197,8 +197,8 @@ void i8275_device::device_reset() void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - //int y = m_screen->vpos(); - //int x = m_screen->hpos(); + //int y = screen().vpos(); + //int x = screen().hpos(); int rc = m_scanline / SCANLINES_PER_ROW; int lc = m_scanline % SCANLINES_PER_ROW; @@ -566,7 +566,7 @@ WRITE8_MEMBER( i8275_device::write ) WRITE8_MEMBER( i8275_device::dack_w ) { - //LOG("I8275 y %u x %u DACK %04x:%02x %u\n", m_screen->vpos(), m_screen->hpos(), offset, data, m_buffer_idx); + //LOG("I8275 y %u x %u DACK %04x:%02x %u\n", screen().vpos(), screen().hpos(), offset, data, m_buffer_idx); m_write_drq(0); @@ -631,8 +631,8 @@ WRITE_LINE_MEMBER( i8275_device::lpen_w ) { if (!m_lpen && state) { - m_param[REG_LPEN_COL] = m_screen->hpos() / m_hpixels_per_column; - m_param[REG_LPEN_ROW] = m_screen->vpos() / SCANLINES_PER_ROW; + m_param[REG_LPEN_COL] = screen().hpos() / m_hpixels_per_column; + m_param[REG_LPEN_ROW] = screen().vpos() / SCANLINES_PER_ROW; m_status |= ST_LP; } @@ -664,11 +664,11 @@ uint32_t i8275_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap void i8275_device::recompute_parameters() { - int y = m_screen->vpos(); + int y = screen().vpos(); int horiz_pix_total = (CHARACTERS_PER_ROW + HRTC_COUNT) * m_hpixels_per_column; int vert_pix_total = (CHARACTER_ROWS_PER_FRAME + VRTC_ROW_COUNT) * SCANLINES_PER_ROW; - attoseconds_t refresh = m_screen->frame_period().attoseconds(); + attoseconds_t refresh = screen().frame_period().attoseconds(); int max_visible_x = (CHARACTERS_PER_ROW * m_hpixels_per_column) - 1; int max_visible_y = (CHARACTER_ROWS_PER_FRAME * SCANLINES_PER_ROW) - 1; @@ -676,10 +676,10 @@ void i8275_device::recompute_parameters() rectangle visarea; visarea.set(0, max_visible_x, 0, max_visible_y); - m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh); + screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh); int hrtc_on_pos = CHARACTERS_PER_ROW * m_hpixels_per_column; - m_hrtc_on_timer->adjust(m_screen->time_until_pos(y, hrtc_on_pos), 0, m_screen->scan_period()); + m_hrtc_on_timer->adjust(screen().time_until_pos(y, hrtc_on_pos), 0, screen().scan_period()); m_irq_scanline = (CHARACTER_ROWS_PER_FRAME - 1) * SCANLINES_PER_ROW; m_vrtc_scanline = CHARACTER_ROWS_PER_FRAME * SCANLINES_PER_ROW; @@ -687,7 +687,7 @@ void i8275_device::recompute_parameters() LOG("irq_y %u vrtc_y %u drq_y %u\n", m_irq_scanline, m_vrtc_scanline, m_vrtc_drq_scanline); - m_scanline_timer->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->scan_period()); + m_scanline_timer->adjust(screen().time_until_pos(0, 0), 0, screen().scan_period()); if (DOUBLE_SPACED_ROWS) fatalerror("Double spaced rows not supported!"); } diff --git a/src/devices/video/imagetek_i4100.cpp b/src/devices/video/imagetek_i4100.cpp index e3ac0953526..40774f7c9ba 100644 --- a/src/devices/video/imagetek_i4100.cpp +++ b/src/devices/video/imagetek_i4100.cpp @@ -1069,7 +1069,7 @@ void imagetek_i4100_device::draw_tilemap( screen_device &screen, bitmap_ind16 &b { int y; - bitmap_ind8 &priority_bitmap = m_screen->priority(); + bitmap_ind8 &priority_bitmap = screen.priority(); int width = big ? 4096 : 2048; int height = big ? 4096 : 2048; diff --git a/src/devices/video/m50458.cpp b/src/devices/video/m50458.cpp index 0b756fbbb47..48128ecb095 100644 --- a/src/devices/video/m50458.cpp +++ b/src/devices/video/m50458.cpp @@ -370,7 +370,7 @@ uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma pix |= ((m_shadow_gfx[offset+0] >> (7-(xi & 0x7))) & 1); /* blinking, VERY preliminary */ - if(tile & 0x800 && m_screen->frame_number() & m_blink) + if(tile & 0x800 && screen.frame_number() & m_blink) pix = 0; if(yi == 17 && tile & 0x1000) /* underline? */ diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp index 9b265bc34cb..909f068f687 100644 --- a/src/devices/video/mc6845.cpp +++ b/src/devices/video/mc6845.cpp @@ -583,8 +583,8 @@ void mc6845_device::recompute_parameters(bool postload) LOG("M6845 config screen: HTOTAL: %d VTOTAL: %d MAX_X: %d MAX_Y: %d HSYNC: %d-%d VSYNC: %d-%d Freq: %ffps\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1, 1 / ATTOSECONDS_TO_DOUBLE(refresh)); - if ( m_screen != nullptr ) - m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh); + if (has_screen()) + screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh); if(!m_reconfigure_cb.isnull()) m_reconfigure_cb(horiz_pix_total, vert_pix_total, visarea, refresh); @@ -754,8 +754,8 @@ void mc6845_device::handle_line_timer() /* also update the cursor state now */ update_cursor_state(); - if (m_screen != nullptr) - m_screen->reset_origin(); + if (has_screen()) + screen().reset_origin(); } else { diff --git a/src/devices/video/mos6566.cpp b/src/devices/video/mos6566.cpp index ab5a4b360e5..e2d2101ccc9 100644 --- a/src/devices/video/mos6566.cpp +++ b/src/devices/video/mos6566.cpp @@ -654,7 +654,7 @@ void mos6566_device::device_start() m_write_aec.resolve_safe(); m_write_k.resolve_safe(); - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); for (int i = 0; i < 256; i++) { diff --git a/src/devices/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp index ae0d0618af4..2b4aedd0940 100644 --- a/src/devices/video/ppu2c0x.cpp +++ b/src/devices/video/ppu2c0x.cpp @@ -230,7 +230,7 @@ void ppu2c0x_device::device_start() m_scanline_timer = timer_alloc(TIMER_SCANLINE); /* initialize the scanline handling portion */ - m_scanline_timer->adjust(m_screen->time_until_pos(1)); + m_scanline_timer->adjust(screen().time_until_pos(1)); m_hblank_timer->adjust(m_cpu->cycles_to_attotime(86.67)); // ??? FIXME - hardcoding NTSC, need better calculation m_nmi_timer->adjust(attotime::never); @@ -522,7 +522,7 @@ void ppu2c0x_device::device_timer(emu_timer &timer, device_timer_id id, int para /* increment our scanline count */ m_scanline++; - // logerror("starting scanline %d (MAME %d, beam %d)\n", m_scanline, device->m_screen->vpos(), device->m_screen->hpos()); + // logerror("starting scanline %d (MAME %d, beam %d)\n", m_scanline, device->screen().vpos(), device->screen().hpos()); /* Note: this is called at the _end_ of each scanline */ if (m_scanline == m_vblank_first_scanline) @@ -569,7 +569,7 @@ void ppu2c0x_device::device_timer(emu_timer &timer, device_timer_id id, int para m_hblank_timer->adjust(m_cpu->cycles_to_attotime(86.67)); // ??? FIXME - hardcoding NTSC, need better calculation // trigger again at the start of the next scanline - m_scanline_timer->adjust(m_screen->time_until_pos(next_scanline * m_scan_scale)); + m_scanline_timer->adjust(screen().time_until_pos(next_scanline * m_scan_scale)); break; } } @@ -1191,7 +1191,7 @@ WRITE8_MEMBER( ppu2c0x_device::write ) #ifdef MAME_DEBUG if (m_scanline <= BOTTOM_VISIBLE_SCANLINE) { - logerror("PPU register %d write %02x during non-vblank scanline %d (MAME %d, beam pos: %d)\n", offset, data, m_scanline, m_screen->vpos(), m_screen->hpos()); + logerror("PPU register %d write %02x during non-vblank scanline %d (MAME %d, beam pos: %d)\n", offset, data, m_scanline, screen().vpos(), screen().hpos()); } #endif diff --git a/src/devices/video/psx.cpp b/src/devices/video/psx.cpp index caf81205b35..33e633c61d7 100644 --- a/src/devices/video/psx.cpp +++ b/src/devices/video/psx.cpp @@ -120,8 +120,8 @@ static inline void ATTR_PRINTF(3,4) verboselog( device_t& device, int n_level, c void psxgpu_device::DebugMeshInit() { - int width = m_screen->width(); - int height = m_screen->height(); + int width = screen().width(); + int height = screen().height(); m_debug.b_mesh = 0; m_debug.b_texture = 0; @@ -136,8 +136,8 @@ void psxgpu_device::DebugMesh( int n_coordx, int n_coordy ) { int n_coord; int n_colour; - int width = m_screen->width(); - int height = m_screen->height(); + int width = screen().width(); + int height = screen().height(); n_coordx += m_n_displaystartx; n_coordy += n_displaystarty; @@ -334,8 +334,8 @@ int psxgpu_device::DebugTextureDisplay( bitmap_ind16 &bitmap ) if( m_debug.b_texture ) { - int width = m_screen->width(); - int height = m_screen->height(); + int width = screen().width(); + int height = screen().height(); for( n_y = 0; n_y < height; n_y++ ) { @@ -363,7 +363,7 @@ int psxgpu_device::DebugTextureDisplay( bitmap_ind16 &bitmap ) } p_n_interleave[ n_x ] = p_p_vram[ n_yi ][ n_xi ]; } - draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, m_screen->palette().pens() ); + draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, screen().palette().pens() ); } } return m_debug.b_texture; diff --git a/src/devices/video/scn2674.cpp b/src/devices/video/scn2674.cpp index 09eba285b3a..7a74bf19ad1 100644 --- a/src/devices/video/scn2674.cpp +++ b/src/devices/video/scn2674.cpp @@ -66,7 +66,7 @@ void scn2674_device::device_start() m_display_cb.bind_relative_to(*owner()); m_intr_cb.resolve_safe(); m_scanline_timer = timer_alloc(TIMER_SCANLINE); - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); save_item(NAME(m_address)); save_item(NAME(m_linecounter)); @@ -604,7 +604,7 @@ WRITE8_MEMBER( scn2674_device::write ) case 2: m_screen1_l = data; - if(!m_screen->vblank()) + if(!screen().vblank()) m_start1change = (m_linecounter / m_IR0_scanline_per_char_row) + 1; break; case 3: @@ -616,7 +616,7 @@ WRITE8_MEMBER( scn2674_device::write ) m_screen1_h &= 0x3f; LOG("IR14 - Double 1 overridden %02x\n",m_IR14_double_1); } - if(!m_screen->vblank()) + if(!screen().vblank()) m_start1change = (m_linecounter / m_IR0_scanline_per_char_row) + 1; break; @@ -636,7 +636,7 @@ void scn2674_device::recompute_parameters() m_hpixels_per_column = m_gfx_enabled ? m_gfx_hpixels_per_column : m_text_hpixels_per_column; int horiz_pix_total = ((m_IR1_equalizing_constant + (m_IR2_horz_sync_width << 1)) << 1) * m_hpixels_per_column; int vert_pix_total = m_IR4_rows_per_screen * m_IR0_scanline_per_char_row + m_IR3_vert_front_porch + m_IR3_vert_back_porch + m_IR7_vsync_width; - attoseconds_t refresh = m_screen->frame_period().attoseconds(); + attoseconds_t refresh = screen().frame_period().attoseconds(); int max_visible_x = (m_IR5_character_per_row * m_hpixels_per_column) - 1; int max_visible_y = (m_IR4_rows_per_screen * m_IR0_scanline_per_char_row) - 1; @@ -650,9 +650,9 @@ void scn2674_device::recompute_parameters() rectangle visarea; visarea.set(0, max_visible_x, 0, max_visible_y); - m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh); + screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh); - m_scanline_timer->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->scan_period()); + m_scanline_timer->adjust(screen().time_until_pos(0, 0), 0, screen().scan_period()); } void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) @@ -671,7 +671,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para m_linecounter++; - if(m_linecounter >= m_screen->height()) + if(m_linecounter >= screen().height()) { m_linecounter = 0; m_address = (m_screen1_h << 8) | m_screen1_l; @@ -792,7 +792,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para dw != 0, m_gfx_enabled != 0, charrow == m_IR7_cursor_underline_position, - m_IR7_cursor_blink && (m_screen->frame_number() & (m_IR7_cursor_rate_divisor ? 0x40 : 0x20))); + m_IR7_cursor_blink && (screen().frame_number() & (m_IR7_cursor_rate_divisor ? 0x40 : 0x20))); address = (address + 1) & 0xffff; if(address > ((m_IR9_display_buffer_last_address << 10) | 0x3ff)) diff --git a/src/devices/video/snes_ppu.cpp b/src/devices/video/snes_ppu.cpp index 49ee17c94b4..76bc3d54cd3 100644 --- a/src/devices/video/snes_ppu.cpp +++ b/src/devices/video/snes_ppu.cpp @@ -378,7 +378,7 @@ void snes_ppu_device::device_reset() m_beam.current_vert = 0; /* Set STAT78 to NTSC or PAL */ - m_stat78 = (ATTOSECONDS_TO_HZ(m_screen->frame_period().attoseconds()) >= 59.0) ? SNES_NTSC : SNES_PAL; + m_stat78 = (ATTOSECONDS_TO_HZ(screen().frame_period().attoseconds()) >= 59.0) ? SNES_NTSC : SNES_PAL; m_beam.last_visible_line = m_stat78 & SNES_PAL ? 240 : 225; m_mode = 0; m_ppu1_version = 1; // 5C77 chip version number, read by STAT77, only '1' is known @@ -1995,7 +1995,7 @@ void snes_ppu_device::set_latch_hv(int16_t x, int16_t y) void snes_ppu_device::dynamic_res_change() { - rectangle visarea = m_screen->visible_area(); + rectangle visarea = screen().visible_area(); attoseconds_t refresh; visarea.min_x = visarea.min_y = 0; @@ -2012,12 +2012,12 @@ void snes_ppu_device::dynamic_res_change() if ((m_stat78 & 0x10) == SNES_NTSC) { refresh = HZ_TO_ATTOSECONDS(DOTCLK_NTSC) * SNES_HTOTAL * SNES_VTOTAL_NTSC; - m_screen->configure(SNES_HTOTAL * 2, SNES_VTOTAL_NTSC * m_interlace, visarea, refresh); + screen().configure(SNES_HTOTAL * 2, SNES_VTOTAL_NTSC * m_interlace, visarea, refresh); } else { refresh = HZ_TO_ATTOSECONDS(DOTCLK_PAL) * SNES_HTOTAL * SNES_VTOTAL_PAL; - m_screen->configure(SNES_HTOTAL * 2, SNES_VTOTAL_PAL * m_interlace, visarea, refresh); + screen().configure(SNES_HTOTAL * 2, SNES_VTOTAL_PAL * m_interlace, visarea, refresh); } } @@ -2060,8 +2060,8 @@ READ8_MEMBER( snes_ppu_device::vram_read ) res = m_vram[offset]; else { - uint16_t v = m_screen->vpos(); - uint16_t h = m_screen->hpos(); + uint16_t v = screen().vpos(); + uint16_t h = screen().hpos(); uint16_t ls = (((m_stat78 & 0x10) == SNES_NTSC ? 525 : 625) >> 1) - 1; if (m_interlace == 2) @@ -2095,8 +2095,8 @@ WRITE8_MEMBER( snes_ppu_device::vram_write ) m_vram[offset] = data; else { - uint16_t v = m_screen->vpos(); - uint16_t h = m_screen->hpos(); + uint16_t v = screen().vpos(); + uint16_t h = screen().hpos(); if (v == 0) { if (h <= 4) @@ -2161,7 +2161,7 @@ READ8_MEMBER( snes_ppu_device::oam_read ) if (!m_screen_disabled) { - uint16_t v = m_screen->vpos(); + uint16_t v = screen().vpos(); if (v < m_beam.last_visible_line) offset = 0x010c; @@ -2179,7 +2179,7 @@ WRITE8_MEMBER( snes_ppu_device::oam_write ) if (!m_screen_disabled) { - uint16_t v = m_screen->vpos(); + uint16_t v = screen().vpos(); if (v < m_beam.last_visible_line) offset = 0x010c; @@ -2220,8 +2220,8 @@ READ8_MEMBER( snes_ppu_device::cgram_read ) #if 0 if (!m_screen_disabled) { - uint16_t v = m_screen->vpos(); - uint16_t h = m_screen->hpos(); + uint16_t v = screen().vpos(); + uint16_t h = screen().hpos(); if (v < m_beam.last_visible_line && h >= 128 && h < 1096) offset = 0x1ff; @@ -2248,8 +2248,8 @@ WRITE8_MEMBER( snes_ppu_device::cgram_write ) // writes to the cgram address if (!m_screen_disabled) { - uint16_t v = m_screen->vpos(); - uint16_t h = m_screen->hpos(); + uint16_t v = screen().vpos(); + uint16_t h = screen().hpos(); if (v < m_beam.last_visible_line && h >= 128 && h < 1096) offset = 0x1ff; @@ -2312,7 +2312,7 @@ uint8_t snes_ppu_device::read(address_space &space, uint32_t offset, uint8_t wri return m_ppu1_open_bus; } case SLHV: /* Software latch for H/V counter */ - set_latch_hv(m_screen->hpos() / m_htmult, m_screen->vpos()); + set_latch_hv(screen().hpos() / m_htmult, screen().vpos()); return m_openbus_cb(space, 0); /* Return value is meaningless */ case ROAMDATA: /* Read data from OAM (DR) */ diff --git a/src/devices/video/snes_ppu.h b/src/devices/video/snes_ppu.h index 2a3ac575edf..a3be6fed5da 100644 --- a/src/devices/video/snes_ppu.h +++ b/src/devices/video/snes_ppu.h @@ -48,8 +48,8 @@ public: void refresh_scanline(bitmap_rgb32 &bitmap, uint16_t curline); - int16_t current_x() const { return m_screen->hpos() / m_htmult; } - int16_t current_y() const { return m_screen->vpos(); } + int16_t current_x() const { return screen().hpos() / m_htmult; } + int16_t current_y() const { return screen().vpos(); } void set_latch_hv(int16_t x, int16_t y); uint8_t read(address_space &space, uint32_t offset, uint8_t wrio_bit7); diff --git a/src/devices/video/tms34061.cpp b/src/devices/video/tms34061.cpp index e2d47731921..397b412e586 100644 --- a/src/devices/video/tms34061.cpp +++ b/src/devices/video/tms34061.cpp @@ -154,7 +154,7 @@ void tms34061_device::update_interrupts() TIMER_CALLBACK_MEMBER( tms34061_device::interrupt ) { /* set timer for next frame */ - m_timer->adjust(m_screen->frame_period()); + m_timer->adjust(screen().frame_period()); /* set the interrupt bit in the status reg */ m_regs[TMS34061_STATUS] |= 1; @@ -179,7 +179,7 @@ void tms34061_device::register_w(address_space &space, offs_t offset, uint8_t da /* certain registers affect the display directly */ if ((regnum >= TMS34061_HORENDSYNC && regnum <= TMS34061_DISPSTART) || (regnum == TMS34061_CONTROL2)) - m_screen->update_partial(m_screen->vpos()); + screen().update_partial(screen().vpos()); /* store the hi/lo half */ if (regnum < ARRAY_LENGTH(m_regs)) @@ -203,7 +203,7 @@ void tms34061_device::register_w(address_space &space, offs_t offset, uint8_t da if (scanline < 0) scanline += m_regs[TMS34061_VERTOTAL]; - m_timer->adjust(m_screen->time_until_pos(scanline, m_regs[TMS34061_HORSTARTBLNK])); + m_timer->adjust(screen().time_until_pos(scanline, m_regs[TMS34061_HORSTARTBLNK])); break; /* XY offset: set the X and Y masks */ @@ -264,7 +264,7 @@ uint8_t tms34061_device::register_r(address_space &space, offs_t offset) /* vertical count register: return the current scanline */ case TMS34061_VERCOUNTER: - result = (m_screen->vpos()+ m_regs[TMS34061_VERENDBLNK]) % m_regs[TMS34061_VERTOTAL]; + result = (screen().vpos()+ m_regs[TMS34061_VERENDBLNK]) % m_regs[TMS34061_VERTOTAL]; break; } diff --git a/src/devices/video/tms9928a.cpp b/src/devices/video/tms9928a.cpp index 4d32f72274d..242d4a254e1 100644 --- a/src/devices/video/tms9928a.cpp +++ b/src/devices/video/tms9928a.cpp @@ -353,8 +353,8 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par return; } - int raw_vpos = m_screen->vpos(); - int vpos = raw_vpos * m_vertical_size / m_screen->height(); + int raw_vpos = screen().vpos(); + int vpos = raw_vpos * m_vertical_size / screen().height(); uint16_t BackColour = m_Regs[7] & 15; uint32_t *p = &m_tmpbmp.pix32(vpos); @@ -647,7 +647,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par } /* Schedule next callback */ - m_line_timer->adjust( m_screen->time_until_pos( ( raw_vpos + 1 ) % m_screen->height() , HORZ_DISPLAY_START ) ); + m_line_timer->adjust( screen().time_until_pos( ( raw_vpos + 1 ) % screen().height() , HORZ_DISPLAY_START ) ); } @@ -780,7 +780,7 @@ void tms9928a_device::device_reset() m_latch = 0; m_mode = 0; - m_line_timer->adjust( m_screen->time_until_pos( 0, HORZ_DISPLAY_START ) ); + m_line_timer->adjust( screen().time_until_pos( 0, HORZ_DISPLAY_START ) ); // TODO: Check clock freq settings in all drivers if (!m_out_gromclk_cb.isnull() && m_99) m_gromclk_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()/12)); diff --git a/src/devices/video/upd3301.cpp b/src/devices/video/upd3301.cpp index 424ea81cee8..0117c9e4977 100644 --- a/src/devices/video/upd3301.cpp +++ b/src/devices/video/upd3301.cpp @@ -585,12 +585,12 @@ void upd3301_device::reset_counters() void upd3301_device::update_hrtc_timer(int state) { - int y = m_screen->vpos(); + int y = screen().vpos(); int next_x = state ? m_h : 0; int next_y = state ? y : ((y + 1) % ((m_l + m_v) * m_width)); - attotime duration = m_screen->time_until_pos(next_y, next_x); + attotime duration = screen().time_until_pos(next_y, next_x); m_hrtc_timer->adjust(duration, !state); } @@ -604,7 +604,7 @@ void upd3301_device::update_vrtc_timer(int state) { int next_y = state ? (m_l * m_r) : 0; - attotime duration = m_screen->time_until_pos(next_y, 0); + attotime duration = screen().time_until_pos(next_y, 0); m_vrtc_timer->adjust(duration, !state); } @@ -628,7 +628,7 @@ void upd3301_device::recompute_parameters() LOG("UPD3301 Screen: %u x %u @ %f Hz\n", horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh)); LOG("UPD3301 Visible Area: (%u, %u) - (%u, %u)\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y); - m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh); + screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh); update_hrtc_timer(0); update_vrtc_timer(0); diff --git a/src/devices/video/upd7220.cpp b/src/devices/video/upd7220.cpp index 55f161edbe2..1199ffe16f2 100644 --- a/src/devices/video/upd7220.cpp +++ b/src/devices/video/upd7220.cpp @@ -338,7 +338,7 @@ inline void upd7220_device::update_vsync_timer(int state) { int next_y = state ? m_vs : 0; - attotime duration = m_screen->time_until_pos(next_y, 0); + attotime duration = screen().time_until_pos(next_y, 0); m_vsync_timer->adjust(duration, !state); } @@ -350,12 +350,12 @@ inline void upd7220_device::update_vsync_timer(int state) inline void upd7220_device::update_hsync_timer(int state) { - int y = m_screen->vpos(); + int y = screen().vpos(); int next_x = state ? m_hs : 0; int next_y = state ? y : ((y + 1) % m_al); - attotime duration = m_screen->time_until_pos(next_y, next_x); + attotime duration = screen().time_until_pos(next_y, next_x); m_hsync_timer->adjust(duration, !state); } @@ -367,12 +367,12 @@ inline void upd7220_device::update_hsync_timer(int state) inline void upd7220_device::update_blank_timer(int state) { - int y = m_screen->vpos(); + int y = screen().vpos(); int next_x = state ? (m_hs + m_hbp) : (m_hs + m_hbp + (m_aw << 3)); int next_y = state ? ((y + 1) % (m_vs + m_vbp + m_al + m_vfp - 1)) : y; - attotime duration = m_screen->time_until_pos(next_y, next_x); + attotime duration = screen().time_until_pos(next_y, next_x); m_hsync_timer->adjust(duration, !state); } @@ -421,7 +421,7 @@ inline void upd7220_device::recompute_parameters() if (m_m) { - m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh); + screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh); update_hsync_timer(0); update_vsync_timer(0); diff --git a/src/devices/video/v9938.cpp b/src/devices/video/v9938.cpp index 468cc3900db..4d4606ea11d 100644 --- a/src/devices/video/v9938.cpp +++ b/src/devices/video/v9938.cpp @@ -193,7 +193,7 @@ void v99x8_device::device_timer(emu_timer &timer, device_timer_id id, int param, m_pal_ntsc = pal; configure_pal_ntsc(); } - //m_screen->reset_origin(); + //screen().reset_origin(); m_offset_y = position_offset(m_cont_reg[18] >> 4); set_screen_parameters(); } @@ -226,7 +226,7 @@ void v99x8_device::configure_pal_ntsc() m_height = VTOTAL_PAL; rectangle visible; visible.set(0, HVISIBLE - 1, VERTICAL_ADJUST * 2, VVISIBLE_PAL * 2 - 1 - VERTICAL_ADJUST * 2); - m_screen->configure(HTOTAL, VTOTAL_PAL * 2, visible, HZ_TO_ATTOSECONDS(50.158974)); + screen().configure(HTOTAL, VTOTAL_PAL * 2, visible, HZ_TO_ATTOSECONDS(50.158974)); } else { @@ -234,7 +234,7 @@ void v99x8_device::configure_pal_ntsc() m_height = VTOTAL_NTSC; rectangle visible; visible.set(0, HVISIBLE - 1, VERTICAL_ADJUST * 2, VVISIBLE_NTSC * 2 - 1 - VERTICAL_ADJUST * 2); - m_screen->configure(HTOTAL, VTOTAL_NTSC * 2, visible, HZ_TO_ATTOSECONDS(59.922743)); + screen().configure(HTOTAL, VTOTAL_NTSC * 2, visible, HZ_TO_ATTOSECONDS(59.922743)); } m_vblank_start = m_height - VERTICAL_SYNC - TOP_ERASE; /* Sync + top erase */ } @@ -571,7 +571,7 @@ void v99x8_device::device_start() m_vdp_ops_count = 1; m_vdp_engine = nullptr; - m_screen->register_screen_bitmap(m_bitmap); + screen().register_screen_bitmap(m_bitmap); // Video RAM is allocated as an own address space m_vram_space = &space(AS_DATA); diff --git a/src/devices/video/vic4567.cpp b/src/devices/video/vic4567.cpp index de3810b74ee..efec0d795a6 100644 --- a/src/devices/video/vic4567.cpp +++ b/src/devices/video/vic4567.cpp @@ -172,8 +172,8 @@ void vic3_device::device_start() { int width, height; - width = m_screen->width(); - height = m_screen->height(); + width = screen().width(); + height = screen().height(); m_bitmap = std::make_unique(width, height); @@ -1868,7 +1868,7 @@ void vic3_device::draw_bitplanes() { int x, y, y1s, offset; rectangle vis; - const rectangle &visarea = m_screen->visible_area(); + const rectangle &visarea = screen().visible_area(); if (VIC3_LINES == 400) { /* interlaced! */ @@ -1972,13 +1972,13 @@ void vic3_device::raster_interrupt_gen() m_rows = new_rows; m_columns = new_columns; if (m_type == vic3_type::PAL) - m_screen->set_visible_area( + screen().set_visible_area( VIC2_STARTVISIBLECOLUMNS + 32, VIC2_STARTVISIBLECOLUMNS + 32 + m_columns + 16 - 1, VIC2_STARTVISIBLELINES + 34, VIC2_STARTVISIBLELINES + 34 + m_rows + 16 - 1); else - m_screen->set_visible_area( + screen().set_visible_area( VIC2_STARTVISIBLECOLUMNS + 34, VIC2_STARTVISIBLECOLUMNS + 34 + m_columns + 16 - 1, VIC2_STARTVISIBLELINES + 10, diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index 1720d98f582..8b0e4ac07d2 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -25,6 +25,7 @@ DEFINE_DEVICE_TYPE(ZEUS2, zeus2_device, "zeus2", "Midway Zeus2") zeus2_device::zeus2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ZEUS2, tag, owner, clock) + , device_video_interface(mconfig, *this) , m_vblank(*this), m_irq(*this), m_atlantis(0) { } @@ -37,13 +38,13 @@ TIMER_CALLBACK_MEMBER(zeus2_device::display_irq_off) { m_vblank(CLEAR_LINE); - //attotime vblank_period = m_screen->time_until_pos(m_zeusbase[0x37] & 0xffff); + //attotime vblank_period = screen().time_until_pos(m_zeusbase[0x37] & 0xffff); ///* if zero, adjust to next frame, otherwise we may get stuck in an infinite loop */ //if (vblank_period == attotime::zero) - // vblank_period = m_screen->frame_period(); + // vblank_period = screen().frame_period(); //vblank_timer->adjust(vblank_period); - vblank_timer->adjust(m_screen->time_until_vblank_start()); + vblank_timer->adjust(screen().time_until_vblank_start()); //machine().scheduler().timer_set(attotime::from_hz(30000000), timer_expired_delegate(FUNC(zeus2_device::display_irq), this)); } @@ -51,8 +52,8 @@ TIMER_CALLBACK_MEMBER(zeus2_device::display_irq) { m_vblank(ASSERT_LINE); /* set a timer for the next off state */ - //machine().scheduler().timer_set(m_screen->time_until_pos(0), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this), 0, this); - machine().scheduler().timer_set(m_screen->time_until_vblank_end(), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this), 0, this); + //machine().scheduler().timer_set(screen().time_until_pos(0), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this), 0, this); + machine().scheduler().timer_set(screen().time_until_vblank_end(), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this), 0, this); //machine().scheduler().timer_set(attotime::from_hz(30000000), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this)); } @@ -77,8 +78,6 @@ void zeus2_device::device_start() /* initialize polygon engine */ poly = auto_alloc(machine(), zeus2_renderer(this)); - //m_screen = machine().first_screen(); - m_screen = downcast(machine().device("screen")); m_vblank.resolve_safe(); m_irq.resolve_safe(); @@ -327,7 +326,7 @@ READ32_MEMBER( zeus2_device::zeus2_r ) /* bits $00080000 is tested in a loop until 0 */ /* bit $00000004 is tested for toggling; probably VBLANK */ result = 0x00; - if (m_screen->vblank()) + if (screen().vblank()) result |= 0x04; break; @@ -346,8 +345,8 @@ READ32_MEMBER( zeus2_device::zeus2_r ) case 0x54: // VCOUNT upper 16 bits - //result = (m_screen->vpos() << 16) | m_screen->vpos(); - result = (m_screen->vpos() << 16); + //result = (screen().vpos() << 16) | screen().vpos(); + result = (screen().vpos() << 16); break; } @@ -412,7 +411,7 @@ if (regdata_count[offset] < 256) /* writes to register $CC need to force a partial update */ // if ((offset & ~1) == 0xcc) -// m_screen->update_partial(m_screen->vpos()); +// screen().update_partial(screen().vpos()); /* always write to low word? */ m_zeusbase[offset] = data; @@ -462,7 +461,7 @@ void zeus2_device::zeus2_register_update(offs_t offset, uint32_t oldval, int log int htotal = (m_zeusbase[0x34] >> 16) << m_yScale; //rectangle visarea((m_zeusbase[0x33] >> 16) << m_yScale, htotal - 1, 0, (m_zeusbase[0x35] & 0xffff) << m_yScale); rectangle visarea(0, hor - 1, 0, ver - 1); - m_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)ZEUS2_VIDEO_CLOCK / 4.0 / (htotal * vtotal))); + screen().configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)ZEUS2_VIDEO_CLOCK / 4.0 / (htotal * vtotal))); zeus_cliprect = visarea; zeus_cliprect.max_x -= zeus_cliprect.min_x; zeus_cliprect.min_x = 0; @@ -551,7 +550,7 @@ void zeus2_device::zeus2_register_update(offs_t offset, uint32_t oldval, int log { uint32_t temp = m_zeusbase[0x38]; m_zeusbase[0x38] = oldval; - m_screen->update_partial(m_screen->vpos()); + screen().update_partial(screen().vpos()); log_fifo = machine().input().code_pressed(KEYCODE_L) | ALWAYS_LOG_FIFO; m_zeusbase[0x38] = temp; } diff --git a/src/devices/video/zeus2.h b/src/devices/video/zeus2.h index 2998d6378d3..2900fdce2e0 100644 --- a/src/devices/video/zeus2.h +++ b/src/devices/video/zeus2.h @@ -110,13 +110,11 @@ typedef zeus2_renderer::extent_t z2_poly_extent; #define MCFG_ZEUS2_FLOAT_MODE(_mode) \ downcast(device)->set_float_mode(_mode); -class zeus2_device : public device_t +class zeus2_device : public device_t, public device_video_interface { public: zeus2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - screen_device *m_screen; /* the screen we are acting on */ - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_READ32_MEMBER( zeus2_r ); DECLARE_WRITE32_MEMBER( zeus2_w ); diff --git a/src/emu/divideo.h b/src/emu/divideo.h index 8c449b9bddc..e92000f4835 100644 --- a/src/emu/divideo.h +++ b/src/emu/divideo.h @@ -47,12 +47,14 @@ public: // getters screen_device &screen() const { return *m_screen; } + bool has_screen() const { return m_screen != nullptr; } protected: // optional operation overrides virtual void interface_validity_check(validity_checker &valid) const override; virtual void interface_pre_start() override; +private: // configuration state bool m_screen_required; // is a screen required? const char * m_screen_tag; // configured tag for the target screen diff --git a/src/mame/machine/atarigen.cpp b/src/mame/machine/atarigen.cpp index 9678655a743..c0102c43476 100644 --- a/src/mame/machine/atarigen.cpp +++ b/src/mame/machine/atarigen.cpp @@ -396,10 +396,10 @@ READ16_MEMBER(atari_vad_device::control_read) // also sets bit 0x4000 if we're in VBLANK if (offset == 0) { - int result = m_screen->vpos(); + int result = screen().vpos(); if (result > 255) result = 255; - if (result > m_screen->visible_area().max_y) + if (result > screen().visible_area().max_y) result |= 0x4000; return result; } @@ -523,8 +523,8 @@ void atari_vad_device::device_reset() memset(m_control, 0, sizeof(m_control)); // start the timers - m_tilerow_update_timer->adjust(m_screen->time_until_pos(0)); - m_eof_timer->adjust(m_screen->time_until_pos(0)); + m_tilerow_update_timer->adjust(screen().time_until_pos(0)); + m_eof_timer->adjust(screen().time_until_pos(0)); } @@ -643,7 +643,7 @@ void atari_vad_device::internal_control_write(offs_t offset, uint16_t newword) // set the scanline interrupt here case 0x03: if (oldword != newword || !m_scanline_int_timer->enabled()) - m_scanline_int_timer->adjust(m_screen->time_until_pos(newword & 0x1ff)); + m_scanline_int_timer->adjust(screen().time_until_pos(newword & 0x1ff)); break; // latch enable @@ -651,7 +651,7 @@ void atari_vad_device::internal_control_write(offs_t offset, uint16_t newword) // check for palette banking if (m_palette_bank != (((newword & 0x0400) >> 10) ^ 1)) { - m_screen->update_partial(m_screen->vpos()); + screen().update_partial(screen().vpos()); m_palette_bank = ((newword & 0x0400) >> 10) ^ 1; } //if ((oldword & ~0x0080) != (newword & ~0x0080)) printf("Latch control = %04X\n", newword); @@ -746,7 +746,7 @@ void atari_vad_device::update_parameter(uint16_t newword) void atari_vad_device::update_tilerow(emu_timer &timer, int scanline) { // skip if out of bounds, or not enabled - if (scanline <= m_screen->visible_area().max_y && (m_control[0x0a] & 0x2000) != 0 && m_alpha_tilemap != nullptr) + if (scanline <= screen().visible_area().max_y && (m_control[0x0a] & 0x2000) != 0 && m_alpha_tilemap != nullptr) { // iterate over non-visible alpha tiles in this row int offset = scanline / 8 * 64 + 48 + 2 * (scanline % 8); @@ -755,7 +755,7 @@ void atari_vad_device::update_tilerow(emu_timer &timer, int scanline) // force an update if we have data if (scanline > 0 && ((data0 | data1) & 15) != 0) - m_screen->update_partial(scanline - 1); + screen().update_partial(scanline - 1); // write the data if ((data0 & 15) != 0) @@ -766,9 +766,9 @@ void atari_vad_device::update_tilerow(emu_timer &timer, int scanline) // update the timer to go off at the start of the next row scanline += ((m_control[0x0a] & 0x2000) != 0) ? 1 : 8; - if (scanline >= m_screen->height()) + if (scanline >= screen().height()) scanline = 0; - timer.adjust(m_screen->time_until_pos(scanline), scanline); + timer.adjust(screen().time_until_pos(scanline), scanline); } @@ -794,7 +794,7 @@ void atari_vad_device::eof_update(emu_timer &timer) m_playfield_tilemap->set_scrolly(0, m_pf0_yscroll); if (m_playfield2_tilemap != nullptr) m_playfield2_tilemap->set_scrolly(0, m_pf1_yscroll);*/ - timer.adjust(m_screen->time_until_pos(0)); + timer.adjust(screen().time_until_pos(0)); // use this for debugging the video controller values #if 0 diff --git a/src/mame/machine/n64.cpp b/src/mame/machine/n64.cpp index 88355534a74..f6d771319e4 100644 --- a/src/mame/machine/n64.cpp +++ b/src/mame/machine/n64.cpp @@ -987,7 +987,7 @@ WRITE32_MEMBER( n64_periphs::dp_reg_w ) TIMER_CALLBACK_MEMBER(n64_periphs::vi_scanline_callback) { signal_rcp_interrupt(VI_INTERRUPT); - vi_scanline_timer->adjust(m_screen->time_until_pos(vi_intr)); + vi_scanline_timer->adjust(screen().time_until_pos(vi_intr)); } // Video Interface @@ -1000,7 +1000,7 @@ void n64_periphs::vi_recalculate_resolution() int width = ((vi_xscale & 0x00000fff) * (x_end - x_start)) / 0x400; int height = ((vi_yscale & 0x00000fff) * (y_end - y_start)) / 0x400; - rectangle visarea = m_screen->visible_area(); + rectangle visarea = screen().visible_area(); // DACRATE is the quarter pixel clock and period will be for a field, not a frame attoseconds_t period = (vi_hsync & 0xfff) * (vi_vsync & 0xfff) * HZ_TO_ATTOSECONDS(DACRATE_NTSC) / 2; @@ -1026,7 +1026,7 @@ void n64_periphs::vi_recalculate_resolution() visarea.max_x = width - 1; visarea.max_y = height - 1; - m_screen->configure((vi_hsync & 0x00000fff)>>2, (vi_vsync & 0x00000fff), visarea, period); + screen().configure((vi_hsync & 0x00000fff)>>2, (vi_vsync & 0x00000fff), visarea, period); } READ32_MEMBER( n64_periphs::vi_reg_r ) @@ -1051,7 +1051,7 @@ READ32_MEMBER( n64_periphs::vi_reg_r ) break; case 0x10/4: // VI_CURRENT_REG - ret = (m_screen->vpos() & 0x3FE) + field; + ret = (screen().vpos() & 0x3FE) + field; break; case 0x14/4: // VI_BURST_REG @@ -1123,7 +1123,7 @@ WRITE32_MEMBER( n64_periphs::vi_reg_w ) case 0x0c/4: // VI_INTR_REG vi_intr = data; - vi_scanline_timer->adjust(m_screen->time_until_pos(vi_intr)); + vi_scanline_timer->adjust(screen().time_until_pos(vi_intr)); break; case 0x10/4: // VI_CURRENT_REG diff --git a/src/mame/machine/nb1414m4.cpp b/src/mame/machine/nb1414m4.cpp index ba13c685bb1..c142f238ad7 100644 --- a/src/mame/machine/nb1414m4.cpp +++ b/src/mame/machine/nb1414m4.cpp @@ -92,7 +92,7 @@ void nb1414m4_device::fill(uint16_t dst, uint8_t tile, uint8_t pal, uint8_t *vra void nb1414m4_device::insert_coin_msg(uint8_t *vram) { int credit_count = (vram[0xf] & 0xff); - uint8_t fl_cond = m_screen->frame_number() & 0x10; /* for insert coin "flickering" */ + uint8_t fl_cond = screen().frame_number() & 0x10; /* for insert coin "flickering" */ uint16_t dst; if(credit_count == 0) @@ -112,7 +112,7 @@ void nb1414m4_device::insert_coin_msg(uint8_t *vram) void nb1414m4_device::credit_msg(uint8_t *vram) { int credit_count = (vram[0xf] & 0xff); - uint8_t fl_cond = m_screen->frame_number() & 0x10; /* for insert coin "flickering" */ + uint8_t fl_cond = screen().frame_number() & 0x10; /* for insert coin "flickering" */ uint16_t dst; dst = ((m_data[0x023]<<8)|(m_data[0x024]&0xff)) & 0x3fff; diff --git a/src/mame/video/antic.cpp b/src/mame/video/antic.cpp index 9dba288d91b..0da156a1ab0 100644 --- a/src/mame/video/antic.cpp +++ b/src/mame/video/antic.cpp @@ -348,7 +348,7 @@ void antic_device::device_start() m_gtia = machine().device(m_gtia_tag); assert(m_gtia); - m_bitmap = std::make_unique(m_screen->width(), m_screen->height()); + m_bitmap = std::make_unique(screen().width(), screen().height()); m_cclk_expand = make_unique_clear(21 * 256); @@ -385,7 +385,7 @@ void antic_device::device_start() LOG(("atari prio_init\n")); prio_init(); - for (int i = 0; i < m_screen->height(); i++) + for (int i = 0; i < screen().height(); i++) m_video[i] = auto_alloc_clear(machine(),