POKE

BASin

POKE

Statement/Command

POKE is used to change the value of the byte at a particular address in memory. Values are normally POKEd to memory locations in order to produce actions not given by BASIC keywords.

How to use POKE

POKE is used to form a statement in a program or as a command. It is followed by two numeric values separated by a comma, for example

POKE 23609,255

The two values following POKE are rounded to the nearest integers if necessary. The first value may then range from 0 to 65535 and is an address in RAM (Note: The BASIC ROM inhabits the range from 0 to 16384 and is read-only, so POKEing to that range will have no effect). The second value may range from -255 to 255 and is the byte to be written to the defined address.

In the above example, 255 is POKEd to address 23609, which controls the sound produced when a key is pressed. A value of 255 gives a long beep instead of the normal click, with other values producing a shorter beep.

Format

  • POKE int-num-expr,int-num-expr

See also

Chapter 14.