stepleton
Veteran Member
I've swapped my (IBM original) CGA card for an (IBM) EGA card in my 5170. It's set up to drive a 5153 for now --- the 5154 still needs fixing.
A while ago I wrote my first x86 assembly program, which does a bit of CGA graphics in Mode 4 (and also Mode 5). The code successfully sets the Mode 4 palette on the CGA card, but it doesn't work for the EGA card. I'm not sure why this is; I was hoping someone here might know.
The code I use to set the options for the video mode runs after the video mode is chosen via an INT 10h call. It writes directly to the CGA colour control register and looks like this:
The
I hate to ask folks to debug my work, but is there a reason this shouldn't switch the colour palette and intensity in Mode 4 for my EGA card? I know my EGA card is capable of switching Mode 4 colour palettes because I see other programs pulling it off (e.g. CheckIT's video tests). All I get, though, is the classic, dull CGA cyan/magenta/white pallete. I think even my attempts to select Mode 5 result in original-palette Mode 4. Is there something else I should be doing?
A while ago I wrote my first x86 assembly program, which does a bit of CGA graphics in Mode 4 (and also Mode 5). The code successfully sets the Mode 4 palette on the CGA card, but it doesn't work for the EGA card. I'm not sure why this is; I was hoping someone here might know.
The code I use to set the options for the video mode runs after the video mode is chosen via an INT 10h call. It writes directly to the CGA colour control register and looks like this:
Code:
; Setting flags in the CGA colour control register
xor al,al ; Clear al --- no options yet
mov ah,2[bx] ; Copy intense colours choice to ah
test ah,ah ; Is it zero?
jz .f2 ; Skip ahead
or al,10h ; Wasn't zero, set bit 4: want intense colours
.f2 mov ah,3[bx] ; Copy palette choice to ah
test ah,ah ; Is it zero?
jz .f3 ; Skip ahead
or al,20h ; Wasn't zero, set bit 5: want cyan/magenta/white
.f3 mov dx,kCgaCcrPort ; Address of the colour control register (03d9h)
out dx,al ; Push config to the colour control register
; Copy the flags to the BIOS CGA colour control register value mirror
mov bx,0040h ; Set ES segment base address to $40, home of...
mov es,bx ; ...DOS bios variables
mov es:066h,al ; Copy flags to the colour control register mirror
The
bx
register points at a four-byte data structure like this one:
Code:
db 0 ; Unused
db 0 ; Boolean: enter mode 5 instead of mode 4?
db 1 ; Boolean: intense colours instead of dim ones?
db 1 ; Boolean: cyan/magenta/white instead of red/yellow/green?
I hate to ask folks to debug my work, but is there a reason this shouldn't switch the colour palette and intensity in Mode 4 for my EGA card? I know my EGA card is capable of switching Mode 4 colour palettes because I see other programs pulling it off (e.g. CheckIT's video tests). All I get, though, is the classic, dull CGA cyan/magenta/white pallete. I think even my attempts to select Mode 5 result in original-palette Mode 4. Is there something else I should be doing?