2424
2525#include " emu.h"
2626#include " lightpen.h"
27- #include " screen.h"
2827
2928
3029namespace {
@@ -35,7 +34,6 @@ class bbc_lightpen_device : public device_t, public device_bbc_analogue_interfac
3534 bbc_lightpen_device (const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
3635 : device_t (mconfig, type, tag, owner, clock)
3736 , device_bbc_analogue_interface(mconfig, *this )
38- , m_screen(*this , " :screen" )
3937 , m_light(*this , " LIGHT%u" , 0 )
4038 , m_button(*this , " BUTTON" )
4139 , m_pen_timer(nullptr )
@@ -58,7 +56,6 @@ class bbc_lightpen_device : public device_t, public device_bbc_analogue_interfac
5856 }
5957
6058private:
61- required_device<screen_device> m_screen;
6259 required_ioport_array<2 > m_light;
6360 required_ioport m_button;
6461
@@ -193,11 +190,14 @@ ioport_constructor bbc_stacklr_device::device_input_ports() const
193190
194191void bbc_lightpen_device::device_start ()
195192{
196- if (!m_screen->started ())
193+ if (!screen ())
194+ fatalerror (" Can't find screen device required for %s\n " , name ());
195+
196+ if (!screen ()->started ())
197197 throw device_missing_dependencies ();
198198
199199 m_pen_timer = timer_alloc (FUNC (bbc_lightpen_device::update_pen), this );
200- m_pen_timer->adjust (attotime::zero, 0 , m_screen ->frame_period ());
200+ m_pen_timer->adjust (attotime::zero, 0 , screen () ->frame_period ());
201201
202202 m_lpstb_timer = timer_alloc (FUNC (bbc_lightpen_device::lpstb), this );
203203}
@@ -211,12 +211,12 @@ TIMER_CALLBACK_MEMBER(bbc_lightpen_device::update_pen)
211211{
212212 int x_val = m_light[0 ]->read ();
213213 int y_val = m_light[1 ]->read ();
214- const rectangle &vis_area = m_screen ->visible_area ();
214+ const rectangle &vis_area = screen () ->visible_area ();
215215
216216 int xt = x_val * vis_area.width () / 1024 + vis_area.min_x ;
217217 int yt = y_val * vis_area.height () / 1024 + vis_area.min_y ;
218218
219- m_lpstb_timer->adjust (m_screen ->time_until_pos (yt, xt));
219+ m_lpstb_timer->adjust (screen () ->time_until_pos (yt, xt));
220220}
221221
222222TIMER_CALLBACK_MEMBER (bbc_lightpen_device::lpstb)
0 commit comments