Sunday, January 29, 2023

CGA and "Intended", "Incidental" and "Just Plain Wrong" Graphics

When IBM released its Color/Graphics Adapter card as one of the two display adapters supported by the IBM PC Model 5150 when it launched in August of 1981, it offered two video output options, RGB video and composite video. RGB video offered much sharper text and purer colors than composite video but required expensive and special monitors. Composite video would work with any color monitor or TV and had the unique ability to offer more colors via artifact color. The CGA output both types of video at the same time. In a sense every game that supports CGA supports both RGB and Composite color, but that does not mean that every game will look the way the graphics artists intended the game to look. In this article we will discuss some examples of the "Intended" look versus the "Incidental" look of CGA gaming graphics. 


At the time of the PC and the CGA's release IBM did not offer an RGB monitor. Other companies offered RGB monitors, but they may not have followed IBM's RGBI (Brown) 16-color standard. The IBM 5153 Color Display, which was the RGB monitor IBM intended to be used with the CGA card, was not released until 1983. Many early PC users used color composite monitors or a TV via an RF modulator. 

 The first PC games were generally released with composite color in mind. CGA color palette 1, cyan/magenta/white looked less garish with composite colors and TV screens. CGA color palette 0, red/green/brown was usually a better choice of colors for games but it was less often used. The "alternate palette", which used cyan/red/white, was too infrequently used because it was not an official palette selection and it only displayed in black and white on composite monitors. 

Over time many factors helped relegate CGA to almost exclusively RGB graphics. New graphical standards like Hercules Monochrome graphics, PCjr., Tandy, EGA and VGA required the programmer to divert his or her attention to making CGA graphics look good. RGB monitors became more affordable and widespread and always were better for business applications. Some clone CGA cards did not come with a composite video connector, Tandy 1000s lost composite video output and EGA cards never really supported composite video. Artifact color presented different hues in different adapters, even the PCjr. shows substantially different artifact colors compared to IBM's own CGA cards, making developers less inclined to use them because their ability to control the artifact colors was diminished.  The composite video output of the earlier Tandy 1000 models is based on CGA and PCjr. but uses different composite artifact colors that never almost never saw intentional support.  Finally, composite artifact color was only supported natively by NTSC video displays, and when CGA had an Indian Summer of sorts due to the rise of cheap European PCs with little better than CGA like the Amstrad PC-1512 in the late 1980s, artifact color was not supported by these PCs.

Sometime in 1983 or 1984 IBM had revised its CGA card's circuitry to improve the number of gray shades the card is able to produce on a monochrome composite display and this in turn altered the direct and artifact colors which were displayed.  For games released prior to 1984, I use the composite output generated by an "old CGA" card.  For games released in 1984 or later I either present both the "old CGA" video and the "new CGA" video or make a judgment on which is the better output to be displayed.  

Let's start with some early games.  Here we have a very early commercial PC game, Microsoft Decathlon from April, 1982.  It supports three types of displays, from left to right we have RGB, monochrome composite and color composite :


The colors in composite color mode use checkerboard dithering is used in several places to change the colors to something more appropriate, but RGB displays tend to relatively clear distinctions between alternating pixels.  Intermediate colors are more an issue with the dot pitch of the TV screen than color decoding as is the case with composite color.  The monochrome mode actually will show some cyan, red and magenta on a color display, but in this case the "colors" are intended to break up the pure white or black backgrounds with some gray shading.    In 1982 only early CGA composite is available.  If this game was run on late CGA composite, the text on the top would be more readable than that on the bottom, potentially confusing latecomers to the game.  

The next game in our list Adventure in Serenia from September 1982. On the left you have images from an RGB monitor and on the right you have early CGA Composite images.  


Sierra used a dithering pattern to make the RGB graphics somewhat presentable on RGB displays, but with four colors there is only so much Sierra could do.  Of course, unless you know to press F2 to switch between the color choices in the game, you get a very bland cyan/magenta/white image.  The programmer cannot know what display the user has, both RGB and Composite output are always active on the CGA card.  Here I show examples of display and color mode mismatch, the left is RGB with the Composite setting and the right is Composite with the RGB setting :


Now we have Ultima II: Revenge of the Enchantress released by November 1983, which was, like the previous two games, originally made for the Apple II.  No one would want to see the images on the left when the computer can display the images on the right :


And here is the rare PCjr. separate release, which required its own release in April of 1984 at the time because the copy protection used on the PC version was incompatible with the PCjr.  The same comment that no one would prefer the image on an RGB display compared to a Composite display (although the PCjr RGB often has more appropriate tile colors than the PC RGB)  :


Let us turn to Below the Root, which was originally developed for the Commodore 64 and released in 1984.  This game has support for both PC and PCjr. in one package rather than two.  


In this instance, because the game was released in 1984, I have included both old Composite CGA (middle) and new Composite CGA graphics (right) from the introduction.  It is difficult to say which were the designer's preferred graphics, all three options have their positives and negatives.  The PCjr.'s graphics, shown below, have the greenest grass but the water will have a greenish tint unless the tint control is moved all the way to the red on the display's tint control.  New CGA has the bluest water but the palest greens.  Old CGA is somewhere in between the two.  This game has support for PCjr. 3-voice music, but that music only plays during the intro.  


Finally we come to Pitstop II from 1984, which was confusing for a very long time because emulators like DOSBox does not present the monitor selection option screen as a composite monitor would :

  Option 2                                                                     Option 1


The reason for this is that the option screen is using text mode.  Microsoft Decathlon uses a graphics mode for its color options screen, and DOSBox only runs graphics modes through its composite video filter, not text modes.  In these screens, new CGA is used with the tint control shifted all the way to the red.

The manual for Pitstop II is clear that Option 1 is intended for Composite displays and Option 2 is intended for RGB displays.  Unfortunately the manual was scanned somewhat recently, so for years people playing this game on emulation were not given the knowledge needed to make a proper choice. In each set of screen captures above, the screenshots underneath the options menus are the correct or intended look.

Moreover it was discovered only recently that Pitstop II will not display the PCjr.'s intended RGB graphics as a real PCjr. does unless the emulator supports the PCjr. BIOS : 

                                                   Option 2                                                                         Option 1


DOSBox does not support booting from the PCjr. BIOS, 86Box and MESS do.  This cyan/magenta/white palette is shown even though the programmers called the function which would show the red/green/brown palette.  Due to a bug in the function call that selects the BIOS palette in the PCjr.'s BIOS, a bug for which the programmers did not account, the palette displayed is not the palette chosen.  

Here are a pair of "incorrect" PCjr. Pitstop II screenshots :

                                              Option 1                                                                               Option 2


The left is the graphics as shown on an RGB monitor using Option 1.  RGB monitor users may prefer these graphics to the "official" RGB graphics option.  The right shows the RGB graphics given by Option 2 on a Composite display.  The option screen shows the Option 2 text more clearly than the Option 1 text, so someone who did not read their manual may have mistaken Option 2 as the intended composite graphics option.  

Some games, like the very first release of King's Quest for the IBM PC, only supported composite color graphics.  At least one game, Tapper, used a flippy disk with one side of the disk supporting only composite color graphics and the other side of the disk with RGB support.  With both games you will only see high resolution monochrome graphics.  In both cases these games are using the 640x200 graphics mode, which allows for more color choices at the expense of graphics totally unsuitable for RGB monitors.   

This article has only scratched the surface of the circumstances in which IBM PC CGA games look proper with RGB monitors and when they look best with composite monitors.  The number of CGA games which support composite color is much larger than most people think.  It should noted that there many, many ways to display a CGA game incorrectly due to the inaccurate way EGA and VGA cards simulate CGA. 

7 comments:

  1. Color games often selected the "improved" grayscale mode for its black-red-cyan-white palette, which looked better than palettes in any of the official color modes. That's how the Dominos Pizza video game achieved red for the "Noid" character.

    Later EGA, VGA, and Super-VGA cards don't emulate that particular feature, so old CGA games won't reproduce reds unless you can put your adapter into CGA emulation. For cards running on Tseng Labs ET3000 and ET4000 chips, use the "VMODE CGA" command to enable register-level CGA emulation, CGA colors and fonts. It can even play Moon Bugs in 16-color 160x50, something ordinary EGA/VGA cards can't achieve!

    ReplyDelete
  2. For Pitstop II, did you inverse the description of Option 1 and 2? First you say Option 1 is Composite, but then later you say Option 1 is RGB. Also the graphics seem to indicate that Option 1 is indeed RGB.

    ReplyDelete
    Replies
    1. I do not believe so, but I did try to make the distinction a little clearer. Option 1 was intended for Composite, Option 2 for RGB.

      Delete
  3. Great post. Do you have a link to more info on this bug? "Due to a bug in the function call that selects the BIOS palette in the PCjr.'s BIOS, a bug for which the programmers did not account, the palette displayed is not the palette chosen."

    ReplyDelete
    Replies
    1. Interrupt 10 function 0B subfunction 00 selects the background and border color.
      Interrupt 10 function 0B subfunction 01 selects the palette, 0 or 1.
      The function is set via register AH, the subfunction via register BH, the value to be set in BL.
      So the game first sets AH=0B, BH=00, BL=09 to set background color bright blue.
      Then the game only sets BH=01, BL=00 to select the green/red/brown palette.
      For that second function call, it fails to set AH=0B again, because it expects that AH already is 0B from the first function call. In other words, it assumes that the BIOS preserves the content of register AH during the first call. That is true for the original PC BIOS, but not for the PCjr BIOS. The PCjr BIOS uses that register internally for things, so that AH unintentionally has the value 04 instead of 0B. Subfunction 04 reads the light pen register.
      So, intending to select the green/red/brown palette, it ends up reading the light pen register instead.

      Delete
    2. Thanks for the explanation. One of the reasons I asked was I've experienced an issue with the BIOS set all palette function(AH=0x10,AL=0x2) and it would seem to work correctly in DosBox-X, but when I run it on the PCjr the palette is all messy up. I suspect, I just don't know how to use the BIOS function.

      Delete
    3. Is there a way to get DOSBox X to emulate the Adventure in Serenia composite cga mode?

      Delete