Tuesday, September 24, 2013

The Overlooked Artifact Color Capabilities of non-Apple II Computers

When the first home computers came to market in the late 1970s, their capabilities were focused mainly on getting text to display on the screen.  Text doesn't require color.  Steve Wozniak wanted his second computer, the Apple II, to display in color.  The computer had a monochrome text mode of 40 columns by 24 rows with a 7x8 character box.  It also could display up to 16 solid colors (really 15 as the two gray colors are not really distinct) using those text boxes, and two colors in each box (a top color and a bottom color) for an effective resolution of 40x48.  However, this Low Resolution Graphics Mode was insufficient for graphics of any real detail.

Apple II Low Resolution Graphics Example - Lemonade Stand

The Apple II also supported a 280x192 pixel High Resolution Graphics mode.  The actual pixels were white and did not contain color/hue or saturation information.  Each of bits, except the highest, of every memory byte for the HGR page could display a single dot if set (logical 1).  A single memory location could set up to seven consecutive pixels.  Pixels on even horizontal lines would appear as purple first, on odd lines they would be green first.  If one pixel was set, it would be in color on a color monitor.  If two adjacent pixels were set, they would appear as a double-wide white pixel.  Similarly, if two adjacent pixels were off, they would appear as black. The trick to getting solid colors was to place pixels in an alternating on-off-on pattern.  That is why people would frequently see "serrated" or "stripey" graphics with a monochrome display instead of a solid color.  The effective color resolution is something close to 140x192.

Apple II High Resolution Graphics Example #1 - Ultima

The trick behind color composite graphics is the use artifact color.  The NTSC color carrier operates at a 3.58MHz frequency.  The phase (measured in degrees, think of sine waves) of this frequency is shifted as the beam travels across the TV to set the color/hue, and the amplitude of the signal is varied to determine the saturation.  In HGR Mode, the pixels, which constitute the brightness information, are being sent to the TV at a 7.16MHz frequency.  Thus there are two "black and white" pixels for every "color" pixel.  In a pure black and white mode, the color carrier, informing the TV that it is to display in black and white only.  In fact, the Apple II has a "color killer" circuit to prevent the color carrier from being sent in full text modes.  However, the text will show artifacts in mixed modes.

With composite artifact color, the color carrier signal is sent.  The phase of the signal oscillates from 180 degrees to 270 degrees, 0 degrees, 90 degrees and back to 180 degrees for each color clock.  The pixels are sent at twice the frequency of the color clock, and depending on where on the screen the pixel is, this will show the combination of the two nearest phase shifts.  Thus, in the original Apple II, you can obtain a green from the combination of 90 and 180 degrees (~135 degrees) and magenta from 270 and 0/360 degrees (~315 degrees).  Soon, the designers of the Apple II figured out how to use the eighth bit of each memory location to delay the pixel clock by half a clock, giving blue (~45 degrees) and orange (~225 degrees) artifact colors.  Visually, a memory location with blue/orange colors will appear slightly shifted compared to a memory location above or below with green/magenta colors.

Due to the lack of bandwidth of an NTSC monitor, instead of getting colors alternating with black, you will see mostly solid colors.  When the first pixel is set to color, the color carrier does not have time to fully transition back to black for the second color when the third pixel is also set to color.  Thus you get a mostly solid color, however the better your monitor and connection, the more likely you will see lines between pixels.

Apple II High Resolution Graphics Example #2 - Wasteland


Apple II Double High Resolution Graphics Example - Might and Magic II: Gates to Another World

Later with the Apple IIe machines (after the first revision and expanded to 128K), a Double High Resolution Graphics Mode supporting all 15 unique colors was available.  By this time Apple had begun to use VLSI chips and thus no longer as limited in the color selections.  Double High Resolution Graphics use a 560x192 resolution and a 14.318MHz pixel clock.  Because there are now four pixels changes for every color change, the effective color resolution is still close to 140x192.  The extra pixels allow for a much more expanded color palette.  The high-bit pixel clock delay of the High Resolution Mode, which was something of a hack, is not required.  In this mode, each byte sets the color of two pixels.

At least seventy games support DHGR graphics, but not all are very playable on a 1MHz 6502/65C02 and many of these games pale in comparison to versions of these games for other platforms.  Maniac Mansion, Sierra AGI Quest games and many arcade ports fall into this category.  Still, there are several games originally developed for the Apple IIe and its DHGR mode, including Prince of Persia (limited), Dragon Wars, Might and Magic II, King's Bounty, Air Heart, Into the Eagle's Nest, Legend of Blacksilver.

Atari 8-bit Color Composite Graphics Example #1 - Exodus: Ultima III

While the Apple II was built entirely with generic TTL logic chips, the Atari 8-bit machines had a pair custom graphics chips, ANTIC and CTIA, later GTIA, to handle the graphics modes.  ANTIC and GTIA offered several graphics modes, and one of them, ANTIC Mode F, BASIC Mode 8, gave a 320x192 resolution mode with monochrome graphics.  However, this mode utilized artifact color.  Many ports of Apple II games used this mode.  Four primary artifact colors are supported in this mode, the colors vary depending on the revision of the CTIA or GTIA chip and system.  At least 45 games support the Atari composite color mode, including all the Ultima games, anything released by Origin Systems, Broderbund's original Choplifter,  Lode Runner & Championship Lode Runner; Sierra's Hi-Res Adventures, Flight Simulator II and many Pinball games.  Unlike the Apple II, the Atari machines were not strictly limited to black and white as the direct color in this mode, as can be seen in Choplifter and Ulysses and the Golden Fleece.  These machines can set artifact color in combination with a direct color.  Assuming that the base color is white, the usual artifact colors are blue (~0 degrees) and brown (~180 degrees).  Some machines reverse the colors output.

Atari 8-bit Composite Color Example #2 - Choplifter!

Discussion of IBM PC Composite Color moved to its own blog entry : http://nerdlypleasures.blogspot.com/2013/11/ibm-pc-color-composite-graphics.html

Tandy TRS-80 Color Computer Color Composite Graphics Example - Donald Duck's Playground

In 1982, Tandy released its Color Computer.  Its graphics system had definite similarities with the CGA card, its sound system was very simple and it was not very attractive to game developers.  It supported a 256x192 artifact color mode, with blue and orange in addition to black and white. Many games used this mode due to the limitations of the direct color modes.  Essentially the graphics look very similar to the Apple II's HGR graphics, but are more limited due to the absence of any primary colors other than blue and orange.  The Color Computer 3 has far superior graphic capabilities, enough so that a nearly-perfect port of Donkey Kong was created for it.

Artifact color does not work with S-Video (which can be obtained from the Atari 800), as that connector separates the luminance and chrominance signals.  Artifact color relies on the demodulation of the combined luminance and chrominance signals.  You will see monochrome colored pixels with serrated graphics where color was intended if you use S-Video.

Artifact color was designed for NTSC-standard monitors.  No PAL home computer ever used it.  The Apple II Europlus does not output color without a special "PAL color card."  The Apple IIe have the PAL color card built in but the Apple IIc requires an external dongle to show color.  The video output is not as good as with an NTSC monitor.  There is no "PAL" CGA card.  The PAL Atari 8-bit machines would have treated the 320x192 as a strictly monochrome mode.  While the TRS-80 CoCo may not have been widely distributed in Europe, the Dragon 32/64 computers are very close cousins to it.  While it supports a 256x192 mode, it seems to be strictly black and white.  Compare the game "The Vortex Factor" for both systems.

9 comments:

  1. Brazil has PAL-M, which is, roughly, NTSC timing/framing with PAL color encoding. Look how this Brazilian CoCo clone does color artifacting: http://www.youtube.com/watch?v=QiYO83mFTOY

    ReplyDelete
    Replies
    1. Juan Castro, that video is now private. Do you have backups?

      Delete
  2. We used to rave about how awesome Apple 2's "HGR" graphics was. Even though there were effectively like 5 colors.

    ReplyDelete
  3. The Color Computer 3 had some advanced graphics abilities such as palettable EGA colors (16 colors among a choice of 64), smooth page-flipping vertical scrolling, a virtual screen mode allowing horizontal scrolling, etc. But its sound/music capabilities were still minimal and it didn't attract lots of developers.

    Here is a game demo I'm currently working on for the vintage 128k Coco3 (some of the graphics will be replaced by adequate sprites).
    http://avantrad.ca/upload/hugo/coco3/spriter_demo3.mp4

    ReplyDelete
  4. Some people such as Chris Lomont have used artifact colors and Vsync tricks on composite monitors to display 256 colors simultaneously on the Coco3 (which is normally limited to 320x200x16 colors from the EGA palette).
    http://www.lomont.org/Software/Misc/CoCo/

    ReplyDelete
  5. On a slightly pedantic level I'm going to protest the claim that "Artifact color was designed for NTSC-standard monitors. No PAL home computer ever used it."

    Having recently looked at the schematic for the Oric 1/Atmos, it produces colours by passing binary R, G and B plus two quadrature-phase clocks (so: a four-step counter) through a lookup ROM. The output of the ROM is a 4-bit level that runs through a resistor chain (i.e. a tiny DAC). The four-phase clock runs at four times the colour burst. The main difference between the Oric and the Apple is that the colour clock is asynchronous — the rate at which the R, G and B inputs are updated is related to the CPU clock, the rate at which the colour ROM clock runs is distinct. But, nevertheless, in a region of solid colour it's four discrete levels per colour clock to produce colour.

    Possibly I'm muddying the waters between artefact colours and mere digital sampling but (i) I think the distinction is already fairly thin; and (ii) compare and contrast with the common Atari/Commodore-style of colour production that involves picking a phase offset for something analogue and sine-ish.

    ReplyDelete
  6. Actually, Ultima I for the Atari 8-bit, published by Sierra On-Line, used a non-artifacting 160x192 mode. Also, it's notable that, in addition to allowing for different artifact colors by changing the color drawn from white to any of the other 14 colors (not counting black, nor the 8 shades of each color available), the Atari 8-bit could also add 5 players (sprites), each with a different color, and using Display List Interrupts, these colors could be changed on different scan lines, and the players repositioned. Using no tricks, these players could be of any height (even using every scanline), and could be placed as over or underlays to add color to hires graphic images, in addition to being used to add sprites to the screen.

    ReplyDelete
  7. Ultima I for the Atari 8-bit uses the artifact color mode in the town and castle screens and may also for the dungeon first-person view. I don't know about the space sequences or the final confrontation with Mondain.

    ReplyDelete
  8. One quick comment - the TRS-80 Color Computer came out in 1980, not 1982.

    ReplyDelete