Date: 17 Apr 97 09:53:23 -0700 Subject: Re: Apple IIc//IIe graphics modes. From: "Eric Jacobs" <no@no.no> Aw.. don't shoot down the graphics design of the Apple II! That's the best part of the whole computer! Its insanity makes it my personal favorite, I'll tell you that. A video system built solely using discrete counters and adders.. that's pretty impressive. A lot of the reason the hires color system is so confusing is that it's not built on an RGB color model, but directly on the NTSC composite television standard. Most other computers (including the GS) generate the image in RGB, and then display it. (When systems like the GS and the Super Nintendo need to output to composite, they encode the RGB signal using a matrix chip, and then send it out.) The original Apple II, on the other hand, directly generates a composite signal. In an NTSC video signal, the color (chrominance) signal "rides" on a 3.579545 MHz subcarrier. The subcarrier is then decoded and referenced to an internal oscillator in the TV or monitor, which determines its amplitude and phase. The amplitude is the color's "saturation": how much color there is. In the Apple, this is always 0, 25%, 50%, 75%, or 100%. The other element is the phase. The phase specifies an angle in an imaginary color circle. Thus if the phase of the chrominance signal is exactly in phase with the color reference, it is 0 degrees-- the color is yellow-orange. 180 degrees is blue. 90 degrees is red, and so on. The internal oscillator is kept in sync by a signal called color burst in the horizontal blanking before every line. Using the tint knob on the TV and the variable capacitor on the motherboard fine tunes the color reference. Any 3.579545 MHz component in the video signal will produce a color on the screen. The Apple II text and hires modes clock the video signal at 7.15909 MHz-- twice that of color burst. Therefore, the bit pattern 10101010... will produce a color on the screen. The only other color produced that way is its complement, 01010101... In the original Apple II design, these two colors were purple and green (respectively). Combined with black and white (which have no color component), this gave the original four colors. After Revision 0 of the Apple II motherboard, additional circuitry was added to produce two more colors. When bit 7 of the data byte was 1, a flipflop was selected that would delay the bit stream by 70 ns (that's 90 degrees). Thus, the Apple could now generate six colors, black, white, purple, green, blue, and orange (135, 315, 225, and 45 degrees to color burst, respectively). The only limitation was that this new palette select bit applied to the entire byte. So it was not possible to display blue and green in the same byte, for instance. Now, for Nate's question about colors spanning bytes with different high bits: if you're going from D7=0 to D7=1, the flipflop holds the bit for an extra 70 ns. This creates a bit pattern that's a different color entirely: in fact, it is a 25% or 75%-intensity color from the lores palette! For example, going from green to orange will give you yellow; purple and blue will give you light blue. This same phenomenon is also responsible for the Mysterious Pink Line. This is a orange-pinkish line that appears under certain conditions along the left edge of the screen. It occurs when bit 7 of the left edge of the screen is set, and bit 6 of the previous byte is also set. The flipflop holds that value of bit 6 during the first 70 ns of the first byte of the new line. The result is an eerie pink half-dot at the left end of that line. For example, for scan line #1, set $2080 to $80, and $207F to $40. $207F--an unused screen location (screen hole)--is actually being used to store that dot! Sadly, the Myserious Pink Line is not correctly emulated under the Apple IIGS's video chip. It seems that Apple's engineers had the sudden thought that maybe the Apple II video modes should make sense.. i dunno. Actually the Apple II's video could have been much better if Apple had adhered closer to the NTSC video standard. For example, the number of cycles of color ref in one horizontal line should be 227.5, not 228. The number of lines per field should be 262.5, not 262. (Apparently, Woz much preferred integers.) Although these deviations seem small, they actually would have fixed many of the color anomalies, including virtually eliminating that annoying color fringing. Just take a look at the Nintendo or Super Nintendo's color display.. it's absolutely beautiful. There are no wacky color fringes on those machines. Or look at the credits to a movie on your VCR. That text is no bigger than an 80-column display, and it looks great. Ah, the wonders of composite video.. now how can the GS and its dumb old SHR compare to this?? :) -ej