IBM's CGA and the Commodore 128's RGB video output both use a DE-9 connector. How do I adapt the CGA video output from an IBM XT 5160 or Commodore 128 to a modern monitor?
One strategy is to convert the digital to analog, then the analog to VGA.
CGA consists of digital red, green, blue, and intensity (RGBI) 5V signals, plus horizontal (15.75 kHz) and vertical (59.92 Hz) sync. VGA consists of analog red, green and blue signals (0.7V peak to peak), plus horizontal (31.46875 kHz) and vertical (59.94 Hz) sync (RGBHV).
The first step is to convert digital RGBI to analog RGB. This can be done with a simple resistor ladder. The GGLabs CGA2RGB does this conversion, fixes the impedence, and adds composite sync (CSync) to the output.
The GBS-8200 claims to support CGA as input (which implies digital RGBI), but in reality it only supports analog RGB, and it only supports RGBS (using CSync, not HVSync) on signals below VGA frequencies.
The next and final step is to convert HSync from 15.75 kHz to 31+ kHz. A small list of LCD monitors support 15 kHz analog RGB signals directly, but most require something like a GBS-8200, OSSC, or Framemeister XRGB-Mini to do the HSync conversion.
Edit 2018-12-14: See Stephen Kitt's answer above for a new all-in-one solution called the MCE2VGA.
The easiest approach is probably to convert to a component video signal. If you pass the R, G, B, and I signals through a couple inverting buffers (so you have buffered versions of complemented and non-complemented signals) and formulated a composite sync signal, you could then use resistor dividers to generate Y, U, and V signals which could be fed into a component video input. Component video is allowed to operate down to 15.75Khz, though some monitors may not be totally happy with a non-interlaced signal at that frequency. Producing the composite sync might be as simple as passing the vertical and horizontal sync signals through an XOR gate, or perhaps just using the horizontal sync signal alone (some devices might output a composite sync signal on the horizontal sync pin). Alternatively, some devices that use the 9-pin connector output a composite video signal on pin 7. This is apt to be of very poor quality, but should have an acceptable sync signal.
If you have a genuine CGA card, it should have a composite video output. I would recommend simply using that. For one, lots of devices still have a composite input, and the cables are very common. One thing that's often forgotten is that, for graphics, CGA composite video looks much better than CGA's notoriously horrible digital graphics. Games written when CGA was common actually look about as good as contemporary Apple and Commodore computers did. Of course, the digital output produced much sharper text.
There are a number of composite-to-HDMI adapters on the market (example, not an endorsement, just the first one I found) which will hopefully produce much nicer looking graphics than converting the digital output. You might even get lucky and get legible text out of your HDMI converter.
I suspect that if you plug the CGA composite output into a monochrome composite monitor you'll get nice sharp text as well.
In case you aim for a single box to convert digital RGB video to HDMI, there's boxes around like this that converts from SCART (which is RGB) to HDMI. I use one somilar to the one in the link to connect most of my old comuters (Sinclair Spectrum and QL) to a modern HDMI monitor. If your monitor has USB connectors, you can also conveniently power the converter from there. This gives a nice sharp picture.