01.03.2014 Views

Section 2 - Commodore Computers

Section 2 - Commodore Computers

Section 2 - Commodore Computers

SHOW MORE
SHOW LESS

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

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

158 COMPUTE! May. 1982. 1982, Issue 24<br />

Extra Colors<br />

Extra Colors<br />

For Atari<br />

Through<br />

Artifacting<br />

Bill Mohn<br />

Danville, CA<br />

How can you getup to Four colors in GRAPH ICS<br />

How can you get up to four colors in GRAPHICS<br />

8' 8? The technique is called "artifacting"; it ii makes<br />

use of an otherwise unintended characteristic of a<br />

use of an otherwise uninte nded characte ristic or a<br />

color display tube.<br />

The highest resolution mode for the Atari is<br />

GRAPHICS 8. This niode mode includes 51,200 pixels<br />

(picture elements) arranged in a rectangular area<br />

extending 320 units horizontallyy aand 160 units<br />

vertically. Unlike modes 2 through 7, GRAPHICS<br />

8 normally all ows onl y one color at two brightnesses.<br />

8 normally allows only one color at two brightnesses.<br />

The background hue and luminance is determined<br />

by Color Register 2. "SETCOLOR 2,hue,lum"<br />

establishes Color Register 2. If left unset, it defaults<br />

establishes Color Register 2. If left unset, it defaults<br />

to dark blue.<br />

Colorr Register I, 1. which is set by SETCOLOR<br />

SETCOI.OR<br />

1 l,hue,lum is used onlyy to determine the luminance<br />

off graphics points. The hue off graphics points is<br />

determined by Color Register 2. A point is put on<br />

the screen by BASIC's BASIC'S PLOT or ORA DRAWTO commands.<br />

To be effective, a COLOR I 1 must preceed<br />

the first Iirst PLOT.<br />

In order to understand artif;,cting, artifacting. look closely<br />

at a color television screen. Youu will see closely<br />

spaced vertical stripes of red, , green and blue phosphor<br />

elements. If these are ill uminated equally, a<br />

phor elements. If these are illuminated equally, a<br />

white while picture is produced. Unequal illumination<br />

produces a ll of the other colors.<br />

produces all of the other colors.<br />

GRAPHICS 7 Versus 8<br />

A pixel in GRAPHICS 8 is the size of one half off<br />

one set of three color phosphor elements. IfI I' Color<br />

Register 1I luminance is relatively high and a graphics<br />

point is plotted ploued at an odd valued horizontal<br />

coordinate, only the blue phosphor will be li ghted.<br />

coordinate, only the blue phosphor will be lighted.<br />

If I f a shape is drawn, taking care to use only odd<br />

values for X, the entire shape will be blue.<br />

On the othe r hand, ir onl y even values of X<br />

On the other hand, if only even values of X<br />

are chosen, the red and green phosphors will be<br />

selected. The proportion of these will depend on<br />

selected . The proportion of these will d e pend on<br />

the e background hue (Color Register 2) aand the<br />

resulting "even-only" figure can range from red<br />

through brown to green. Ifboth even aand odd<br />

points are plotted, the background hue will result<br />

at a luminance specified ed by Color Registerr I. 1. Of<br />

course if neither even nor odd points are plotted, ploued,<br />

the result will be background hue and luminance.<br />

An interesting side effect occurs when an "even<br />

fi gure" overlaps a n "odd fi gure" - the area of<br />

figure" overlaps an "odd figure" — the area of<br />

overlap will be clearly visible.<br />

GRAPHICS 7 has pixels four times as large as<br />

G RAPH ICS 7 has pixels four tim es as large as<br />

GRAPHICS 8. That is, they are twice as wide aand<br />

twice as high. Since artifacting requires skipping<br />

half the points in the horizontal direction, the<br />

resolution in that direction with GRAPHICS 8<br />

approximately equals that of GRAPHICS 7. However,<br />

the vertical resolution of GRAPHICS 8 is<br />

twice that of GRAPHICS 7.<br />

The program here is a simple pie demons! monstration<br />

off these principles. It first uses GRAPHICS 8 to<br />

draw three overlappingg disks, thee upper r left using<br />

odd points only, the upper right using g even points<br />

only, and the lower using all points. Note that the<br />

lower disk does have better horizontal resolution<br />

than the otherr two. Afterr a deJa delay, the program<br />

m<br />

plots three similar ligures figures in GRAPI1ICS H ICS 7. Youu<br />

will see that these disks have horizontal resulution<br />

resolution<br />

equal to and vertical resolution worse than the<br />

previous upper disks.<br />

previous upper disks.<br />

You u may explore the variety of colors possible<br />

with artifacting by changing the two SKTCOI.OR<br />

with artifacring by cha ngin g the twO SETCOLOR<br />

stateme nts. Statements 4000 through 4 120 may be<br />

statements. Statements 4000 through ■! 120 may be<br />

inserted to cause all 960 possible SETCOLOR<br />

combinations to be displayed. This will step through<br />

all combinations ns as long as START is depressed.<br />

Notes On The Sample Program<br />

1000-1200 Make an array of Y Y-values corresponding to<br />

X-values for circles.<br />

1300-1500 Setup for the first display in GRAPHICS 8.<br />

1600-1900<br />

Draw upper-left figure using odd points only.<br />

2000-2300<br />

Draw upper-right figure using even pointsonly.<br />

only,<br />

3000-3300<br />

Draw lower figure using even and odd points.<br />

3400<br />

A delay loop to allow viewing the first display.<br />

5000-5600<br />

Setup and draw first figure in GRAPHICS 7.<br />

5700-7300<br />

Draw second and third figures.<br />

Figures.<br />

9000-9100<br />

Anotherr delay loop followed by a return to repeat.<br />

4000-4120 Three nested loops sstepping through all possible<br />

hues and luminances.<br />

4060 The ""arrow" is entered by typing ESC, CTRL,<br />

CLEAR<br />

4090 This loops until either r START, SELECT, or<br />

OPTION is d epressed.<br />

180<br />

280<br />

300<br />

480<br />

500<br />

600<br />

700<br />

RBI<br />

RBI<br />

REM<br />

REM<br />

REM<br />

REM<br />

REM<br />

OPTION is depressed.<br />

"tr&k "it "it it it i: ■& Scm<br />

*<br />

* DEMONSTRATION OF<br />

t<br />

*<br />

* ARTIFACTING IN GRAF-HICS 8 *<br />

t<br />

*<br />

*<br />

*<br />

BY BILL MOHN<br />

*<br />

*<br />

180 REM *****************************<br />

200 REM 300 REM ID1ONSTRATION ~ 4B0 REM * ~TIFICTII{; IN GRAPHICS a *<br />

500 REM 600 REM 8Y BILL totI 700 REM * *

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

Saved successfully!

Ooh no, something went wrong!