From 2baddfc76ec78e31869eb151d067321d10bb0284 Mon Sep 17 00:00:00 2001 From: giomba Date: Fri, 2 Dec 2022 21:10:54 +0100 Subject: [PATCH] Perfec 640x480 1bpp VGA. --- src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 98ab869..6f9d4f6 100644 --- a/src/main.c +++ b/src/main.c @@ -36,7 +36,7 @@ // to fill the vertical blanking interval at top and bottom // of the display // (at 1BPP, this wastes about 1k) -uint8_t frame[HPIXEL * (VPIXEL + VBBLANK + VFBLANK) * BPP / 8] = {0}; +uint8_t frame[HPIXEL * (VSPULSE + VBBLANK + VPIXEL) * BPP / 8] = {0}; static void vga_pixel_program_init(PIO pio, uint sm, uint offset) { @@ -166,7 +166,7 @@ void set_pixel(uint16_t x, uint16_t y) // skip wasted blanking lines // (see frame struct declaration) - y += VBBLANK + VFBLANK; + y += VBBLANK + VSPULSE - 1; // set bit frame[y * 80 + x / 8] |= (1 << x % 8); @@ -177,7 +177,7 @@ void clear_pixel(uint16_t x, uint16_t y) if (!valid_coord(x, y)) return; - y += VBBLANK + VFBLANK; + y += VBBLANK + VSPULSE - 1; frame[y * 80 + x / 8] &= ~(1 << x % 8); } @@ -319,7 +319,7 @@ int main() // before the first DMA request, in order to // avoid any possible delay dma_channel_configure(dma_channel, &dma_config, &pio0_hw->txf[2], &frame[0], - HPIXEL * (VPIXEL + VBBLANK + VFBLANK) / 32 - 1, true); + HPIXEL * (VSPULSE + VPIXEL + VBBLANK) / 32 - 1, true); dma_ready = true; printf("OK\n");