Fix MT04059: Add new method reset_origin() to screen devices to allow

manual synchronization of VBLANK start against an external timing source.
Updated the MC6845 device to call reset_origin() on its screen at the
start of each frame if a screen is present.

The practical upshot is that now the screen timing and MC6845 timing is
once against synchronized, but by tying the screen timing to the MC6845
and not the other way around.
This commit is contained in:
Aaron Giles 2010-10-18 08:07:02 +00:00
parent c724f32a28
commit 40910ec4a6
3 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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
{