diff --git a/ubb-vga/ubb-vga2.c b/ubb-vga/ubb-vga2.c index e201efd..1a6e6d6 100644 --- a/ubb-vga/ubb-vga2.c +++ b/ubb-vga/ubb-vga2.c @@ -230,8 +230,6 @@ static void line(const uint32_t *line) /* Back porch */ - TCNT(TIMER) = 0; - MSC_STRPCL = 1 << 3; /* reset the MSC */ // while (MSC_STAT & (1 << 15)); @@ -351,8 +349,16 @@ static void frame(void *const *f) PDDATS = HSYNC; until(mode->line_cycles-US(0.79)); - for (p = f; p != f+mode->yres; p++) + /* + * Note: resetting the timer just before calling "line" isn't enough. + * We have t reset it before the loop and right after returning from + * "line". + */ + TCNT(TIMER) = 0; + for (p = f; p != f+mode->yres; p++) { line(*p); + TCNT(TIMER) = 0; + } /* Back porch */ hdelay(14);