PEEK and POKE

The terms peek and poke are sometimes used colloquially in computer programming to refer to memory access in general.

The PEEK function and POKE commands are usually invoked as follows, either in direct mode (entered and executed at the BASIC prompt) or in indirect mode (as part of a program): The address and value parameters may contain expressions, as long as the evaluated expressions correspond to valid memory addresses or values, respectively.

As an example of a POKE-driven support chip control scheme, the following POKE command is directed at a specific register of the Commodore 64's built-in VIC-II graphics chip, which will make the screen border turn black: A similar example from the Atari 8-bit computers tells the ANTIC display driver to turn all text upside-down: The difference between machines, and the importance and utility of the hard-wired memory locations, meant that "memory maps" of various machines were important documents.

North Star Computers, a vendor from the early 1980s, offered their own dialect of BASIC with their NSDOS operating system.

A Linux command line peekpoke [6] utility has been developed mainly for ARM based single board computers.

The Commodore 64, ZX Spectrum and Amstrad CPC also allowed players with one of the relevant cartridges (such as Action Replay or Multiface) to freeze the running program, enter POKEs, and resume.

For example, in Knight Lore for the ZX Spectrum, immunity can be achieved with the following command:[7] In this case, the value 201 corresponds to a RET instruction,[8] so that the game returns from a subroutine early before triggering collision detection.

"POKE" is sometimes used to refer to any direct manipulation of the contents of memory, rather than just via BASIC, particularly among people who learned computing on the 8-bit microcomputers of the late 1970s and early 1980s.

An example of the generic usage of POKE and PEEK is in Visual Basic for Windows, where DDE can be achieved with the LinkPoke keyword.

PEEK and POKE in line 100 of a Commodore Basic program on a CBM 3016