Hugo Holden
Veteran Member
Since I am just learning to program graphics I should probably stick to BASIC ! I have worked out all the states for the color select register on the CGA card in screen 1 mode (320 x 200 graphics mode), for the 6 control bits and I can write to them to get any of the 8 background colors, intensified or not, the two text colors (yel or white), the selection of which by the 6th bit (or by writing 32 to the register) also flips it between the two color sets, either the Cyan, magenta, white one or the red,green,brown one. And I can get the same results with BASIC OUT commands, writing to the register directly at hex 3D9.
But there is something here I'm not sure of: When I'm in one of the color sets, say green, red, brown so far I have only been able to select from those colors within that set with a BASIC instruction like LINE (X, Y)-(X+A, Y+B),Q,BF say to draw a filled box where Q is either 1, 2 or 3 to select either green red or brown from the color set. There are two bits of a register (called C0 & C1 in the CGA graphics card manual ) that the BASIC command is controlling which I think might be in the 6845 CRT controller register. It is a two step command using address 3D4 and 3D5 but so far I haven't figured out the BASIC syntax (for writing directly to the register with an OUT command) to get the C0,C1 bits to change state....or maybe C0,C1 is elsewhere?
But there is something here I'm not sure of: When I'm in one of the color sets, say green, red, brown so far I have only been able to select from those colors within that set with a BASIC instruction like LINE (X, Y)-(X+A, Y+B),Q,BF say to draw a filled box where Q is either 1, 2 or 3 to select either green red or brown from the color set. There are two bits of a register (called C0 & C1 in the CGA graphics card manual ) that the BASIC command is controlling which I think might be in the 6845 CRT controller register. It is a two step command using address 3D4 and 3D5 but so far I haven't figured out the BASIC syntax (for writing directly to the register with an OUT command) to get the C0,C1 bits to change state....or maybe C0,C1 is elsewhere?
Last edited: