First post, by Jinxter
- 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 presetPALSWAPT /3 /P ; C64-inspired with pop boostPALSWAPT /c:blue,red,white ; Custom colours by namePALSWAPT /c:cyan,magenta,yellow /b:darkgray ; Custom + backgroundPALSWAPT C64.TXT ; Load 9 C64 palette combosPALSWAPT /8 ; Monochrome AmberPALSWAPT /U ; Uninstall
Typical Workflow
PALSWAPT /3 ; Install with C64 presetZAXXON ; Run game — custom colours applied automatically; Ctrl+Alt+Space = random CGA colours; Ctrl+Alt+C = random C64 colours; Ctrl+Alt+1..9 = switch presetsPALSWAPT /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:
- PalSwapT (TSR version with hotkeys): https://youtu.be/c2lrBGcd43Q - To be released April 10th 2026
- PalSwap (one-shot version): https://youtu.be/M94z11cK5FQ
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