12.07.2015 Views

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

82 APPLE II COMPUTER GRAPHICSA Bit of ColorIn Chapter 8, we pointed out that the left-most bit in a Hi-Res byte was notdisplayed, and <strong>al</strong>luded to its fu nction in color control. That bit is c<strong>al</strong>led thecolor bit of the byte, and its s<strong>et</strong>ting d<strong>et</strong>ermi nes which group of colors theremaining seven bits will display. If the color bit of a byte is off (zero), theremaining seven bits will display colors from group 1: BLACK1, GREEN,VIOLET, or WHITE1 . If the color bit is on (one), the byte will display group2 colors: BLACK2, ORANGE, BLUE, or WHITE2. Those colors will varydepending on the TV or monitor used, but you can usu<strong>al</strong>ly adjust the tinton your screen so the proper colors are displayed. We will r<strong>et</strong>urn to thecolor bits and color groups; meanwhile, run the following program as anexperiment.10 HGR20 HCOLOR = 330 HPLOT 1,0 TO 1,10040 GET P$: REM PAUSE50 HCOLOR = 460 FOR I = 0 TO 10070 HPLOT 0 , I80 NEXT IListing 9-1 . Vertic<strong>al</strong> line.According to the Apple manu<strong>al</strong>s, HCOLOR = 3 is WHITE1 (the whitebelonging to color group 1); hence, lines 10 through 30 should plot avertic<strong>al</strong> white line in column 1. But when you run the program you areinstead gre<strong>et</strong>ed by a vertic<strong>al</strong> green line! That is because you are plotting asingle dot in each row, and any isolated dot <strong>al</strong>ways results in a color. Butthere is more. Line 40 h<strong>al</strong>ts the program until you press a key, line 50 s<strong>et</strong>sthe color to BLACK2, which is the black belongi ng to color group 2. Lines60, 70, and 80 plot a vertic<strong>al</strong> line of black dots in column 0. Since column0 was <strong>al</strong>ready black, you would not expect anything to change, and y<strong>et</strong>the green line slowly changes to orange after you press a key.The reason fo r the color change has to do with the color bit. The dots incolumn 0 and column 1 are controlled by the same byte of Hi-Res memory,and plotting WHITE1 turned on the column 1 bit of each byte and leftthe rest of the bits off, including the color bit. Plotti ng column 0 in BLACK2turned off the column 0 bits, which were off anyway, but <strong>al</strong>so turned onthe color bit of each byte since BLACK2 is a group 2 color. When the colorbit of each byte was turned on, it caused the entire byte to display group 2colors; thus, the green in column 1, which is a group 1 color, changed tothe corresponding group 2 color, orange. If column 0 had been plotted inB LACK1 instead of BLACK2, the color bit of each byte would have remainedoff and no color change would have occu rred.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!