INTRODUCTION TO THE APPLE

The Apple II computer was chosen for this book for several reasons, the most important of which are its high-resolution 280h × 193v eight-color display, its powerful vector graphics language statements, and its moderate cost (under $1200). Keep in mind that other computers feature vector graphics and dense display matrices (although not as dense as the Apple) and therefore most of the concepts covered here also apply to them.

An exhaustive list of the features of the Apple would be too large for this book, but we can summarize those most important for good graphics work:

Before we jump into using high-resolution graphics to accomplish special effects we need to learn a little about Apple's version of BASIC, the screen format of the Apple, and the graphics statements provided as part of BASIC.

Applesoft

Applesoft is Apple's enhancement of Microsoft's popular floating-point BASIC language. (Microsoft BASIC is the de facto standard BASIC used by almost every personal computer manufacturer today, including the TRS-80, PET 2001, Atari, etc.) Applesoft has almost all the standard keywords and features of Microsoft BASIC including its 9-digit arithmetic and a large function library. A complete discussion of Microsoft BASIC can be found in Mitch Waite and Michael Pardee, BASIC Primer. In addition to Microsoft's standard features, Applesoft contains a set of powerful high- and low-resolution graphics statements. This book describes the use of the high-resolution graphics statements and assumes you have a minimal knowledge of Microsoft BASIC or a BASIC similar to it. Applesoft is supplied on diskette, cassette tape, or ROM. The ROM version was used in this book.

High-Resolution Screen Format

The format and organization of the Apple's high-resolution screen is shown in Appendix B. The “hires” screen defaults to an organization of 280h × 160v (that is, 280 horizontal columns by 160 vertical rows) with a four-line text scrolling window at the screen bottom. This gives a total of 44,800 dots you can control from Applesoft. The text window can be removed (via a specific POKE instruction) giving a increased graphics format of 280h × 193v, or 54,040 dots. Any line of text in the scrolling window can hold up to 40 characters. Six colors are available for a dot: black, white, violet, green, blue, and orange. Older Apples lack blue and orange in the high-resolution mode.

Graphics Keywords

There are seven keywords, or instructions, that are part of Applesoft and are used especially for hires graphics: HGR, HCOLOR, HPLOT, SHLOAD, DRAW, SCALE, and ROT. The last four, namely SHLOAD, DRAW, SCALE, and ROT are used with Apple “shape tables” and are described later in the book. The first three keywords, HGR, HCOLOR, and HPLOT, are used frequently in high-resolution programs and therefore will be defined and explained first. The definitions of these keywords follow:

HGR

Graphics Mode. Switches the computer into the high-resolution graphics mode, clears the screen top area to black, and provides bottom four lines of text. 8K bytes of RAM memory (Page 1; 8K to 16K) is displayed.

HCOLOR = expr

Set Color. Sets the high-resolution graphics color to that specified by the value of expression (expr),* which must be in the range 0 to 7, inclusive. Color names and their values are:

0 black 4 black2
1 green 5 orange
2 violet 6 blue
3 white 7 white2

On early Apples color 5 = green and 6 = blue. Black2 and white2 are normally used with orange and blue colors.

HPLOT expr1, expr2

Plot a dot. Plots a high-resolution dot whose x coordinate is (expr1) and whose y coordinate is (expr2). The color of the dot is determined by the most recently executed HCOLOR statement. Expression expr1 must be in the range of 0 through 279 while expression expr2 must be in the range of 0 through 191. An attempt to plot a point whose coordinates exceed these limits causes the ?ILLEGAL QUANTITY ERROR message.

Now you should be prepared to begin your programming.


Return to Table of Contents | Previous Section | Next Section