diff --git a/ubb-vga/ubb-vga2.c b/ubb-vga/ubb-vga2.c index 93a85ca..64d7ecb 100644 --- a/ubb-vga/ubb-vga2.c +++ b/ubb-vga/ubb-vga2.c @@ -36,7 +36,7 @@ static uint8_t thres = 63; -int bad; +static int bad; /* ----- I/O pin assignment ------------------------------------------------ */ @@ -378,10 +378,8 @@ static void frame(const uint32_t *f) *pddats = HSYNC; until(line_cycles-US(0.79)); - for (p = f; p != f+240*line_words; p += line_words) { - line(p, p); + for (p = f; p != f+480*line_words; p += line_words) line(p, p+line_words); - } /* Back porch */ hdelay(14); @@ -462,23 +460,27 @@ static void grab(uint8_t *f) uint32_t pix; uint8_t r, g, b; - for (y = 0; y != 240; y++) + for (y = 0; y != 240; y++) { for (x = 0; x != 320; x++) { pix = *fb++; r = pix >> 16; g = pix >> 8; b = pix; - *f++ = pattern(r >= thres, g >= thres, b >= thres); + f[0] = f[320] = + pattern(r >= thres, g >= thres, b >= thres); + f++; } + f += 320; + } } /* ----- Command-line parsing and main loop -------------------------------- */ -static void session(int frames, int single) +static void session(int frames) { - uint32_t f[2*240*line_words]; + uint32_t f[2*240*(line_words+1)]; int i; memset(f, 0, sizeof(f)); @@ -508,7 +510,6 @@ static void usage(const char *name) int main(int argc, char *const *argv) { int frames; - int single = 1; int c; while ((c = getopt(argc, argv, "")) != EOF) @@ -529,9 +530,10 @@ int main(int argc, char *const *argv) } setup(); - session(frames, single); + session(frames); cleanup(); -printf("%d\n", bad); + if (bad) + printf("%d timeout%s\n", bad, bad == 1 ? "" : "s"); return 0; }