Reply 580 of 581, by superfury
SoftCat wrote on Yesterday, 16:00:GloriousCow wrote on 2025-12-18, 23:04:I'm afraid I never really implemented monochrome support for the EGA, because dealing with the 9-dot character timings annoyed m […]
I'm afraid I never really implemented monochrome support for the EGA, because dealing with the 9-dot character timings annoyed me at the time as I had (what i thought to be) a nice optimized 64-bit, 8-pixel-at-time drawing pipeline. I did eventually figure that out for VGA but never back ported it to EGA.
Here's what I have for DIP switches, for what its worth. These are the physical switch states. They read inverted as closing the switch pulls the circuit to ground.
pub const EGA_DIP_SWITCH_EGA: u8 = 0b1001; // EGA 'enhanced color'
pub const EGA_DIP_SWITCH_MDA: u8 = 0b1011; // MDA emulation
pub const EGA_DIP_SWITCH_NORMAL: u8 = 0b1000; // EGA 'normal color'
pub const EGA_DIP_SWITCH_CGA: u8 = 0b0111; // EGA on CGA monitor9-dot characters require a 72-bit processor.
There's only 8 pixels being fetched from a 32-bit VRAM location in graphics modes though. Text mode uses different buffers and only planes 0 and 1 (and plane 2 for loading a latch of 8 pixels, with the 9th pixel being a duplicate of the 8th or zeroed). Then it's simply shifted out one font pixel at a time to the display, much like with monochrome graphics modes. The only difference here is that the attribute is combined with that for font/background color to send to the attribute controller. And of course the whole deal with the CRT timings being affected as well by this setting (720 pixels of active display horizontally).
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io