Using Peek; Using Poke - Commodore 128 System Manual

Table of Contents

Advertisement

Using PEEK

PEEK can be used to make the computer tell you what value is
being stored in a memory location (a memory location can store
any value between 0 and 255). You can PEEK the value of any
memory location (RAM or ROM) in DIRECT or PROGRAM mode.
Type:
P=PEEK(2594)
? P
agTiiafrp
The computer assigns the value in memory location 2594 to the
variable P when you press RETURN after the first line. Then it
prints the value when you press RETURN after entering the ? P
command. Memory location 2594 determines whether or not keys
like the spacebar and CRSR repeat when you hold them down. A
128 in location 2594 tells the computer to repeat these keys
when you hold them down. Hold down the spacebar and watch
the cursor move across the screen.

Using POKE

To change the value stored in a RAM location, use the POKE
command. Type:
POKE 2594,96 HCTUOU
The computer stores the value after the comma (96) in the
memory location before the comma (2594). A 96 in memory
location 2594 tells the computer not to repeat keys like the
spacebar and CRSR keys when you hold them down. Now hold
down the spacebar and watch the cursor. The cursor moves one
position to the right, but it does not repeat. To return your
computer to its normal state, type:
POKE 2594,128 9 S I E I
You cannot alter the value of all the memory locations in the
computer—the values in ROM can be read, but not changed.
NOTE: These examples assume you are in bank 0. See the
description of the BANK command in Chapter V, BASIC 7.0
Encyclopaedia for details on banks.
ntrutttt
4-19

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents