PEEK and POKE

POKE ( engl. to poke = poke, poke ) is a software command, the BASIC programming language that is used to write directly in a cell of the memory of a computer. His counterpart is the PEEK command to read memory cells directly.

Function

The POKE command invokes a routine of the BASIC interpreter, which converts a decimal number to a dual, and writes to a memory address. The PEEK command returns the contents of a memory address returned as a decimal number.

POKE address value The maximum value of the address depends on the width of the address bus and the actual installed memory. The maximum value depends on the width of the data bus.

POKE 55296, 2 Colors on the Commodore 64, the sign in the first screen top left position red. Here is 55296, the first memory address to the one of the video display controller reads the color information and 2, the value to be entered to the color red

Use

The PEEK and POKE commands were introduced by Bill Gates and Paul Allen in 1975 in the programming language Altair BASIC.

In the era of home computers of the POKE command is often used, as this was often the only way for BASIC programs to use on hardware register specific graphics or sound capabilities of the computer. This greatly reduced the readability and comprehensibility of programs and provided also that such programs were in no way portable between different computer models and their different chipsets - even POKE commands were not often between different models or variants of the same manufacturer transferable.

As with the POKE command also pointers and operating system data could be overwritten, it is not often came to a neat error message, but to a computer crash, the destruction of the program or data in memory or undesirable visual or audible effects. In the best case also happened just about anything, troubleshooting was often considerably more difficult.

In the days of 8 -bit computer with limited memory and low CPU speed peripherals are often controlled directly by the operating system, waiving a driver architecture. Special functions were partially used only by strings. These were entered with POKE commands.

Today's meaning

In today's systems, and using current BASIC variants, the use of POKE is obsolete. For other programming languages ​​( compilers languages) generate the native code, POKE is generally not required. Today's CPUs use to address education exclusively the MMU, which abstracts the logical address of the physical and special protective mechanisms, the direct memory manipulation prevents (Memory Protection Fault ). In addition, modern operating systems have, with few exceptions no longer a static memory allocation scheme in which certain content can be found at the same addresses always. Is then accessed on hardware resources do not have fixed addresses, but on device drivers which read again for the designated storage areas and describe.

654545
de