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 6, 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 6, 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 6, 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 6, by mbsystem

User metadata
Rank Newbie
Rank
Newbie

.Pal updated !

Reply 6 of 6, 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