Pixels in sync with VSYNC and HSYNC.

This commit is contained in:
giomba 2022-10-15 15:08:22 +02:00
parent 6b6b76b212
commit 9b596c80aa
2 changed files with 14 additions and 8 deletions

View File

@ -22,7 +22,7 @@
#define FRAMES 2
#define HPIXEL 640
#define VPIXEL 480
#define VPIXEL 500
#define BPP 1
typedef struct Frame
@ -93,11 +93,11 @@ int main()
// "draw" an horizontal dotted line (?)
for (unsigned int c = 0; c < 20; c += 3)
{
frames[0].data[80 * 64 + 20 + c] = 0x55;
frames[0].data[80 * 64 + 50 + c] = 0x55;
}
for (unsigned int c = 0; c < 20; c += 3)
{
frames[0].data[80 * 128 + 20 + c] = 0x99;
frames[0].data[80 * 128 + 50 + c] = 0x99;
}
// PIO and state machines
@ -124,12 +124,14 @@ int main()
// low pulse assert lasts for 3 horizontal lines, then adjust by one
pio_sm_put_blocking(pio, sm2, 3 - 1);
pio_sm_put_blocking(pio, sm2, 500 - 3 - 1);
printf("OK\n");
// VGA pixel program
uint offset0 = pio_add_program(pio, &vga_free_run_program);
uint sm0 = pio_claim_unused_sm(pio, true);
uint sm0 = pio_claim_unused_sm(pio, false);
printf("Starting VGA pixel machine on %u...\n", sm0);
vga_pixel_program_init(pio, sm0, offset0);
pio_sm_put_blocking(pio, sm0, 640 - 1);
printf("Start!\n");

View File

@ -1,11 +1,15 @@
.program vga_free_run
entrypoint_vga_free_run:
pull
mov y, osr
loope:
mov x, y
wait irq 0
loop:
out pins, 1 [2]
nop
nop
jmp loop
out pins, 1
jmp x-- loop
jmp loope
.program vga_hsync