fvdhoef / vera-module

Versatile Embedded Retro Adapter
MIT License
107 stars 44 forks source link

Feature Request: add support for 240p #42

Open jburks opened 1 year ago

jburks commented 1 year ago

This request originates from Adrian Black. This causes old "Arcade" monitors (and the venerable Commodore 1084) to skip painting odd scanlines producing a visible raster line effect very reminiscent of early displays.

The attached sample was rendered on a VERA that I had modified to render 240p. image

jburks commented 1 year ago

The proposed mechanism to support this is to re-purpose the lower 4 bits of the DC_VIDEO register in a backwards compatible way.

Here is an initial proposal I have come up with which retains backwards compatibility with the Output Mode and Chroma Enable bits:

DC_VIDEO mode bits

Bit | Description
----+------------------------------------------------
 0  | RGB mode (0=luma/chroma, 1=RGB)
 1  | Sync mode (0=separate, 1=composite)
 2  | Monochrome Flag (0=color, 1=monochrome)
 3  | Line mode Flag (0=480, 1=240)

Mode Bits | Mode Description
 LMCR     |
----------+-----------------------------------------
 0000     | Off
 0001     | VGA 480p
 0010     | Composite 480i
 0011     | 15KHz RGB 480i composite sync
 0100     |
 0101     |
 0110     | Composite 480i Monochrome
 0111     | 15KHz RGB 480i composite sync
 1000     |
 1001     | 15KHz RGB 240p separate sync
 1010     | Composite 240p
 1011     | 15KHz RGB 240p composite sync 
 1100     |
 1101     | 
 1110     | Composite 240p Monochrome
 1111     |
misterblack1 commented 1 year ago

This also applies to Composite/S-Video output modes

misterblack1 commented 1 year ago

Small correction Joe: the VERA still paints both odd and even scan lines, but it does them in a way that instructs the display to not shift down half a line. This results in it drawing exactly over the previous field, resulting in a 59.5hz progressive scan image. If you do try to display something using 480 lines, it will paint both fields on top of each other, resulting in noticeable flicker.

Also, any use of V-scaling to shrink the image vertically will result in visible flicker. (Along with scaling artifacts)

jburks commented 1 year ago

Small correction Joe: the VERA still paints both odd and even scan lines, but it does them in a way that instructs the display to not shift down half a line. This results in it drawing exactly over the previous field, resulting in a 59.5hz progressive scan image. If you do try to display something using 480 lines, it will paint both fields on top of each other, resulting in noticeable flicker.

One of the community members on Discord has already come up with an idea for using this effect as a temporal dither to get interesting color effects.