From 3d80f9400569f545d9e651a68aa0382f7ca6db40 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 30 Jun 2023 21:05:42 +0300 Subject: [PATCH] testpico: more on timer reload --- testpico/asmtools.S | 3 ++- testpico/main.c | 27 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/testpico/asmtools.S b/testpico/asmtools.S index 24b6458..dd22368 100644 --- a/testpico/asmtools.S +++ b/testpico/asmtools.S @@ -534,7 +534,7 @@ test_ym_ab_sync2: movea.l #0xa04000, a0 movea.l #0xa04001, a1 -# move.b #0x3f, (a1) /* 12 clear */ + move.b #0x0f, (a1) /* 12 enable */ moveq.l #0, d0 moveq.l #3, d1 nop /* 4 need ~12c to clear */ @@ -543,6 +543,7 @@ test_ym_ab_sync2: and.b d1, d0 /* 4 */ beq 0b /* 10|8 */ move.b (a0), d0 /* re-read */ + move.b #0x3c, (a1) /* 12 clear, disable */ rts # vim:filetype=asmM68k:ts=4:sw=4:expandtab diff --git a/testpico/main.c b/testpico/main.c index 9c07110..1d27128 100644 --- a/testpico/main.c +++ b/testpico/main.c @@ -1409,19 +1409,34 @@ static int t_tim_ym_timerb_stop(void) static int t_tim_ym_timer_ab_sync(void) { - u16 v1, v2, v3, start, line_diff; + u16 v1, v2, v3, v4, v5, ln0, ln1, ln2; int ok = 1; + + vdp_wait_for_line_0(); v1 = test_ym_ab_sync(); - start = get_line(); - write8(0xa04001, 0x3f); // clear - burn10(3420*11/7/10); // ~11 scanlines + + ln0 = get_line(); + burn10(3420*15/7/10); // ~15 scanlines + write8(0xa04001, 0x3f); // clear, no reload + burn10(12); // wait for busy to clear v2 = read8(0xa04000); v3 = test_ym_ab_sync2(); - line_diff = get_line() - start; + + ln1 = get_line(); + burn10(3420*15/7/10); // ~15 scanlines + v4 = test_ym_ab_sync2(); + + ln2 = get_line(); + burn10(3420*30/7/10); // ~35 scanlines + v5 = read8(0xa04000); + expect(ok, v1, 3); expect(ok, v2, 0); expect(ok, v3, 3); - expect_range(ok, line_diff, 18, 19); + expect(ok, v4, 2); + expect(ok, v5, 0); + expect_range(ok, ln1-ln0, 18, 19); + expect_range(ok, ln2-ln1, 32, 34); // almost always 33 return ok; } -- 2.39.5