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 7- PRESERVING YOUR PICTURES 61The POKEs in line 45 are very important because they provide the subroutinewith the starting address of the data area. If the data area begins ata different location, then you will have to adjust these POKEs. The way toc<strong>al</strong>culate the v<strong>al</strong>ues is to write down the starting address in hex ($9200),separate the two bytes so that it looks like 92 00, and convert each byte todecim<strong>al</strong>: $92 = 9* 16 + 2 = 146, $00 = 0. Those are the two v<strong>al</strong>ues tobe POKEd into 252 and 253, but they must be POKEd in the correct orderor strange things will happen. Apple wants you to give it the right-hand(low order) byte fi rst and then the left-hand (high order) byte-a conspiracyknown as Lo-byte/Hi-byte-so the 0 is placed in 252 and the 146 in253.Example 1Suppose that the subroutine in Listing 7-7 has <strong>al</strong>ready been POKEdinto memory, and that you want to display a picture which is stored at$8E©C.$8E = 8*16 + 14 142$C = *16 + 12 12so you wouldPOKE 252,12: POKE 253, 142CALL 768A fu rther note of caution: The starting address must be POKEd just prior toCALLing the subroutine. APPLESOFT uses location 253 fo r scratch padmemory, so after the CALL is executed BASIC clobbers whatever v<strong>al</strong>ue youhad in there.Sound Assembly1 BuglerIf you speak assembly language, Listing 7-8 may be of interest. It is theassembly listing of the subroutine used in Listing 7-7.SOURCEL EPZ $FCSOURCEH EPZ $FDDES TL EPZ $FEDES TH EPZ $FF; INITIALIZATION3- A9 32- 85 FE34- A835- A9 4LDASTATAYLDA#DES TL

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

Saved successfully!

Ooh no, something went wrong!