VOGONS


First post, by IanB

User metadata
Rank Member
Rank
Member

I recently started contributing to an open source project first developed by hoglet on the stardot forums, to convert the TTL RGB outputs of the Acorn BBC micro and Electron to HDMI / DVI using a Raspberry Pi Zero and a small CPLD on a 'Hat' PCB. My initial contributions were to get deinterlacing working for the BBC's mode 7 teletext output and also to support genlocking so that the Pi's video output was locked to the source. Original thread here: https://stardot.org.uk/forums/viewtopic.php?f=3&t=14430

These Acorn machines have TTL RGB ouputs similar to CGA and I thought it might be worth trying to get it working on such sources. After a lot of code optimisation in ARM assembler and reworking the CPLD, we now have it working with MDA / CGA / EGA type sources and also with monochrome non-TTL sources like the ZX80/ZX81, Apple II, UK101 using a small external circuit to extract the sync and video.

Here is a photo of the adapter:

case2.jpg
Filename
case2.jpg
File size
196.98 KiB
Views
7979 views
File license
Fair use/fair dealing exception

The system will work up to VGA frequencies with 6 bits/pixel although you need a card that will output VGA over TTL 9 pin D-type or an EGA+ type card to use those high resolutions and it is menu driven with multiple profiles stored on SD card so you can tweak any of the parameters like clock frequency, line length, size etc to support any number of non-standard outputs. Also it will autoswitch between all the profiles in a "switching set" and you can have multiple switching sets.

One interesting option that it supports is integer scaling where the original pixels of the source are scaled to an exact multiple of pixels on the LCD panel without any interpolation filter which makes the output look very sharp like it's at the native resolution of the panel. The disadvantage is that the image won't completely fill the screen but the quality difference is so great it is well worth it. (You can select normal interpolation to fill the screen if preferred).

Normal scaling with interpolation (view full size):

interpolated.jpg
Filename
interpolated.jpg
File size
670.73 KiB
Views
7979 views
File license
Fair use/fair dealing exception

Integer scaling (view full size):

integer.jpg
Filename
integer.jpg
File size
687.17 KiB
Views
7979 views
File license
Fair use/fair dealing exception

There is an option to screencap the displayed output to the Pi's SD card so here are some more examples captured in this way.
If you view these at 100% on a 1080p monitor you will see the exact quality you get from the output using integer scaling:
(Click on the thumbnails then click again on the images to get them at 100%)

EGA 640x200 60Hz:

egakeen.png
Filename
egakeen.png
File size
29.95 KiB
Views
7979 views
File license
Fair use/fair dealing exception

CGA 640x200 60Hz:

cgamaniac.png
Filename
cgamaniac.png
File size
15.93 KiB
Views
7979 views
File license
Fair use/fair dealing exception
Last edited by IanB on 2019-04-02, 01:15. Edited 6 times in total.

Reply 1 of 53, by IanB

User metadata
Rank Member
Rank
Member

I've just started working on NTSC artifact colours:

cgaartifactmaniac.png
Filename
cgaartifactmaniac.png
File size
18.75 KiB
Views
7978 views
File license
Fair use/fair dealing exception

640x200 60Hz ega:

egamaniac.png
Filename
egamaniac.png
File size
16.08 KiB
Views
7978 views
File license
Fair use/fair dealing exception

EGA text 640x350 60Hz:

egatext.png
Filename
egatext.png
File size
21.64 KiB
Views
7978 views
File license
Fair use/fair dealing exception

CGA 640x200 60Hz:

cga.png
Filename
cga.png
File size
13.29 KiB
Views
7978 views
File license
Fair use/fair dealing exception

VGA 640x480 60Hz:

vga win311.png
Filename
vga win311.png
File size
18.15 KiB
Views
7978 views
File license
Fair use/fair dealing exception
Last edited by IanB on 2019-04-01, 22:00. Edited 1 time in total.

Reply 2 of 53, by IanB

User metadata
Rank Member
Rank
Member

These captures show a couple of the menus:

main menu.png
Filename
main menu.png
File size
14.62 KiB
Views
7976 views
File license
Fair use/fair dealing exception
geometry.png
Filename
geometry.png
File size
16.47 KiB
Views
7976 views
File license
Fair use/fair dealing exception

It's still a work in progress but I don't have any original MDA CGA or EGA cards, just a couple of 'universal' cards that can be switched to all resolutions with DIP switches so maybe someone would like to help out with testing that.

Last edited by IanB on 2019-04-01, 23:03. Edited 1 time in total.

Reply 3 of 53, by keropi

User metadata
Rank l33t++
Rank
l33t++

this is all very interesting, how can I build this to test? I've made some tests with the mce2vga adapter , you can read the thread here if you haven't already : MDA/CGA/EGA to VGA Converter Released! , if there is any way to contribute to testing do tell!
The profiles and proper scaling sound and look just awesome. 😎

Is it possible to add a scanlines effect as well?

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 4 of 53, by IanB

User metadata
Rank Member
Rank
Member
keropi wrote:

this is all very interesting, how can I build this to test?

The PCB design and code are on github
This is my fork:
https://github.com/IanSB/RGBtoHDMI/tree/dev
This is hoglet's original (my changes are usually merged back in)
https://github.com/hoglet67/RGBtoHDMI/tree/dev
(All the current work is in the dev branch at the moment)

keropi wrote:

if there is any way to contribute to testing do tell!

Do you want to build one yourself? I still have a few prototype pcbs
Construction details here:
https://github.com/hoglet67/RGBtoHDMI/wiki/Bill-of-Materials

Note the current PCB was designed for the BBC micro which has composite sync and 3 bits RGB so had to be reworked slightly to connect the separate H and V sync and 6 bits RGB:

extrabits.jpg
Filename
extrabits.jpg
File size
316.79 KiB
Views
7956 views
File license
Fair use/fair dealing exception

There will be a new pcb design sometime fairly soon which will be more universal.

keropi wrote:

Is it possible to add a scanlines effect as well?

Yes although it can interact with the integer scaling depending on monitor size and source resolution. In the case of CGA/EGA 640x200 on a 1080p monitor below, there are 2 LCD pixels of video and 3 pixels of black for each line pair: (Make sure to zoom to 100%)

scanlines.png
Filename
scanlines.png
File size
27.64 KiB
Views
7956 views
File license
Fair use/fair dealing exception

If there are any unevenness issues with integer scaling and scanlines you can always switch on interpolation.

One other feature I forgot to mention is that it supports reprogramming of the output palette by displaying specific patterns of pixels which are unlikely to occur with normal operation as they look like random noise. (Although this feature can be disabled in case something triggers it accidentally)

This was primarily for use on the BBC micro to do things like change this:

RawRGB.png
Filename
RawRGB.png
File size
18.43 KiB
Views
7956 views
File license
Fair use/fair dealing exception

Into this:

palette.png
Filename
palette.png
File size
16.2 KiB
Views
7956 views
File license
Fair use/fair dealing exception

But a DOS command line tool could be written to change the palettes on old CGA games to something less garish.

Last edited by IanB on 2019-04-02, 01:13. Edited 2 times in total.

Reply 5 of 53, by IanB

User metadata
Rank Member
Rank
Member

For comparison, here's a closeup of scanlines with interpolation switched on to even out the 3:2 lines:

interpolation.jpg
Filename
interpolation.jpg
File size
675.85 KiB
Views
7953 views
File license
Fair use/fair dealing exception

(The Pi can't screencap the interpolated output as that's done in hardware by the Pi's GPU)

Reply 6 of 53, by keropi

User metadata
Rank l33t++
Rank
l33t++

looking good! I have to ask , what kind of latency is there with this adapter?
still very interested to test this, soldering/modifications are no issue 😀

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 7 of 53, by IanB

User metadata
Rank Member
Rank
Member
keropi wrote:

looking good! I have to ask , what kind of latency is there with this adapter?

When the input and output frame rates match and they are genlocked together (e.g. CGA/EGA 60Hz to 1080p60), the phase relationship is arranged so that the source video is written to the Pi's frame buffer approx 1ms before it's read out by the Pi's display hardware so the inherent delay of the capture system is aroud one or two milliseconds. However, I'm not sure if there is any further delay introduced by the Pi's display hardware but that delay would affect anything running on a Pi in the same way.
If the input and output frame rates don't match or genlock is switched off then you can enable multiple buffering to eliminate tears but that does introduce a frame's delay for each buffer (normally this is not used).

Last edited by IanB on 2019-04-02, 11:19. Edited 1 time in total.

Reply 8 of 53, by root42

User metadata
Rank l33t
Rank
l33t

I would also be interested in a prototype PCB. Just need BOM and instructions on how to mod it for EGA usage.

YouTube and Bonus
80486DX@33 MHz, 16 MiB RAM, Tseng ET4000 1 MiB, SnarkBarker & GUSar Lite, PC MIDI Card+X2+SC55+MT32, OSSC

Reply 10 of 53, by IanB

User metadata
Rank Member
Rank
Member

One caveat about the integer scaling: It only really works well on 1920x1080, 1920x1200 and 1600x1200 monitors as there have to be enough LCD pixels to fit the integer scaled output.
e.g. CGA and EGA lores scale from 640x200 to 1280x1000, EGA hires scales from 640x350 to 1280x1050, MDA scales from 720x350 to 1440x1050 and VGA scales from 640x480 to 1280x960 which all fit nicely into the above resolutions with minimal borders. Below those resolutions, integer scaling is less useful as you mostly end up with large borders and wrong aspect ratios.

You can make CGA/EGA lores work at 1280x1024 but there can be a problem because the text and graphics versions of some modes can shift horizontally by a few pixels so if you are configured to capture exactly 640 pixels one or the other will get a few pixels cut off. There are two ways around this, one is to capture more than 640 pixels such as 648 pixels but then the 2x integer scaling for that is 1296 so it won't fit and the other is to adjust the capture position each time there is a change from text to graphics and back again. I might add that adjustment to the existing built in auto calibration function.

Reply 11 of 53, by IanB

User metadata
Rank Member
Rank
Member
keropi wrote:

what kind of latency is there with this adapter?

I just figured out a way to test this exactly:
I connected a HDMI to VGA converter lead to the HDMI output and then wrote a program to flash the screen briefly.
The VGA converter lead is just a simple D to A converter and doesn't introduce much delay itself.
I then looked at one of the RGB inputs (from the computer) and one of the RGB outputs from the HDMI to VGA lead on a scope and it shows the total delay is 2.4 milliseconds:
(Yellow is the computer RGB source, Cyan is the output of the converter)

Converter Lag.png
Filename
Converter Lag.png
File size
44.71 KiB
Views
7847 views
File license
Fair use/fair dealing exception

I think roughly half of the delay is due to the capture side and the other half is the Pi's scaler.

Reply 12 of 53, by keropi

User metadata
Rank l33t++
Rank
l33t++

that's a very nice and low latency - almost nothing considering the frameister has ~20ms of processing lag

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 13 of 53, by IanB

User metadata
Rank Member
Rank
Member

I've added variable intensity scanlines from 0 - 15 with 0 = black and 15 = about 94% of full brightness. I also switched around the integer heights so there are 3 pixels of video and 2 pixels of scanline although that evens out if interpolation is switched on.

Here is the integer version with level set to 6:

Newscanlines.png
Filename
Newscanlines.png
File size
49.31 KiB
Views
7753 views
File license
Fair use/fair dealing exception

Here's a closeup with interpolation switched on:

interpolation scanlines.jpg
Filename
interpolation scanlines.jpg
File size
762.8 KiB
Views
7753 views
File license
Fair use/fair dealing exception

Reply 14 of 53, by keropi

User metadata
Rank l33t++
Rank
l33t++

another great move, these scanlines are better looking IMHO!

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 15 of 53, by dreamblaster

User metadata
Rank Oldbie
Rank
Oldbie

looks great, i'd like to try it, will pm you !

Visit http://www.serdashop.com for retro sound cards, video converters, ...
DreamBlaster X2, S2, S2P, HDD Clicker, ... many projects !
New X2GS SE & X16GS sound card : https://www.serdashop.com/X2GS-SE ,
Thanks for your support !

Reply 16 of 53, by xmamat

User metadata
Rank Newbie
Rank
Newbie

Hello Ian,

Would that be possible to order a couple of these without going through stardot.org.uk?
I'm personalty not (yet) into Acorn, having started recently in vintage computers and still sticking to the PC area for now. So it'll be inappropriate to subscribe to that other forum just to order from you...

Last edited by xmamat on 2020-12-21, 11:42. Edited 3 times in total.

Reply 17 of 53, by pentiumspeed

User metadata
Rank l33t
Rank
l33t

Vram is a N number of bytes of information can give any pixels at any frequencies, underststand this and in theory: emit any resolutions at any frequencies that how MCGA did to use VGA signal for example.

Ideal is capture the video output into ram and at same time shared bus with a modern GPU-like hardware without video timing and use this vram window at any timings to output letterboxed 1080p. This what dosbox does on modern PC in software.

Cheers,

Great Northern aka Canada.

Reply 18 of 53, by brostenen

User metadata
Rank l33t++
Rank
l33t++

Nice to see that there are a tread, specifically for the general version of the internal Amiga adaptor that I have. I honestly did not know that it is here on Vogons.

Don't eat stuff off a 15 year old never cleaned cpu cooler.
Those cakes make you sick....

My blog: http://to9xct.blogspot.dk
My YouTube: https://www.youtube.com/user/brostenen

001100 010010 011110 100001 101101 110011