Stable VGA 640x460@75Hz. Black screen.

This commit is contained in:
giomba 2022-10-12 22:09:16 +02:00
parent d805003349
commit 151afb08b0
2 changed files with 18 additions and 11 deletions

View File

@ -122,8 +122,8 @@ int main()
vga_hsync_program_init(pio, sm1, offset1); vga_hsync_program_init(pio, sm1, offset1);
printf("Feeding horizontal sync...\n"); printf("Feeding horizontal sync...\n");
// low pulse is X pixels long, and SM runs at 4x of pixel clock // low pulse is X pixels long, and SM runs at 4x of pixel clock
pio_sm_put_blocking(pio, sm1, 63 * 4); pio_sm_put_blocking(pio, sm1, 64 * 4);
pio_sm_put_blocking(pio, sm1, 775 * 4); pio_sm_put_blocking(pio, sm1, 765 * 4);
// VGA VSYNC program // VGA VSYNC program
uint offset2 = pio_add_program(pio, &vga_vsync_program); uint offset2 = pio_add_program(pio, &vga_vsync_program);
@ -131,8 +131,9 @@ int main()
printf("Starting VGA vsync machine on %u...\n", sm2); printf("Starting VGA vsync machine on %u...\n", sm2);
vga_vsync_program_init(pio, sm2, offset2); vga_vsync_program_init(pio, sm2, offset2);
printf("Feeding vertical sync...\n"); printf("Feeding vertical sync...\n");
pio_sm_put_blocking(pio, sm2, 2520 * 4); // low pulse assert lasts for 3 horizontal lines, then adjust by one
pio_sm_put_blocking(pio, sm2, 420000 * 4); pio_sm_put_blocking(pio, sm2, 3 - 1);
pio_sm_put_blocking(pio, sm2, 500 - 3 - 1);
printf("Start!\n"); printf("Start!\n");

View File

@ -13,9 +13,10 @@ entrypoint_vga_hsync:
mov isr, osr mov isr, osr
pull pull
loope:
set y, 15
loop: loop:
nop
irq set 0
mov x, isr mov x, isr
set pins, 0 set pins, 0
hsync_pulse: hsync_pulse:
@ -25,10 +26,9 @@ hsync_pulse:
set pins, 1 set pins, 1
hsync_idle: hsync_idle:
jmp x-- hsync_idle jmp x-- hsync_idle
jmp y-- loop nop
jmp loop
irq set 0
jmp loope
.program vga_vsync .program vga_vsync
@ -38,11 +38,17 @@ entrypoint_vga_vsync:
pull pull
loop: loop:
wait irq 0
mov x, isr mov x, isr
set pins, 0
vsync_pulse: vsync_pulse:
wait irq 0
set pins, 0
jmp x-- vsync_pulse jmp x-- vsync_pulse
mov x, osr
vsync_idle:
wait irq 0
set pins, 1 set pins, 1
jmp x-- vsync_idle
jmp loop jmp loop