Jon Relay's Apple II Info Archives
Standard Hi-Res Graphics
On screen, every 14 columns:
|G| |CT1| |CT1| |CT1| |---CT1---| |CT1| |CT1| |CT1| v v v v v v v v v v v v v v v v Column: CGB C00 C01 C02 C03 C04 C05 C06 CGB C07 C08 C09 C10 C11 C12 C13 Bit Value: 128 001 002 004 008 016 032 064 128 001 002 004 008 016 032 064 ^ ^ |G|
In memory, every 2 bytes:
|G| |CT2| |CT2| |CT2| |G| |CT2| |CT2| |CT2| v v v v v v v v v v v v v v v v Column: CGB C06 C05 C04 C03 C02 C01 C00 CGB C13 C12 C11 C10 C09 C08 C07 Bit Value: 128 064 032 016 008 004 002 001 128 064 032 016 008 004 002 001 ^ ^ |---------------------------CT1---------------------------|
CT1 bit pairs:
00 = Black 01 = Blue or Magenta 10 = Orange or Green 11 = White
CT2 bit pairs:
00 = Black 01 = Orange or Green 10 = Blue or Magenta 11 = White
G (color group) bits:
0 = Black, White, Magenta, or Green 1 = Black, White, Orange, or Blue
Column values are column on screen modulo 14.
On the two bits that are from two different bytes, if the two bytes have different color group bits, then 01 or 10 will result in some weird colors. The results I get trying to experiment with them are often inconsistent. My first results where like this:
Color Group Bits As In Memory \/ \/ 01 10 +> 01 Brown Pink +> 10 Cyan Purple | +- Bit Pair Bits
Just recently, I got different results that were more consistent, but wackier than my earlier table:
Bit Pair: Group Bits: Background Color: Result: 01 10 Black Purple 01 01 Black Cyan 11 10 Black Aqua 01 10 White Yellow 01 01 White Brown 11 01 White Red
If you think about it for a really long time, it makes sense that:
Bit Pair: Group Bits: Result: 01 10 Purple 01 01 Cyan 10 10 Yellow 10 01 Brown 11 10 Aqua 11 01 Red
Which is sacrificing consistency for being less weird.
There was a program posted on comp.sys.apple2 a long time ago that put all 12 colors on a black background. Looking at it, I can find this:
Bit Pair: Group Bits: Start at Column: Result: 00 00 6 Black 10 10 6 Blue 10 00 6 Magenta 10 11 6 Light Blue 10 01 6 Purple 10 10 13 Brown 10 11 13 Orange 11 10 13 Pink 01 00 6 Green 10 01 13 Yellow 11 10 6 Cyan 11 00 6 White
Holger Picker posted the following table a while ago, which provides an alternative to the information at the beginning of this section:
Odd Columns (1,3,5...) Even Columns (0,2,4...) 000 = Black 000 = Black 001 = Black 001 = Black 010 = Green/Orange 010 = Purple/Blue 011 = White 011 = White 100 = Black 100 = Black 101 = Purple/Blue 101 = Green/Orange 110 = White 110 = White 111 = White 111 = White
He used three pixels to determine the color of the middle pixel.
For an easy way out of trying to calculate colors in high-resolution graphics, you can use the following subroutines:
Pix2 Version 1:
63999 HCOLOR=ZZ : HPLOT (XX*2),(YY*2) TO (XX*2)+1,(YY*2) TO (XX*2)+1,(YY*2)+1 TO (XX*2),(YY*2)+1 : RETURN
Draws bulky square pixels on the screen. XX is loaded with the horizontal coordinate, a number between 0 and 139. YY is loaded with the vertical coordinate, a number between 0 and 95. ZZ is loaded with a color number, which is from 0 to 7. 0 or 4 is black, 1 is green, 2 is magenta, 3 or 7 is white, 5 is orange, and 6 is blue. Color group conflicts will occur.
Pix2 Version 2:
63999 HCOLOR=ZZ : HPLOT (XX*2),YY TO (XX*2)+1,YY : RETURN
Draws rectangular pixels on the screen. XX is loaded with the horizontal coordinate, a number between 0 and 139. YY is loaded with the vertical coordinate, a number between 0 and 191. ZZ is loaded with a color number, which is from 0 to 7. 0 or 4 is black, 1 is green, 2 is magenta, 3 or 7 is white, 5 is orange, and 6 is blue. Color group conflicts will occur.
Pix2 Version 3:
63990 IF ZZ = 7 THEN ZZ = 3 63991 IF ZZ = 4 THEN ZZ = 0 63992 IF ZZ <> 0 AND ZZ <> 3 THEN GOTO 63999 63993 XX = XX*2 63994 VTAB INT(YY/8)+1 : BA = ((PEEK(40)+(256*PEEK(41)))-1024)+8192 63995 BA = BA+(1024*(YY-(INT(YY/8)*8)))+INT(XX/7) 63996 IF BA <> INT(BA) THEN BA = INT(BA) 63997 IF PEEK(BA) >= 128 THEN ZZ = ZZ + 4 63998 XX = XX/2 63999 HCOLOR=ZZ : HPLOT (XX*2),YY TO (XX*2)+1,YY : RETURN
Draws rectangular pixels on screen. XX is loaded with the horizontal coordinate, a number between 0 and 139. YY is loaded with the vertical coordinate, a number between 0 and 191. ZZ is loaded with a color number, which is from 0 to 7. 0 or 4 is black, 1 is green, 2 is magenta, 3 or 7 is white, 5 is orange, and 6 is blue. Checks the color group bit of the existing pixels so that using white or black won't change the color group bit regardless of whether you use 0, 3, 4, or 7 as the value of ZZ.
These subroutines are backwards compatible. Version 2 does everything version 1 does, and version 3 does everything version 2 does. Programs that use version 1 can also use versions 2 and 3 (although the height of the picture will be shrunken down), and programs that use version 2 can also use version 3.