Path: news.uiowa.edu!news.physics.uiowa.edu!math.ohio-state.edu!howland.reston.ans.net!newsfeed.internetmci.com!csn!news-1.csn.net!magnus.acs.ohio-state.edu!freenet.columbus.oh.us!not-for-mail From: dalloff@freenet.columbus.oh.us (Dave Althoff) Newsgroups: comp.sys.apple2 Subject: Re: Why can't certain colors go to some pixels? Date: 29 Apr 1996 01:08:23 -0400 Organization: The Greater Columbus FreeNet Lines: 75 Message-ID: <4m1is7$ogo@acme.freenet.columbus.oh.us> References: <1996Apr28.145129.79194@cc.usu.edu> NNTP-Posting-Host: acme.freenet.columbus.oh.us X-Newsreader: TIN [version 1.2 PL2] DR TE$TH & THE ELECTRIC MAYHEM (ronb@cc.usu.edu) wrote: : It has been about 6 years since I even thought about apples, but while working : on my ray tracer, I realized that when I was a kid, I had all of the facilities : to do something similar on my ][E. The thought occurred to me however, that : the ][e did not allow you to write certain colors to certain pixel positions. : Does anyone out there have a technical explanation for why this was the case? Easy! You're talking about the seemingly incomprehensible rules for color on the ][e 280x192 hi-res screen. The Apple ][ hi-res screen uses a one-bit display, with seven pixels per byte. This allows the entire screen...all 53,760 pixels...to fit into only 8,192 bytes of memory. That's 192 rows of 40 bytes per row. Then the screen memory for the first page of hi-res graphics is inconveniently located (if you've ever had an Applesoft BASIC program crash into the hires page you know what I mean) located from $2000-$3FFF in memory. The reason for this is so that if you bought an Apple ][ and only bought 16k of memory, you could still have one page of hi-res graphics. With only 32k, you can have two pages of graphics and still use DOS! But Apple went a step further. Instead of merely providing one-bit black-and-white graphics, Apple set the screen up to allow *four* colors on the hi-res screen. In order to do this, all of the even horizontal positions were assigned one color, and the odd positions assigned another. That's two colors. Then by using the eighth bit of the screen data byte to contain color set information for that byte (a pallette choice, if you will), the screen could accommodate four discrete colors, though only two in any given byte. That is a total of five colors: black, green, violet, orange, and blue. There is no such thing as a white point; but there are four ways to get a "white" point to appear on the screen: a) Plot a green point next to a violet point b) Plot an orange point next to a blue point c) Plot a green point next to a blue point (adjacent bytes) d) Plot a violet point next to an orange point (adjacent bytes) It's a clever way to get four colors onto the screen, but it can be a hassle if you're actually trying to use hi-res color. If color is not important to you and you are using the Applesoft drawing tools, set your HCOLOR to 3 or 7 to plot on all points. HI-RES COLOR TABLE: HCOLOR=0 Black (green/violet color set) HCOLOR=1 Green (odd pixels only) HCOLOR=2 Violet (even pixels only) HCOLOR=3 "white" (plot green and violet on all pixels) HCOLOR=4 Black (orange/blue color set) HCOLOR=5 Orange (odd pixels only) HCOLOR=6 Blue (even pixels only) HCOLOR=7 "white" (plot orange and blue on all pixels) To show how the color sets work, try this: ]HGR ]HCOLOR=3 ]HPLOT 1,0 TO 1,191 :REM Plots a vertical green line ]HCOLOR=4 ]HPLOT 0,0 TO 0,191 :REM The green line turns orange! ]HCOLOR=3 ]HPLOT 4,0 TO 4,191 :REM Orange line turns green; violet line appears ]HCOLOR=7 ]HPLOT 7,0 TO 7,191 :REM Orange line should appear ]HPLOT 10,0 TO 10,191 : REM Blue line should appear ]HCOLOR=2 :REM This should set color to violet ]HPLOT 140,0 TO 140,191 :REM Verify correct color ]HPLOT 0,0 TO 0,191 : REM Green line will turn white ]HCOLOR=6 ]HPLOT 8,0 TO 8,191:REM Orange line should turn white That ought to help a little 8-) --Dave Althoff, ][. -- /-\ _ _ /| __*** Closed for the season *** /XXX\ /X\ /X/ | _ /XX\_ _ _ _____ /XXXXX\ /XXX\ <#&>XX\_ /X\ /XXXXX\ /X\ /X\ /XXXXX _/XXXXXXX\__/XXXXX\/o==oXXXX\_/XXX\_/XXXXXXX\__/XXX\_/XXX\_/\_/XXXXXX