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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 13-ADVANCED MOVES 15124 NEXT X25 HGR : REM SET GRAPHICS254 REM255 REM HERE GOES! !256 REM26 FOR X = 1 TO 2827 POKE A%(Q%(X) ),T%(R%(X) ):POKE A% ( Q%(X ) + 1) ,H%(R%( X) )28 NEXT X29 END294 REM295 REM DATA TABLE296 REM3 DATA 126,1,124, 3,12,7, 112,1531 DATA 96, Jl,64,63,, 127Listing 13-2.Lines 100, 160, and 200 through 270 are the only new mod ifications.The arrays Q% and R% hold the quotients and remainders fo r each ofthe 280 X-coordinates. Dividing the X v<strong>al</strong>ue by 7 gives you the offs<strong>et</strong> (0-39)used to address the correct byte ac ross the screen, and <strong>al</strong>so which of theseven versions of the figure should be used (Remember?).Lines 160-180 fi ll array A% with the addresses for each of the 40 bytesacross the screen line, and lines 220-240 c<strong>al</strong>culate the 280 quotients andremainders. Fin<strong>al</strong>ly, line 250 turns on Hi-Res, and line 270 does the actu<strong>al</strong>POKEing.Sorry about the compound indexing [A%(Q%(X))], but it could not behelped. X is the coordinate number, so Q%(X) is the quotient belonging tothat coordinate, and A%(Q%(X)) is the address d<strong>et</strong>ermi ned by that quotient.This new version of the program runs the line across the screen in sevenseconds, as opposed to nine in the earlier one. Now, seven seconds is stillpr<strong>et</strong>ty slow (blame BASIC), but pre-c<strong>al</strong>culating did result in a significantimprovement (22 percent, since you asked.)Pre-sh<strong>ii</strong>ng ·And now, on to perhaps the most elegant of the techniques: pre-shifting.We are going to animate using a shape table, so take a couple of minutesnow to enter it. From BASIC type:CALL -151

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

Saved successfully!

Ooh no, something went wrong!