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.

CHAPTER 13-ADVANCED MOVES 149When you have everything keyed in correctly, you will see the digitseight, nine, and zero cycle on the Hi-Res screen. This was easily done byPOKEing the appropriate dot patterns into screen memory.For example, the numer<strong>al</strong>s.eight and nine are composed of eight rows ofdots which correspond to byte v<strong>al</strong>ues as shown below.DOT BIT DECIMAL DOT BIT DECIMALPATTERN PATTERN VALUE PATTERN PATTERN VALUE------------------------------------------------------------XXXX--X----X-X----X--XXXX--X----X-X----X--XXXX--------!il!illl ll!iJ!iJ!ill!il!il !il!ill!il!ill!il!il !il!ill!il!il!illl ll!iJ!iJ!ill!il!il !il!ill!il!ill!il!il !il!ill!il!il!illl ll!il!il!il!il!il!il !il!il!il!il6!iJ66666!iJ66666!iJ!iJ--XXXX--X----X-X----X--XXXX-------X------X--XXXX--------!iJ!illl ll!iJ!il!ill!il!il !iJl!iJ!il!ill!il!il !il!ill!il!il!illl ll!iJ!il!ill!il!il !il!ill!il!ill!il!il !il!ill!il!il!illl ll!il!il!il!il!il!il !il!il!il!il6!iJ66666!iJ66666!il!iJFigure 13-1.Now, if you take a minute to compare the v<strong>al</strong>ues used for eight withthose used for nine, you should notice that <strong>al</strong>l except two of the v<strong>al</strong>ues ar<strong>et</strong>he same. So the question natur<strong>al</strong>ly arises, "Since nine <strong>al</strong>ways followseight, why should I POKE <strong>al</strong>l the v<strong>al</strong>ues for the nine, when six of them ar<strong>et</strong>he same as before?!?" Funny you should ask!That is the idea behind parti<strong>al</strong> mod ification-<strong>al</strong>ter the existing figureinstead of tot<strong>al</strong>ly replacing it. Type these lines to change the previouslisting.13 REM14!il POKE 12288,64: POKE 13312 ,6419!il POKE 11264,662!iJ!iJ POKE 12288,66: POKE 13312 ,66Now lines 13© and 14© will POKE only the changes needed to turn theeight into the nine, and similarly lines 19© and 2©© POKE the changesrequired to turn nine into zero. When you run the program you will notsee much difference, but you will have the satisfaction of knowing thatyour code is more efficient.Granted, the time savings is insignificant in this example, but if you ar<strong>et</strong>rying to animate 15© bytes worth of Zylon spaceship, or what have you,parti<strong>al</strong> n1odification could potenti<strong>al</strong>ly save a great de<strong>al</strong> of time.Pre-c<strong>al</strong>culationThe next topic to consider is pre-c<strong>al</strong>culation. When a figure is moving

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

Saved successfully!

Ooh no, something went wrong!