spectrum.cpp, spec128.cpp: Fixed partial updates at end of frame. (#9945)

See MT08264 and MT08265 as well as discussion on GitHub #9670 and #9750.
This commit is contained in:
holub 2022-06-20 12:13:47 -04:00 committed by GitHub
parent e6477ba68c
commit 90115f4de2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 4 deletions

View File

@ -346,7 +346,8 @@ GFXDECODE_END
rectangle spectrum_128_state::get_screen_area()
{
return rectangle{48, 48 + 255, 63, 63 + 191};
return { SPEC_LEFT_BORDER, SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE - 1,
SPEC128_UNSEEN_LINES + SPEC_TOP_BORDER, SPEC128_UNSEEN_LINES + SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE - 1 };
}
void spectrum_128_state::spectrum_128(machine_config &config)
@ -363,7 +364,9 @@ void spectrum_128_state::spectrum_128(machine_config &config)
config.set_maximum_quantum(attotime::from_hz(60));
/* video hardware */
m_screen->set_raw(X1_128_SINCLAIR / 5, 456, 311, {get_screen_area().left() - 48, get_screen_area().right() + 48, get_screen_area().top() - 48, get_screen_area().bottom() + 56});
rectangle visarea = { get_screen_area().left() - SPEC_LEFT_BORDER, get_screen_area().right() + SPEC_RIGHT_BORDER,
get_screen_area().top() - SPEC_TOP_BORDER, get_screen_area().bottom() + SPEC_BOTTOM_BORDER };
m_screen->set_raw(X1_128_SINCLAIR / 5, SPEC128_CYCLES_PER_LINE * 2, SPEC128_UNSEEN_LINES + SPEC_SCREEN_HEIGHT, visarea);
subdevice<gfxdecode_device>("gfxdecode")->set_info(spec128);

View File

@ -796,7 +796,9 @@ void spectrum_state::spectrum_common(machine_config &config)
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(X1 / 2, 448, 312, {get_screen_area().left() - 48, get_screen_area().right() + 48, get_screen_area().top() - 48, get_screen_area().bottom() + 56});
rectangle visarea = { get_screen_area().left() - SPEC_LEFT_BORDER, get_screen_area().right() + SPEC_RIGHT_BORDER,
get_screen_area().top() - SPEC_TOP_BORDER, get_screen_area().bottom() + SPEC_BOTTOM_BORDER };
m_screen->set_raw(X1 / 2, SPEC_CYCLES_PER_LINE * 2, SPEC_UNSEEN_LINES + SPEC_SCREEN_HEIGHT, visarea);
m_screen->set_screen_update(FUNC(spectrum_state::screen_update_spectrum));
m_screen->set_palette("palette");

View File

@ -97,9 +97,11 @@ protected:
TIMER_CALLBACK_MEMBER(irq_on);
TIMER_CALLBACK_MEMBER(irq_off);
TIMER_CALLBACK_MEMBER(finish_screen_update);
emu_timer *m_irq_on_timer;
emu_timer *m_irq_off_timer;
emu_timer *m_finish_screen_update_timer;
int m_port_fe_data;
int m_port_7ffd_data;

View File

@ -19,6 +19,22 @@
#include "includes/spectrum.h"
#include "includes/spec128.h"
TIMER_CALLBACK_MEMBER(spectrum_state::finish_screen_update)
{
/* TMP screen.cpp at the current state behaves incorrectly if layout is configured as: visarea.bottom() == m_screen.bottom()
This leads video_manager::finish_screen_updates() to ignore final update_now(). As a result partially rendered scanline of
the screen is redrawn entirely.
Consider this timer a tmp solution till screen.cpp provides better support for such case.
Validation:
https://mametesters.org/view.php?id=8264
https://mametesters.org/view.php?id=8265
https://github.com/mamedev/mame/pull/9670#issuecomment-1118576555
https://github.com/mamedev/mame/pull/9750
*/
m_screen->update_now();
m_finish_screen_update_timer->adjust(m_screen->time_until_pos(m_screen->visible_area().bottom(), m_screen->visible_area().right() + 1));
}
/***************************************************************************
Start the video hardware emulation.
***************************************************************************/
@ -26,6 +42,8 @@ void spectrum_state::video_start()
{
m_irq_on_timer = timer_alloc(FUNC(spectrum_state::irq_on), this);
m_irq_off_timer = timer_alloc(FUNC(spectrum_state::irq_off), this);
m_finish_screen_update_timer = timer_alloc(FUNC(spectrum_state::finish_screen_update), this);
finish_screen_update(0);
m_frame_invert_count = 16;
m_screen_location = m_video_ram;
@ -85,7 +103,8 @@ void spectrum_state::spectrum_palette(palette_device &palette) const
rectangle spectrum_state::get_screen_area()
{
// 256x192 screen position without border
return rectangle{48, 48 + 255, 64, 64 + 191};
return { SPEC_LEFT_BORDER, SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE - 1,
SPEC_UNSEEN_LINES + SPEC_TOP_BORDER, SPEC_UNSEEN_LINES + SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE - 1 };
}
u8 spectrum_state::get_border_color(u16 hpos, u16 vpos)