From e7d317c44a48d7e5d41d30e93eeb973fc71f35d6 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 24 Apr 2021 16:14:03 -0400 Subject: apple2gs: fix $C02E vertical counter readback, corrects hang in ShowMe NDA. [R. Belmont] --- src/mame/drivers/apple2gs.cpp | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index 43c1846c8d5..ab228134e4e 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -2180,31 +2180,12 @@ void apple2gs_state::do_io(int offset) } } -// apple2gs_get_vpos - return the correct vertical counter value for the current scanline, -// keeping borders in mind. - +// apple2gs_get_vpos - return the correct vertical counter value for the current scanline. int apple2gs_state::get_vpos() { - int result, scan; - static const u8 top_border_vert[BORDER_TOP] = - { - 0xfa, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfb, 0xfb, - 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfe, 0xfe, 0xff, - - }; - - scan = m_screen->vpos(); - - if (scan < BORDER_TOP) - { - result = top_border_vert[scan]; - } - else - { - result = scan - BORDER_TOP + 0x100 + 1; - } - - return result; + // as per IIgs Tech Note #39, this is simply scanline + 250 on NTSC (262 lines), + // or scanline + 200 on PAL (312 lines) + return ((m_screen->vpos() + BORDER_TOP) % 262) + 250; } void apple2gs_state::process_clock() -- cgit v1.2.3