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 12-BYTE-MOVE SHAPES 141POKE 8192,32POKE 8192,64The dot will move to the right, and the last statement will leave the dotat the right edge of byte number 8192. To continue the journey, the dotmust move to the first dot of byte number 8193, and then continue acrossthat byte. To accomplish that, you can type the same series of v<strong>al</strong>ues, butuse 8193 as the address:POKE 8193 ,1POKE 8193 ,2POKE 8193 ,4POKE 8193,8POKE 8193 ,16POKE 8193 ,32POKE 8193 ,64This pattern will repeat until you g<strong>et</strong> through address 8231, or you g<strong>et</strong>tired of it, whichever comes first.As you can see, each position across the byte requires a different v<strong>al</strong>ue,and there are seven positions across the byte, so seven becomes a veryimportant number. You can <strong>al</strong>so see that the last dot in every byte youtravelled across was left on. As we mentioned befo re, some arrangementmust be made to erase the last v<strong>al</strong>ue before moving on to the next byte.POKEing a zero as the fi n<strong>al</strong> v<strong>al</strong>ue in each series will erase that left-overdot.To move the dot across byte number 16 in that row (the row starts withbyte number (/)), you would fi nd the add ress by adding the offs<strong>et</strong>, 16, to thebase address, 8192 (did everybody g<strong>et</strong> 82(/)8?), and then POKE the series ofv<strong>al</strong>ues using that address.There is a nice relationship b<strong>et</strong>ween the X-coordinate of a point and theoffs<strong>et</strong> and v<strong>al</strong>ue needed to refer to it in byte-move. Consider the sevenv<strong>al</strong>ues used to move the dot across the byte as seven versions of the dot,and number them zero through six. If you wish to turn on a particular dotacross the row, you need to d<strong>et</strong>ermine which version of the dot to POKE,and the offs<strong>et</strong> from the beginning of the row.For example, l<strong>et</strong>' s turn on the dot in the fi rst row which has an X­coordinate of 75. Divide the coordinate by seven to fi nd the quotient (theresult of the division) and remainder. Seven goes into 75 ten times (rememberyour g'zintas?) with five remaining. The quotient (1(/J) is the offs<strong>et</strong>, andthe remainder (5) is the number of the separation (versions of the dot) tobe used. Therefore, the address is 82(/)2 (8192 + 1(/J), and the v<strong>al</strong>ue is 32.So,POKE 822,32and you will turn on the dot having 75 as its X-coord inate.

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

Saved successfully!

Ooh no, something went wrong!