How do I change the effective resolution to 320x240?
cbmeeks opened this issue · 3 comments
This code is almost exactly what I need for a project I am working on. Thanks!
However, I don't want to drive 640x480. Instead, I would like an effective resolution of 320x240. Of course, the actual VGA timing can stay at 640x480, I just need to draw "fat pixels" (x2 on X/Y).
I have tried reducing the buffer by 1/4, changing the timing, etc. but nothing seems to work.
For example:
#define RGB_ACTIVE 159 // (horizontal active)/2 - 1
...
pull block ; Pull from FIFO to OSR (only once)
mov y, osr ; Copy value from OSR to y scratch register
.wrap_target
set pins, 0 ; Zero RGB pins in blanking
mov x, y ; Initialize counter variable
wait 1 irq 1 [3] ; Wait for vsync active mode (starts 5 cycles after execution)
colorout:
pull block ; Pull color value
out pins, 3 [2] ; Push out to pins (first pixel)
out pins, 3 [1] ; Push out to pins (next pixel)
jmp x-- colorout ; Stay here thru horizontal active mode
.wrap
Then, I try drawing a white rect and it only fills 1/4 of the screen. I would expect it to be full screen.
fillRect(0, 0, 319, 239, WHITE);
Drawing a single pixel is obviously still a 640x480 pixel.
What am I doing wrong?
Thanks!
Sorry for the delay! In fact, my good friend Bruce recently made precisely this modification. Here's a link to his code: https://people.ece.cornell.edu/land/courses/ece4760/RP2040/C_SDK_vga256/index_vga_256.html
Thank you for responding!
I was able to achieve it as well (using 64 colors which is what I wanted). I went a different route than Bruce did but I will certainly look at his example as well.
My version uses a framebuffer in the following horizontal resolutions:
640, 320, 160, 80, 40
and the following vertical resolutions:
240, 120, 60, 30
I know it sounds silly, but a 40x30 resolution with 64 colors really puts off that "Apple II" graphics vibe that I like. :-)
Any of the horizontal and vertical resolutions can be mixed for some really weird combinations.
Looks awesome!