VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

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

Reply 1 of 3, by Lo Wang

User metadata
Rank Member
Rank
Member

Are you even aware of the differences between the scanlines on a interlaced crt display and the scanlines on a progressive scan crt display (what was commonplace for vga adapters to output to), plus the ridiculous upscaling that will be required? We're talking 2x for interlaced and at least 6x for progressive scan if you want to get it somewhere in the ballpark, at least in theory, because it will look like garbage on a LCD anyways.

"That if thou shalt confess with thy mouth the Lord Jesus, and shalt believe in thine heart that God hath raised him from the dead, thou shalt be saved" - Romans 10:9

Reply 2 of 3, by boxpressed

User metadata
Rank Oldbie
Rank
Oldbie

Edited. Mod can delete.

Last edited by boxpressed on 2015-06-24, 14:52. Edited 1 time in total.

Reply 3 of 3, by Stiletto

User metadata
Rank l33t++
Rank
l33t++
boxpressed wrote:
Here's the site to know if you're interested in buying a hardware solution: […]
Show full quote

Here's the site to know if you're interested in buying a hardware solution:

http://retrogaming.hazard-city.de/

The product to beat is Micomsoft's Framemeister, which is about $350.

You can also buy a scanline generator, like the SLG3000 one below. It should be paired with a quality deinterlacer, like a DVDO iScan. This solution is about $100.

P1110387.jpg

Hehehe, wrong thread. This is the PC Emulation subforum, and the original poster is (attempting to be) an emulator developer 😁

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto