How to tweak CGA / EGA game palettes easily :)

Having problems with a specific game or application? Post your problems here!

How to tweak CGA / EGA game palettes easily :)

Postby VileRancour » 2011-3-06 @ 15:13

Something fun that I came across, maybe this will be interesting to some (I remember there was some talk about hacking different palettes for CGA games)

I've found this public domain utility here:
http://cd.textfiles.com/microhaus/mhbla ... GCOLOR.ZIP (documentation and source included)

This is an EGA palette changer that lets you remap each of the 16 onscreen colors to a value from the full 6-bit EGA palette.
But in contrast to other similar programs, your tweaks survive through mode changes, and they appear to affect 4-color CGA modes as well.

This works in DOSBox 0.74 with machine type ega and "up". I don't know if it really works that way on a real EGA card - perhaps someone would be interested in testing it... maybe this behavior is just an artifact of emulation. But anyway it works, and you get to play around with those ugly old palettes!

Easy to use, check the doc/source. You just remap colors 0-3 for CGA modes, and 0-15 for EGA. (Note that the target color values are EGA palette values, not CGA, so for example bright red is 60, not 12)

Downsides:

1. In low-res modes, you're stuck with the basic 16-color CGA palette (this is standard EGA behavior). If you remap to a color outside this palette, it seemes to get mapped to something "close enough"
2. For CGA modes - all other palette changes will be ignored, your custom palette will be the only one you'll get
3. For EGA modes - changing color 15 (high-intensity white) doesn't seem to work, at least in DOSBox

Sample DOSBox screenshots:

Image Image

ALLEY CAT - LEFT: original CGA palette; RIGHT: almost as ugly, but with 4 brand new colors

Image Image

LODE RUNNER - LEFT: original CGA palette; RIGHT: grey, red, bright green, bright blue

Image Image

MONUMENTS OF MARS - LEFT: original CGA palette; RIGHT: "inverted greyscale" palette

Image Image

SPACE COMMANDERS - LEFT: original CGA palette; RIGHT: looking swanky in custom colors

Image Image

CRYSTAL CAVES - LEFT: original EGA palette; RIGHT: with some (not very) clever 16-color tweaking

Image Image

DUKE NUKEM - LEFT: original EGA palette; RIGHT: ...now in ugly CGA colors!
User avatar
VileRancour
Oldbie
 
Posts: 1585
Joined: 2003-5-14 @ 22:11
Location: 1-01-80 0:00a

Re: How to tweak CGA / EGA game palettes easily :)

Postby eL_PuSHeR » 2011-3-06 @ 21:47

Hey. It looks cool. :cool:
User avatar
eL_PuSHeR
Moderator
 
Posts: 6466
Joined: 2003-6-20 @ 16:39

Re: How to tweak CGA / EGA game palettes easily :)

Postby DonutKing » 2011-3-07 @ 00:16

I like the crystal caves one, it looks like an underwater/aquatic style game :)

But what have you done to Duke :O
If you are squeamish, don't prod the beach rubble.
User avatar
DonutKing
Oldbie
 
Posts: 1782
Joined: 2008-1-03 @ 03:23
Location: Australia

Re: How to tweak CGA / EGA game palettes easily :)

Postby VileRancour » 2011-3-07 @ 17:28

Just mapped the 16 colors to CGA-like ones. Actually I don't think that this EGA tool is very useful for 320x200 EGA games (you just get to re-arrange the same 16 colors that you had to begin with), but it's fun for CGA games, which probably wasn't even the intention behind it...

But here's what's funny - I just tested this ChgColor TSR outside of DOSbox, in WinXP's CMD.EXE in full screen mode, and it still works!!! It doesn't change text mode colors (in fact it just slows things down) but running a CGA game produces the same effect.

(Of coruse this isnt useful at all since most CGA games aren't even playable in XP... but it leads me to believe that this program will work in a true DOS machine with an EGA/VGA adapter)

Too bad I can't program assembly... it would've been cool to add hotkeys to cycle between the colors. Or maybe to try doing a VGA version (VGA can customize the palette in 320x200x16, so it's possible you'd get even more colors to choose from)
User avatar
VileRancour
Oldbie
 
Posts: 1585
Joined: 2003-5-14 @ 22:11
Location: 1-01-80 0:00a

Re: How to tweak CGA / EGA game palettes easily :)

Postby garrynichol » 2011-4-02 @ 05:00

Nice stuff. I just wish I could get AnsiPLUS to work IN Dosbox although I already did a workaround.
Let me know if you have any luck. BTY AnsiPLUS is VGA. i can dig up the Authior's name if you want it or hopefully not becuase he might be dead or not.
garrynichol
Newbie
 
Posts: 70
Joined: 2011-2-09 @ 21:07

Re: How to tweak CGA / EGA game palettes easily :)

Postby VileRancour » 2011-4-02 @ 12:09

garrynichol wrote:Nice stuff. I just wish I could get AnsiPLUS to work IN Dosbox although I already did a workaround.
Let me know if you have any luck. BTY AnsiPLUS is VGA. i can dig up the Authior's name if you want it or hopefully not becuase he might be dead or not.


Are you talking about this one? I've never tried it, but a quick search of the forum shows that people have been able to get it to work under dosbox.

If this is it, I'll check it out... looks promising.
User avatar
VileRancour
Oldbie
 
Posts: 1585
Joined: 2003-5-14 @ 22:11
Location: 1-01-80 0:00a

Re: How to tweak CGA / EGA game palettes easily :)

Postby VileRancour » 2011-4-03 @ 15:51

Nope, you're right - Ansiplus doesn't run correctly. I can only assume that it did work in earlier dosbox versions. Anyone who has managed to make it work (by any chance) on 0.74 / current SVN is welcome to post.

I've found some other VGA palette change utilities, but none that work in graphics modes *and* intercept/prevent interrupt requests that would reset the palette (in order to make your changes persistent).

for CGA games (as long as they still run on a VGA), such a utility could also let you to simulate a monochrome CGA monitor (gray/green/amber), with different intensities for shades... there is no native DOSbox support for this, even though these monitors were very common with early PC clones (and even an IBM model or two).
User avatar
VileRancour
Oldbie
 
Posts: 1585
Joined: 2003-5-14 @ 22:11
Location: 1-01-80 0:00a

Re: How to tweak CGA / EGA game palettes easily :)

Postby ripsaw8080 » 2011-4-03 @ 18:59

DOSBox does not fully emulate character devices, so when ANSI drivers try to replace the console device with their own, it doesn't work. However, if you boot real DOS in DOSBox, ANSI drivers should work fine.

INT 29h provides a hook into text output that ANSI drivers make use of, but DOSBox's console device does not send output through INT 29h as real DOS does. The attached TSR program redirects DOS text output functions through INT 29h, which should improve support for most ANSI drivers. I can't say this will make everything in ANSIPLUS work, but you should at least not see unprocessed escape sequences on the screen. Let me know if some specific part isn't working. Source code is included in the archive.
Attachments
INT29.ZIP
(1.24 KiB) Downloaded 622 times
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4162
Joined: 2006-4-25 @ 23:24

Re: How to tweak CGA / EGA game palettes easily :)

Postby VileRancour » 2011-4-04 @ 03:13

Hats off ripsaw - works beautifully! At least AnsiPlus seems to show and function correctly now. Much, much appreciated.

Just played around a bit with its palette functions, to try and make it do what I'm looking for... no real luck so far - AnsiPlus wasn't intended for use with 4-color modes, but even with 16 colors I'm getting some weird/funny results, so I'm probably doing something wrong. Will delve into the docs later on.

Man, if I could only make sense of assembly...
User avatar
VileRancour
Oldbie
 
Posts: 1585
Joined: 2003-5-14 @ 22:11
Location: 1-01-80 0:00a

Re: How to tweak CGA / EGA game palettes easily :)

Postby dr.zeissler » 2015-6-13 @ 17:10

I want to convert VGA 16/256 Color Images to real EGA 16 with 640x350.
How do I generate the EGA-Palette in Programs like PainShopPro5 or PhotoShop5 ?

Currently I downgrade a 256color pic to 64colors with diffusion, after that I reduce to 16 colors with no dithering,
but in background is always the VGA-Palette. I n order to make real EGA-Pics I have to change the Palette.

Any Idea, how to do this?
CPU: PII 133-333 MOBO: SNI-D981 RAM: 512- FDD: Dualfloppy 3,5"HD/5,25"HD - 3,5"HD - 5,25"DD ISA-Catweasel HDD: 2x40GB - DVD
ISA(3): Audician32-S2Dreamblaster - GusACE PCI(3): Monster3D- Intel NW AGP(1): 3dfx V3-3000
dr.zeissler
Oldbie
 
Posts: 1272
Joined: 2011-9-28 @ 15:33

Re: How to tweak CGA / EGA game palettes easily :)

Postby Tertz » 2015-6-28 @ 22:59

dr.zeissler wrote:I want to convert VGA 16/256 Color Images to real EGA 16 with 640x350.

Look at VGA2EGA util. It converted .gif 640x350 to EGA mode
.gif made by Photoshop it may don't like, but after converting such .gif to compuserv format (by ACDSee, for example) it processes them
Tertz
Oldbie
 
Posts: 792
Joined: 2015-1-22 @ 21:44

Re: How to tweak CGA / EGA game palettes easily :)

Postby leileilol » 2015-6-30 @ 05:59

For the Direct3D builds out there you can use this shader to really fake EGA in real-time.

As for a TSR that does this, no idea. and it would probably torture computers of the period if there were one since lookups are expensive
Voodoo2s aren't 100mhz stock
Geforce256 isn't released as a beta on New Years '99 under the Quadro brand
386DX vs SX isn't about a missing FPU
DOS gaming isn't a bilinear 320x200 16:10
DOS PCs aren't better than the Macintosh
Old PCs aren't 'aesthetic'
User avatar
leileilol
l33t++
 
Posts: 9045
Joined: 2006-12-16 @ 18:03

Re: How to tweak CGA / EGA game palettes easily :)

Postby Scali » 2015-6-30 @ 12:27

You can do the same trick on VGA as is done on EGA here: just overwrite the VGA registers which are mapped to the CGA/EGA colours.
Scali
l33t
 
Posts: 3284
Joined: 2014-12-13 @ 14:24

Re: How to tweak CGA / EGA game palettes easily :)

Postby VileRancour » 2015-6-30 @ 13:22

leileilol wrote:As for a TSR that does this, no idea. and it would probably torture computers of the period if there were one since lookups are expensive

I believe it only has to be done once per INT 10 mode set, and not too many registers to modify even then (at least if we're talking CGA modes), so really not that much torture.
I've gotten a little ASM practice since I wrote that post; haven't written any TSRs yet, but maybe that'll be my next exercise...
User avatar
VileRancour
Oldbie
 
Posts: 1585
Joined: 2003-5-14 @ 22:11
Location: 1-01-80 0:00a

Re: How to tweak CGA / EGA game palettes easily :)

Postby Scali » 2015-6-30 @ 15:02

VileRancour wrote:I believe it only has to be done once per INT 10 mode set, and not too many registers to modify even then (at least if we're talking CGA modes), so really not that much torture.


That is correct. It was a common technique to use the full VGA palette in 16-colour modes. 16-colour modes were much faster than 256-colour in various circumstances, because you only had half the memory to process.
My 1991 donut intro uses that trick as well, it runs in mode 0Dh, which is EGA's 320x200 16-colour mode. It actually runs on real EGA as well, but when it detects VGA, it sets up some special VGA palettes (it actually uses palette banking, the logo at the top is a different set of 16 colours than the blue donut at the center, so you get 32 colours on screen).
It probably works the same on CGA modes, although I've never tried (why would you ever want a 4-colour mode when you can have 16 or 256?).
Scali
l33t
 
Posts: 3284
Joined: 2014-12-13 @ 14:24

Re: How to tweak CGA / EGA game palettes easily :)

Postby leileilol » 2015-6-30 @ 19:25

oh, I was thinking the whole dithered processing thing he wanted.
Voodoo2s aren't 100mhz stock
Geforce256 isn't released as a beta on New Years '99 under the Quadro brand
386DX vs SX isn't about a missing FPU
DOS gaming isn't a bilinear 320x200 16:10
DOS PCs aren't better than the Macintosh
Old PCs aren't 'aesthetic'
User avatar
leileilol
l33t++
 
Posts: 9045
Joined: 2006-12-16 @ 18:03

Re: How to tweak CGA / EGA game palettes easily :)

Postby Calvero » 2015-7-03 @ 20:50

Scali wrote:why would you ever want a 4-colour mode when you can have 16 or 256?

John Romero released Pyramids of Egypt in 1990. Most people had a CGA card back then, so he put CGA graphics in his game. When you ran the game on a EGA card, it would still have only 4 colors, but one of the colors was changed to red so he could put blood in his game :cool:
Calvero
Member
 
Posts: 106
Joined: 2007-8-02 @ 13:30

Re: How to tweak CGA / EGA game palettes easily :)

Postby NewRisingSun » 2015-8-02 @ 12:16

Alley Cat will already use custom palettes when run on a PCjr.
NewRisingSun
Oldbie
 
Posts: 781
Joined: 2005-9-02 @ 02:26

Re: How to tweak CGA / EGA game palettes easily :)

Postby Great Hierophant » 2015-8-03 @ 17:54

Alley Cat will also play the opening theme in 3-voice music on a PCjr., but all the in-game sounds will use the PC speaker.

I was only able to extract the executable from the archive link with 7zip, so in order to use this program, you do so like this :

chgcolor 0 1 1 15 2 30 3 63

The first value is the palette entry, the second value is the color value. Program uses decimal numbers from 0-63.
http://nerdlypleasures.blogspot.com/ - Nerdly Pleasures - My Retro Gaming, Computing & Tech Blog
User avatar
Great Hierophant
l33t
 
Posts: 2351
Joined: 2003-4-27 @ 08:20

Re: How to tweak CGA / EGA game palettes easily :)

Postby dr.zeissler » 2015-8-04 @ 05:06

Would be nice, to see an EGA game remapped :)
CPU: PII 133-333 MOBO: SNI-D981 RAM: 512- FDD: Dualfloppy 3,5"HD/5,25"HD - 3,5"HD - 5,25"DD ISA-Catweasel HDD: 2x40GB - DVD
ISA(3): Audician32-S2Dreamblaster - GusACE PCI(3): Monster3D- Intel NW AGP(1): 3dfx V3-3000
dr.zeissler
Oldbie
 
Posts: 1272
Joined: 2011-9-28 @ 15:33

Next

Return to DOSBox Games/Apps

Who is online

Users browsing this forum: No registered users and 2 guests