More adjustments.

This commit is contained in:
giomba 2022-10-17 18:15:52 +02:00
parent 0b751fd1c0
commit 0cf72757e9
2 changed files with 23 additions and 17 deletions

View File

@ -42,6 +42,7 @@ static void vga_pixel_program_init(PIO pio, uint sm, uint offset)
sm_config_set_out_shift(&config, true, true, 0); sm_config_set_out_shift(&config, true, true, 0);
pio_gpio_init(pio, 22); pio_gpio_init(pio, 22);
pio_sm_set_consecutive_pindirs(pio, sm, 22, 1, true); pio_sm_set_consecutive_pindirs(pio, sm, 22, 1, true);
sm_config_set_wrap(&config, offset + vga_free_run_wrap_target, offset + vga_free_run_wrap);
pio_sm_init(pio, sm, offset, &config); pio_sm_init(pio, sm, offset, &config);
@ -57,6 +58,7 @@ static void vga_hsync_program_init(PIO pio, uint sm, uint offset)
sm_config_set_set_pins(&config, 20, 1); sm_config_set_set_pins(&config, 20, 1);
pio_gpio_init(pio, 20); pio_gpio_init(pio, 20);
pio_sm_set_consecutive_pindirs(pio, sm, 20, 1, true); pio_sm_set_consecutive_pindirs(pio, sm, 20, 1, true);
sm_config_set_wrap(&config, offset + vga_hsync_wrap_target, offset + vga_hsync_wrap);
pio_sm_init(pio, sm, offset, &config); pio_sm_init(pio, sm, offset, &config);
@ -74,6 +76,7 @@ static void vga_vsync_program_init(PIO pio, uint sm, uint offset)
sm_config_set_set_pins(&config, 21, 1); sm_config_set_set_pins(&config, 21, 1);
pio_gpio_init(pio, 21); pio_gpio_init(pio, 21);
pio_sm_set_consecutive_pindirs(pio, sm, 21, 1, true); pio_sm_set_consecutive_pindirs(pio, sm, 21, 1, true);
sm_config_set_wrap(&config, offset + vga_vsync_wrap_target, offset + vga_vsync_wrap);
pio_sm_init(pio, sm, offset, &config); pio_sm_init(pio, sm, offset, &config);
@ -185,8 +188,8 @@ int main()
vga_hsync.sm = pio_claim_unused_sm(vga_hsync.pio, true); vga_hsync.sm = pio_claim_unused_sm(vga_hsync.pio, true);
vga_hsync_program_init(vga_hsync.pio, vga_hsync.sm, vga_hsync.offset); vga_hsync_program_init(vga_hsync.pio, vga_hsync.sm, vga_hsync.offset);
// 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(vga_hsync.pio, vga_hsync.sm, (64 - 1) * 4); pio_sm_put_blocking(vga_hsync.pio, vga_hsync.sm, (64 - 1));
pio_sm_put_blocking(vga_hsync.pio, vga_hsync.sm, (776 - 1) * 4); pio_sm_put_blocking(vga_hsync.pio, vga_hsync.sm, (640 - 1));
printf("OK\n"); printf("OK\n");
// VGA VSYNC program // VGA VSYNC program

View File

@ -3,13 +3,14 @@
entrypoint_vga_free_run: entrypoint_vga_free_run:
pull pull
mov y, osr mov y, osr
loope:
.wrap_target
mov x, y mov x, y
wait irq 7 wait irq 7
loop: loop:
out pins, 1 [3] out pins, 1 [3]
jmp x-- loop jmp x-- loop
jmp loope .wrap
.program vga_hsync .program vga_hsync
@ -18,20 +19,24 @@ entrypoint_vga_hsync:
mov isr, osr mov isr, osr
pull pull
loop: .wrap_target
irq set 0 [1] set pins, 0 [1]
irq set 0
mov x, isr mov x, isr
set pins, 0
hsync_pulse: hsync_pulse:
jmp x-- hsync_pulse jmp x-- hsync_pulse [3]
set pins, 1 [1]
set y, 24
hsync_back_porch:
jmp y-- hsync_back_porch [19]
irq set 7 irq set 7
mov x, osr
set pins, 1 mov x, osr [3]
hsync_idle: hsync_idle:
jmp x-- hsync_idle jmp x-- hsync_idle [3]
jmp loop .wrap
.program vga_vsync .program vga_vsync
@ -41,8 +46,7 @@ entrypoint_vga_vsync:
mov isr, osr mov isr, osr
pull pull
loop: .wrap_target
mov x, isr mov x, isr
vsync_pulse: vsync_pulse:
wait irq 0 wait irq 0
@ -56,5 +60,4 @@ vsync_idle:
jmp x-- vsync_idle jmp x-- vsync_idle
irq set 1 irq set 1
.wrap
jmp loop