First post, by superfury
How do I make the output of my VGA emulation (a simple buffer of, for example 640x480 pixels including border and overscan pixels already rendered) look like actual VGA output (scanlines)? I've read somewhere that I just need to clear every even or odd scanline (simply change every even/odd scanline to black (RGBA=0x00000000)?
Do I change the VGA scanlines to black (So pixel row 1, 3, 5, 7, 9 etc from the framebuffer of my emulated VGA) or do I change the output even or odd scanlines to black (when drawing the VGA output (including double scanlines etc., depending on the VGA register settings)) before resizing it to the output renderer (SDL framebuffer in this case)?
So is it (with VGA double buffering):
Black scanline'
VGA Scanline #0
Black scanline
VGA Scanline #0 (double scanned)
Black scanline
VGA Scanline #1
Black scanline
VGA Scanline #1(double scanned)
...
Or is it (with VGA double buffering):
Black scanline
VGA scanline #0
VGA scanline #0 (double scanned)
Black scanline
VGA scanline #1
VGA scanline #1 (double scanned)
Black scanline
...
How do I convert the VGA output to display on a LCD? Do I need to insert black scanlines after each SDL framebuffer scanline, VGA framebuffer scanline? Or do I simply blank every even/odd SDL framebuffer scanline or every even/odd VGA framebuffer scanline?
In my emulation, the VGA is rendered like this:
1. Draw VGA lines from the emulated VRAM to the emulation display buffer (Actual VGA output including blanking, overscan and retraced output).
(after a VTotal has been reached:)
2. Draw the emulation display buffer to the main video layer (using horizontal or vertical resizing, set by the VGA registers), centered and/or stretched to fit the actual screen (480x272 pixels, except when direct rendering option is enabled in the settings, which makes the display in Windows equal the actual VGA resolution (like converting 640x480 output to windows 1:1 pixel rendering, with a window of 640x480 pixels).
3. Draw any text surfaces (drawn using the 8x8 VGA font with border) on the output buffer.
4. Draw the output buffer on the emulated screen (by flipping the surface if needed, or letting SDL draw the image on screen in the case of the 480x272 Sony PSP's display).
So my questions:
1. Is this step (the scanline transformation to look like actual scanlines on a LCD display) executed after step 1(50% of the VGA VRAM generated scanlines become black) or 2(always 50% of the screen black)?
2. Do I simply blank every even or odd scanline or insert a blank scanline after each scanline?
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io