diff --git a/src/emu/video.c b/src/emu/video.c index ed1fc210059..69ec5ca4cf9 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -2087,6 +2087,23 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a } +//------------------------------------------------- +// reset_origin - reset the timing such that the +// given (x,y) occurs at the current time +//------------------------------------------------- + +void screen_device::reset_origin(int beamy, int beamx) +{ + // compute the effective VBLANK start/end times + m_vblank_end_time = attotime_sub_attoseconds(timer_get_time(machine), beamy * m_scantime + beamx * m_pixeltime); + m_vblank_start_time = attotime_sub_attoseconds(m_vblank_end_time, m_vblank_period); + + // re-adjust the scanline 0 and VBLANK timers + timer_adjust_oneshot(m_scanline0_timer, time_until_pos(0), 0); + timer_adjust_oneshot(m_vblank_begin_timer, time_until_vblank_start(), 0); +} + + //------------------------------------------------- // realloc_screen_bitmaps - reallocate bitmaps // and textures as necessary diff --git a/src/emu/video.h b/src/emu/video.h index 8ffcc82537a..c49a6dd5ead 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -160,6 +160,7 @@ public: // dynamic configuration void configure(int width, int height, const rectangle &visarea, attoseconds_t frame_period); + void reset_origin(int beamy = 0, int beamx = 0); void set_visible_area(int min_x, int max_x, int min_y, int max_y); // beam positioning and state diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c index 3b38f5ddb43..92b521c580e 100644 --- a/src/emu/video/mc6845.c +++ b/src/emu/video/mc6845.c @@ -651,6 +651,9 @@ static TIMER_CALLBACK( line_timer_cb ) mc6845->line_enable_ff = 1; /* also update the cursor state now */ update_cursor_state(mc6845); + + if (mc6845->screen != NULL) + mc6845->screen->reset_origin(); } else {