VOGONS


First post, by Jinxter

User metadata
Rank Member
Rank
Member

PalSwap — Custom CGA Palettes on EGA/VGA (DOS TSR)

PalSwapT installs as a TSR (~2 KB resident) and remaps CGA pixel values to custom colours by reprogramming the VGA DAC or EGA ATC registers. It hooks INT 10h so that every time a game sets CGA mode 4/5, your palette is automatically re-applied. No patching, no game modifications — just load PalSwapT before your game and go.

Features

  • Works on any EGA or VGA card (auto-detected)
  • 9 built-in presets: Arcade Vibrant, Sierra Natural, C64-inspired, CGA Red/Green/White, CGA Red/Blue/White, Amstrad CPC, Pastel, Monochrome Amber, Monochrome Green
  • Load custom palettes from text files (simple R,G,B format, 0–63 per channel)
  • Multi-palette files: load up to 9 palettes and switch between them live
  • Set colours by name on the command line (all 16 CGA colour names supported)
  • Brightness, saturation, and "Pop" modifiers
  • Survives game mode resets — no need to reload after the game switches video modes
  • Live reload — re-run PalSwapT with new arguments to update the resident copy without uninstalling
  • Clean uninstall with /U

Live Hotkeys (while TSR is resident)

Hold Ctrl+Alt and press:

  • 1–9: Switch to preset 1–9
  • P: Toggle Pop (saturation + contrast boost)
  • R: Reset to default CGA palette
  • Up/Down: Brighten / Dim
  • Left/Right: Adjust saturation
  • Space: Random palette from 15 CGA colours
  • C: Random palette from Commodore 64 colours
  • A: Random palette from Amstrad CPC colours (27-colour hardware palette)
  • Z: Random palette from ZX Spectrum colours

This means you can sit in a game and just keep hitting Ctrl+Alt+Space (or C, A, Z) until you find a colour combination you like. It's a surprisingly fun way to rediscover old games.

Included Platform Palette Files

Three ready-made 9-palette text files are included, each using verified colours from Lospec.com:

  • C64.TXT — Commodore 64 palette (16 colours)
  • ZX.TXT — ZX Spectrum palette (15 colours, normal + bright)
  • CPC.TXT — Amstrad CPC palette (27 colours, 3 intensity levels)

Load one with e.g. [tt]PALSWAPT C64.TXT[/tt] and then Ctrl+Alt+1..9 switches between 9 curated palette combinations during gameplay.

Quick Examples

PALSWAPT /1                          ; Install with Arcade Vibrant preset
PALSWAPT /3 /P ; C64-inspired with pop boost
PALSWAPT /c:blue,red,white ; Custom colours by name
PALSWAPT /c:cyan,magenta,yellow /b:darkgray ; Custom + background
PALSWAPT C64.TXT ; Load 9 C64 palette combos
PALSWAPT /8 ; Monochrome Amber
PALSWAPT /U ; Uninstall

Typical Workflow

PALSWAPT /3         ; Install with C64 preset
ZAXXON ; Run game — custom colours applied automatically
; Ctrl+Alt+Space = random CGA colours
; Ctrl+Alt+C = random C64 colours
; Ctrl+Alt+1..9 = switch presets
PALSWAPT /U ; Uninstall when done

How It Works (Technical Summary)

On VGA: PalSwapT disables default palette loading on mode set (INT 10h AX=1201h BL=31h), remaps ATC registers 0–3 to conflict-free DAC entries, and fills all 16 DAC entries covering every CGA palette variant. This means it works regardless of which CGA palette variant the game selects (palette 0/1, high/low intensity).

On EGA: Converts user RGB values to the nearest EGA 6-bit colour and programs all 16 ATC registers directly.

The keyboard hook (INT 09h) checks BIOS shift flags at 0040:0017h for Ctrl+Alt. When both are held, scan codes are matched against the hotkey table. Non-hotkey keys pass through to the original handler, so normal gameplay input is not affected.

Non-TSR Version

A simpler non-TSR version ([tt]palswap.com[/tt]) is also included for one-shot palette changes — useful if you don't need hotkeys or mode-set hooking.

Compatibility

Tested on 286 with Trident TVGA9000i-3 and 486 with VGA. Should work on any EGA or VGA system running DOS in real mode. The palette text file format is compatible with PC1PAL (my palette loader for the Olivetti Prodest PC1 / AT&T PC6300).

Downloads & Source

GitHub: https://github.com/RetroErik/PalSwap

YouTube

I've made a couple of videos demonstrating PalSwapT in action:

I'd love to hear your thoughts, suggestions, and any compatibility reports.

Check out my YouTube channel: Retro Erik https://www.youtube.com/c/RetroErik
My collection: https://retro.hageseter.com
X: https://x.com/Retro_Erik

Reply 1 of 11, by mbsystem

User metadata
Rank Newbie
Rank
Newbie

Thanks for your work. It allowed me to generate .pal files usable by other softwares under DOS, though C64.pal and ZX.pal are not perfects.

Reply 2 of 11, by mbsystem

User metadata
Rank Newbie
Rank
Newbie

VGAMAX 2.0 by Christopher Antos in 1991 was already capable of changing palettes under DOS, CGA included.

Reply 3 of 11, by Grzyb

User metadata
Rank l33t
Rank
l33t

Seems similar to this - CGA4VGA - correcting/altering CGA graphic modes colors on VGA

I'm still dreaming about a V86 CGA emulator, which would make palette-switching effects work.
V86 Hercules emulator would also be nice.

In 2003, I voted in favour of joining the European Union. However, due to recent developments - especially the restrictions on cash usage - I'm hereby withdrawing my support. DOWN WITH THE EU!

Reply 4 of 11, by mbsystem

User metadata
Rank Newbie
Rank
Newbie

.Pal updated !

Reply 6 of 11, by AirIntake

User metadata
Rank Member
Rank
Member

I wish I would have known about this 35 years ago! The ugliness of the usual cyan/magenta/white palette turned me off of many CGA games when I got my first PC even though they still had good gameplay. This is like getting a Super Game Boy for CGA games.

Casio BE-300 Advancement Society (be300.org) alumni

Reply 7 of 11, by theelf

User metadata
Rank Oldbie
Rank
Oldbie
Jinxter wrote on 2026-04-03, 11:17:
PalSwap — Custom CGA Palettes on EGA/VGA (DOS TSR) […]
Show full quote

PalSwap — Custom CGA Palettes on EGA/VGA (DOS TSR)

PalSwapT installs as a TSR (~2 KB resident) and remaps CGA pixel values to custom colours by reprogramming the VGA DAC or EGA ATC registers. It hooks INT 10h so that every time a game sets CGA mode 4/5, your palette is automatically re-applied. No patching, no game modifications — just load PalSwapT before your game and go.

Features

  • Works on any EGA or VGA card (auto-detected)
  • 9 built-in presets: Arcade Vibrant, Sierra Natural, C64-inspired, CGA Red/Green/White, CGA Red/Blue/White, Amstrad CPC, Pastel, Monochrome Amber, Monochrome Green
  • Load custom palettes from text files (simple R,G,B format, 0–63 per channel)
  • Multi-palette files: load up to 9 palettes and switch between them live
  • Set colours by name on the command line (all 16 CGA colour names supported)
  • Brightness, saturation, and "Pop" modifiers
  • Survives game mode resets — no need to reload after the game switches video modes
  • Live reload — re-run PalSwapT with new arguments to update the resident copy without uninstalling
  • Clean uninstall with /U

Live Hotkeys (while TSR is resident)

Hold Ctrl+Alt and press:

  • 1–9: Switch to preset 1–9
  • P: Toggle Pop (saturation + contrast boost)
  • R: Reset to default CGA palette
  • Up/Down: Brighten / Dim
  • Left/Right: Adjust saturation
  • Space: Random palette from 15 CGA colours
  • C: Random palette from Commodore 64 colours
  • A: Random palette from Amstrad CPC colours (27-colour hardware palette)
  • Z: Random palette from ZX Spectrum colours

This means you can sit in a game and just keep hitting Ctrl+Alt+Space (or C, A, Z) until you find a colour combination you like. It's a surprisingly fun way to rediscover old games.

Included Platform Palette Files

Three ready-made 9-palette text files are included, each using verified colours from Lospec.com:

  • C64.TXT — Commodore 64 palette (16 colours)
  • ZX.TXT — ZX Spectrum palette (15 colours, normal + bright)
  • CPC.TXT — Amstrad CPC palette (27 colours, 3 intensity levels)

Load one with e.g. [tt]PALSWAPT C64.TXT[/tt] and then Ctrl+Alt+1..9 switches between 9 curated palette combinations during gameplay.

Quick Examples

PALSWAPT /1                          ; Install with Arcade Vibrant preset
PALSWAPT /3 /P ; C64-inspired with pop boost
PALSWAPT /c:blue,red,white ; Custom colours by name
PALSWAPT /c:cyan,magenta,yellow /b:darkgray ; Custom + background
PALSWAPT C64.TXT ; Load 9 C64 palette combos
PALSWAPT /8 ; Monochrome Amber
PALSWAPT /U ; Uninstall

Typical Workflow

PALSWAPT /3         ; Install with C64 preset
ZAXXON ; Run game — custom colours applied automatically
; Ctrl+Alt+Space = random CGA colours
; Ctrl+Alt+C = random C64 colours
; Ctrl+Alt+1..9 = switch presets
PALSWAPT /U ; Uninstall when done

How It Works (Technical Summary)

On VGA: PalSwapT disables default palette loading on mode set (INT 10h AX=1201h BL=31h), remaps ATC registers 0–3 to conflict-free DAC entries, and fills all 16 DAC entries covering every CGA palette variant. This means it works regardless of which CGA palette variant the game selects (palette 0/1, high/low intensity).

On EGA: Converts user RGB values to the nearest EGA 6-bit colour and programs all 16 ATC registers directly.

The keyboard hook (INT 09h) checks BIOS shift flags at 0040:0017h for Ctrl+Alt. When both are held, scan codes are matched against the hotkey table. Non-hotkey keys pass through to the original handler, so normal gameplay input is not affected.

Non-TSR Version

A simpler non-TSR version ([tt]palswap.com[/tt]) is also included for one-shot palette changes — useful if you don't need hotkeys or mode-set hooking.

Compatibility

Tested on 286 with Trident TVGA9000i-3 and 486 with VGA. Should work on any EGA or VGA system running DOS in real mode. The palette text file format is compatible with PC1PAL (my palette loader for the Olivetti Prodest PC1 / AT&T PC6300).

Downloads & Source

GitHub: https://github.com/RetroErik/PalSwap

YouTube

I've made a couple of videos demonstrating PalSwapT in action:

I'd love to hear your thoughts, suggestions, and any compatibility reports.

thanks a lot!! love the non tsr pal change, and i can just add color change to bat files

One question, any way not to affect text mode? or EGA stuff? text software like norton commander is affected or even ega games. Not big deal because i use non tsr, but wwwith tsr yes

great software!

Reply 8 of 11, by Jinxter

User metadata
Rank Member
Rank
Member
theelf wrote on Yesterday, 21:53:

One question, any way not to affect text mode? or EGA stuff? text software like norton commander is affected or even ega games. Not big deal because i use non tsr, but wwwith tsr yes

No, the 16 color CGA palette for DOS text mode and CGA games are the same. That is one of the reasons a TSR is a good option. Then you can press CTRL+ALT+R to reset colors to standard.

Check out my YouTube channel: Retro Erik https://www.youtube.com/c/RetroErik
My collection: https://retro.hageseter.com
X: https://x.com/Retro_Erik

Reply 9 of 11, by mbsystem

User metadata
Rank Newbie
Rank
Newbie
Jinxter wrote on Yesterday, 10:25:
mbsystem wrote on Yesterday, 06:37:

.Pal updated !

Can you explain what the changes are? Why are they binary? Can they be used with PalSwap?

.PAL files are designed for use with a wide range of legacy software—such as VGAMAX 2.0, PRISM, TSRCOLOR, and many others. Some programs utilize modified PAL files (e.g., ColorBox, which uses .cbp files that subsequently require re-capturing).
The drawback of your software lies in the fact that it relies on the color palette of the host computer or the specific DOSBox emulator being used. Consequently, I performed the capture using the oldest CGA color profile available to me. Newer color models—whether based on IBM/Intel standards or the later Microsoft/Nvidia standards—are no longer suitable, as they render certain colors within your palette invisible; not to mention the resulting contrast, which is far too harsh.
You could certainly add a feature to import .PAL files; however, if your software renders differently depending on the machine on which it is installed, such a feature would unfortunately offer no advantage over the current .txt files.

Reply 10 of 11, by Jinxter

User metadata
Rank Member
Rank
Member
mbsystem wrote on Today, 17:58:

The drawback of your software lies in the fact that it relies on the color palette of the host computer or the specific DOSBox emulator being used.

On the concern about colors rendering differently depending on the machine: PalSwap bypasses the CGA color generation path entirely. It writes exact 6-bit RGB values directly to the VGA DAC registers (ports 3C8h/3C9h), which define the analog output voltage. So a value of (42, 0, 21) produces the same dark red on any VGA card — old IBM, Tseng ET4000, or DOSBox with any CGA profile selected. The host CGA color profile is irrelevant once PalSwap is active, because PalSwap replaces it.

That's actually the whole point of the tool — to get consistent, chosen colors regardless of the default CGA palette.

So for now, the .TXT format remains the best option: it's human-readable, editable, and carries the same data. No advantage to adding .PAL import when the text files already work and contain identical values.

That said, if you have palettes with different color values you'd like to see supported — for example ones you've tuned by eye on a specific monitor — I'd be happy to look at those.

Check out my YouTube channel: Retro Erik https://www.youtube.com/c/RetroErik
My collection: https://retro.hageseter.com
X: https://x.com/Retro_Erik

Reply 11 of 11, by theelf

User metadata
Rank Oldbie
Rank
Oldbie
Jinxter wrote on Today, 10:20:
theelf wrote on Yesterday, 21:53:

One question, any way not to affect text mode? or EGA stuff? text software like norton commander is affected or even ega games. Not big deal because i use non tsr, but wwwith tsr yes

No, the 16 color CGA palette for DOS text mode and CGA games are the same. That is one of the reasons a TSR is a good option. Then you can press CTRL+ALT+R to reset colors to standard.

Hi, thanks

i wwas thinking more like

CGA4VGA - correcting/altering CGA graphic modes colors on VGA

that change CGA palette in CGA software, but not EGA/VGA text mode, EGA software etc, just only CGA graphic modes