Full RGB image to DOS CGA and EGA

User projects written in or related to FreeBASIC.
Pim Scheffers
Posts: 45
Joined: Jun 29, 2014 17:15

Full RGB image to DOS CGA and EGA

Postby Pim Scheffers » Sep 15, 2019 21:11

I would like to share a small program using FBImage that can convert all images (full RGB) in a folder
to a CGA and EGA representation by matching / assigning colours.

See the source folder in the .zip for results.

Have fun :-)

b.t.w compiled under Linux.
For Windows replace the "/" in the source for "\" and recompile.

https://1drv.ms/u/s!ArvnuLSK5obmgq8LJZv ... Q?e=ruU2Ie
badidea
Posts: 1585
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Full RGB image to DOS CGA and EGA

Postby badidea » Sep 15, 2019 22:17

All nice, but CGA and EGA, that is a quite long ago. 25 years?

Anyway, I thought that freebasic automatically converts "/" to "\" (and the other way around?) for file usage depending on the OS.
MrSwiss
Posts: 3307
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Full RGB image to DOS CGA and EGA

Postby MrSwiss » Sep 15, 2019 22:25

badidea wrote:Anyway, I thought that freebasic automatically converts "/" to "\" (and the other way around?) for file usage depending on the OS.
Well, not quite, it's as follows (OS specific, nothing to do with FB):
Windows can handle "\" and "/" likewise.
DOS/Linux need them OS-specific. (DOS only "\", Linux only "/")
caseih
Posts: 1386
Joined: Feb 26, 2007 5:32

Re: Full RGB image to DOS CGA and EGA

Postby caseih » Sep 16, 2019 1:50

badidea wrote:All nice, but CGA and EGA, that is a quite long ago. 25 years?

The retrocomputing scene is a live and well they use and love all those old video modes and old computerse. The 8-Bit Guy recently released a game that has pretty good graphics for CGA as seen in the screenshot below. Although few games ever used it because not every CGA card had composite output, if you used composite output with a CGA graphics card you could do some decent graphics with more than 4 colors:
Image
I really wish I would have known about this when I was young and had a CGA card with a composite monitor.

Off topic, but if you want to see what an original IBM PC with an original IBM CGA graphics card could do, some guys made a really cool demo last year: https://www.youtube.com/watch?v=hNRO7lno_DM
marcov
Posts: 2793
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Full RGB image to DOS CGA and EGA

Postby marcov » Sep 16, 2019 11:02

The CGA algorithm just screams for SSE expansion.

1. load 4 pixels ( 8 bytes, AVX2 could do 8 at once)
2. and mask the alpha bytes to 0
3. expand them (punpacklow and -hiw or so) to two register word values.
4. phaddw them horiztontally together. (adds two color values)
5. phaddw again.
6 divide by 3
7 pack to byte
8 shift by 6 bits
9 use the resulting 0..3 bit values as index for shufpd to get color values. For this you need a 16-byte XMM register loaded with the four cga color values
10 store.

Still quite some steps though.

Note that the 8-bit guy for his own new "commander x16" is going with a much more potent FPGA based graphics though.
badidea
Posts: 1585
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Full RGB image to DOS CGA and EGA

Postby badidea » Sep 16, 2019 17:42

caseih wrote:The 8-Bit Guy recently released a game that has pretty good graphics for CGA as seen in the screenshot below.

I prefer the the 256-color mode:
Image
caseih
Posts: 1386
Joined: Feb 26, 2007 5:32

Re: Full RGB image to DOS CGA and EGA

Postby caseih » Sep 17, 2019 2:37

Yes I remember being dazzled by 256-color VGA graphics too!

I'm still amazed at what was done on limited hardware like CGA, though. I guess at the time we never quite saw it's full potential.

The Commander-X16 looks really interesting too! I might have to buy one when it is made into a product eventually.
Pim Scheffers
Posts: 45
Joined: Jun 29, 2014 17:15

Re: Full RGB image to DOS CGA and EGA

Postby Pim Scheffers » Sep 17, 2019 5:03

He is already selling the game.
https://m.youtube.com/watch?v=wCx32lrBSNQ
caseih
Posts: 1386
Joined: Feb 26, 2007 5:32

Re: Full RGB image to DOS CGA and EGA

Postby caseih » Sep 17, 2019 14:36

Yes that's what I said a few posts back.

Commander-X16 is a completely different thing. It's a hardware prototype of an 8-bit computer they he plans to sell to 8-bit enthusiasts. It's like an Apple II or Commodore 64, but without some of the quirks these old designs had. Will have BASIC built into the ROM of course (classic BASIC not like FB). And a built-in assembler IDE of sorts.
marcov
Posts: 2793
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Full RGB image to DOS CGA and EGA

Postby marcov » Sep 17, 2019 14:41

caseih wrote:Yes that's what I said a few posts back.

Commander-X16 is a completely different thing. It's a hardware prototype of an 8-bit computer they he plans to sell to 8-bit enthusiasts. It's like an Apple II or Commodore 64, but without some of the quirks these old designs had. Will have BASIC built into the ROM of course (classic BASIC not like FB). And a built-in assembler IDE of sorts.


The graphics and maybe even sound would touch Amiga levels even.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest