HOW TO PEEK
In using this book, we are going to change the values that are stored in many of the BYTEs that make up memory. To make the discussion easier, we will usually talk about the bytes as locations or addresses. These addresses are just like those on mailboxes on a long street. They start at 0 at one end of the street and increase until they reach 65535 at the other end (64K... remember). Yes, a computer's memory represents a long street. Let's look now at one such address. To see what is inside the location, we will use a BASIC command called PEEK. Prototype loves to peek at things.
To PEEK at memory location 764, type in this line:
10 PRINT PEEK (764):GOTO 10
Type "RUN", press the RETURN key, and watch the number 255 print over and over on your screen. Now press the space bar and you should see 33 printing. What is happening? 764 is the location that tells you what key is being pressed. 255 means no key and 33 means the space bar. Now you can see how a program could know if you have pressed a certain key. Try a program something like this:
10 A = PEEK (764)
20 IF A=33 THEN PRINT"YOU PRESSED THE SPACE BAR"
30 GOTO 10
Now you can see why it is important to read this book. It would be very difficult to know which location to PEEK at without a map of your computer's memory. It's a good thing that old Professor Von Chip is such a good mapmaker.
Return to Table of Contents | Previous Chapter | Next Chapter