This informative article contains a checklist of references,
Pandora Charms Store Social Media Policy, but its sources continue to be unclear because it's inadequate inline citations. Please assist to boost this article by introducing much more precise citations where suitable. (May possibly 2010) This short article relies largely or entirely on a single supply. Please aid improve this informative article by introducing proper citations to further sources. (Could 2010) This informative article might contain original research. Please enhance it by verifying the statements manufactured and adding references. Statements consisting only of original research might be taken out. More details may be accessible around the chat page. (Might 2010)
In computing, PEEK is really a Standard programming language extension utilized for reading the contents of the memory cell at a specified address.[1] The corresponding command to set the contents of the memory cell is POKE.[2]
one Statement syntax
two Memory cells and hardware registers
3 POKEs as cheats
four Peek and Poke in BBC Basic
five Generic utilization of "POKE"
six See also
7 References [edit] Statement syntax
The PEEK perform and POKE command are generally invoked as follows, possibly in immediate mode (entered and executed at the Simple prompt) or in indirect mode (as aspect of a plan):
The handle and value parameters may possibly incorporate complicated expressions, as long as the evaluated expressions correspond to valid memory addresses or values, respectively. A valid handle in this context is definitely an handle inside the computer's whole handle area or the CPU's addressing range, whichever will be the smallest, whilst a valid value is (usually) an unsigned appeal in between zero as well as the highest unsigned quantity which the minimal addressable unit (memory cell) might maintain.
For instance, a common early 1980s home computer might have 32 KB of main memory, and an 8-bit microprocessor,
Tiffany Novo, using a 16-bit handle range,
Tiffany Key, during which case the allowable values to the PEEK and POKE parameter values would be:
0 <= address <= 32767 ; comment: 32767 = 32K-1 = 2^15-1, ; i.e. smaller than the CPU's 16-bit address assortment ; from 0 to 65535 = 64K-1 = 2^16-1 0 <= appeal <= 255 ; comment: 255 = 2^8-1, ; i.e. the utmost worth of an 8-bit byte [edit] Memory cells and hardware registers
The handle locations POKEd to or PEEKed from may refer either to ordinary memory cells or to memory-mapped hardware registers of I/O units or support chips such as sound chips and video graphics chips, or even to memory-mapped registers of the CPU itself (making possible the software implementation of powerful machine code monitors and debugging/simulation tools). As an illustration of POKE-driven support chip control, 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:
Pre and non-PC computers usually differ as to the memory deal with areas designated for user programs, user data, operating system code and data, and memory-mapped hardware units. For these reasons, PEEK functions and POKE commands are inherently non-portable, meaning that a given sequence of those statements will almost certainly not work on any system other than the one for which the plan was written.
[edit] POKEs as cheats
In the context of games for many 8-bit computers, it was a common practice to load games into memory and, before launching them, modify specific memory addresses in order to cheat, getting an unlimited number of lives, immunity, invisibility, etc. Such modifications were performed using POKE statements. The Commodore 64, ZX Spectrum and Amstrad CPC also allowed players with the relevant cartridges or Multiface add-on to freeze the running plan, enter POKEs, and resume.
For instance, in Knight Lore for that ZX Spectrum, immunity can be achieved with the following command:
In this circumstance, the appeal 201 corresponds to a RET instruction,
Tiffany Jewelry Sale, so the game returns from a subroutine early before triggering collision detection.
Magazines such as Microhobby published lists of such POKEs for games. Such codes were generally identified by reverse-engineering the machine code to locate the memory deal with containing the desired value that related to, for example, the quantity of lives, detection of collisions, etc.
Using a 'POKE' cheat is much more difficult in modern games,
Tiffany Necklace Heart, as many include anti-cheat or copy-protection measures that inhibit modification of the game's memory space. Modern operating systems could also enforce virtual memory protection schemes to deny external plan access to non-shared memory (for example, separate page tables for each application,
Tiffany Online, hence inaccessible memory spaces).
[edit] Peek and Poke in BBC Fundamental
BBC Fundamental, used around the BBC Micro and other Acorn Computers machines, did not feature the keywords PEEK and POKE but utilised the question mark symbol (?), known as query in BBC Simple, for both operations, as a functionality and command. For example:
32-bit values could be POKEd and PEEKed using the exclamation mark symbol (!), known as pling, with the least significant byte first (little-endian). In addition, the deal with could be offset by specifying both query or pling after the handle and following it with the offset:
Strings of text could be PEEKed and POKEd in a similar way using the Dollar sign ($). The end of the string is marked with the Carriage return character (&0D in ASCII); when read back, this terminating character is not returned. Offsets cannot be utilised with the dollar sign.
[edit] Generic use of "POKE"
"POKE" is sometimes employed as a generic term to refer to any immediate manipulation of the contents of memory, rather than just via Basic, particularly among people who learned computing around the 8-bit microcomputers of the late 70s and early 80s. Fundamental was often the only language available on those machines (on property computers, typically present in ROM), and therefore the obvious, and simplest, way to software in machine language was to use Fundamental to POKE opcode values contained in DATA statements into memory. Doing much low-level coding like this typically came from lack of access to an assembler.
An illustration of the generic utilization of POKE and PEEK is in traditional Visual Fundamental for Windows, where DDE can be achieved with the LinkPoke keyword.
[edit] See also Killer poke
Type-in program
Self-modifying code [edit] References