<s>
In	O
computing	O
,	O
PEEK	B-Language
and	I-Language
POKE	I-Language
are	O
commands	O
used	O
in	O
some	O
high-level	B-Language
programming	I-Language
languages	I-Language
for	O
accessing	O
the	O
contents	O
of	O
a	O
specific	O
memory	B-Algorithm
cell	I-Algorithm
referenced	O
by	O
its	O
memory	B-General_Concept
address	I-General_Concept
.	O
</s>
<s>
PEEK	O
gets	O
the	O
byte	O
located	O
at	O
the	O
specified	O
memory	B-General_Concept
address	I-General_Concept
.	O
</s>
<s>
These	O
commands	O
originated	O
with	O
machine	B-General_Concept
code	I-General_Concept
monitors	I-General_Concept
such	O
as	O
the	O
DECsystem-10	B-Device
monitor	O
;	O
</s>
<s>
these	O
commands	O
are	O
particularly	O
associated	O
with	O
the	O
BASIC	O
programming	O
language	O
,	O
though	O
some	O
other	O
languages	O
such	O
as	O
Pascal	B-Application
and	O
COMAL	B-Language
also	O
have	O
these	O
commands	O
.	O
</s>
<s>
These	O
commands	O
are	O
comparable	O
in	O
their	O
roles	O
to	O
pointers	O
in	O
the	O
C	B-Language
language	I-Language
and	O
some	O
other	O
programming	O
languages	O
.	O
</s>
<s>
One	O
of	O
the	O
earliest	O
references	O
to	O
these	O
commands	O
in	O
BASIC	O
,	O
if	O
not	O
the	O
earliest	O
,	O
is	O
in	O
Altair	B-Language
BASIC	I-Language
.	O
</s>
<s>
The	O
PEEK	B-Language
and	I-Language
POKE	I-Language
commands	O
were	O
conceived	O
in	O
early	O
personal	O
computing	O
systems	O
to	O
serve	O
a	O
variety	O
of	O
purposes	O
,	O
especially	O
for	O
modifying	O
special	O
memory-mapped	B-Architecture
hardware	B-General_Concept
registers	I-General_Concept
to	O
control	O
particular	O
functions	O
of	O
the	O
computer	O
such	O
as	O
the	O
input/output	B-General_Concept
peripherals	O
.	O
</s>
<s>
manipulate	O
a	O
game	O
program	B-Application
to	O
allow	O
the	O
user	O
to	O
cheat	O
)	O
.	O
</s>
<s>
Today	O
it	O
is	O
unusual	O
to	O
control	O
computer	O
memory	O
at	O
such	O
a	O
low	O
level	O
using	O
a	O
high-level	B-Language
language	I-Language
like	O
BASIC	O
.	O
</s>
<s>
As	O
such	O
the	O
notions	O
of	O
PEEK	B-Language
and	I-Language
POKE	I-Language
commands	O
are	O
generally	O
seen	O
as	O
antiquated	O
.	O
</s>
<s>
The	O
terms	O
peek	B-Language
and	I-Language
poke	I-Language
are	O
sometimes	O
used	O
colloquially	O
in	O
computer	O
programming	O
to	O
refer	O
to	O
memory	O
access	O
in	O
general	O
.	O
</s>
<s>
The	O
PEEK	O
function	O
and	O
POKE	O
commands	O
are	O
usually	O
invoked	O
as	O
follows	O
,	O
either	O
in	O
direct	B-Application
mode	I-Application
(	O
entered	O
and	O
executed	O
at	O
the	O
BASIC	O
prompt	O
)	O
or	O
in	O
indirect	O
mode	O
(	O
as	O
part	O
of	O
a	O
program	B-Application
)	O
:	O
</s>
<s>
A	O
valid	O
address	O
in	O
this	O
context	O
is	O
an	O
address	O
within	O
the	O
computer	O
's	O
address	B-General_Concept
space	I-General_Concept
,	O
while	O
a	O
valid	O
value	O
is	O
(	O
typically	O
)	O
an	O
unsigned	O
value	O
between	O
zero	O
and	O
the	O
maximum	O
unsigned	O
number	O
that	O
the	O
minimum	O
addressable	O
unit	O
(	O
memory	B-Algorithm
cell	I-Algorithm
)	O
may	O
hold	O
.	O
</s>
<s>
The	O
address	O
locations	O
that	O
are	O
POKEd	O
or	O
PEEKed	O
at	O
may	O
refer	O
either	O
to	O
ordinary	O
memory	B-Algorithm
cells	I-Algorithm
or	O
to	O
memory-mapped	B-Architecture
hardware	B-General_Concept
registers	I-General_Concept
of	O
I/O	B-General_Concept
units	O
or	O
support	O
chips	O
such	O
as	O
sound	O
chips	O
and	O
video	O
graphics	O
chips	O
,	O
or	O
even	O
to	O
memory-mapped	B-Architecture
registers	O
of	O
the	O
CPU	O
itself	O
(	O
which	O
makes	O
software	O
implementations	O
of	O
powerful	O
machine	B-General_Concept
code	I-General_Concept
monitors	I-General_Concept
and	O
debugging/simulation	O
tools	O
possible	O
)	O
.	O
</s>
<s>
As	O
an	O
example	O
of	O
a	O
POKE-driven	O
support	O
chip	O
control	O
scheme	O
,	O
the	O
following	O
POKE	O
command	O
is	O
directed	O
at	O
a	O
specific	O
register	B-General_Concept
of	O
the	O
Commodore	O
64	O
's	O
built-in	O
VIC-II	O
graphics	O
chip	O
,	O
which	O
will	O
make	O
the	O
screen	O
border	O
turn	O
black	O
:	O
</s>
<s>
A	O
similar	O
example	O
from	O
the	O
Atari	B-Device
8-bit	I-Device
family	I-Device
tells	O
the	O
ANTIC	B-General_Concept
display	O
driver	O
to	O
turn	O
all	O
text	O
upside-down	O
:	O
</s>
<s>
The	O
difference	O
between	O
machines	O
,	O
and	O
the	O
importance	O
and	O
utility	O
of	O
the	O
hard-wired	O
memory	B-General_Concept
locations	I-General_Concept
,	O
meant	O
that	O
"	O
memory	B-Architecture
maps	I-Architecture
"	O
of	O
various	O
machines	O
were	O
important	O
documents	O
.	O
</s>
<s>
An	O
example	O
is	O
Mapping	O
the	O
Atari	O
,	O
which	O
starts	O
at	O
location	O
zero	O
and	O
mapped	O
out	O
the	O
entire	O
64	O
kB	O
memory	O
of	O
the	O
Atari	B-Device
8-bit	I-Device
systems	O
location	O
by	O
location	O
.	O
</s>
<s>
North	O
Star	O
Computers	O
,	O
a	O
vendor	O
from	O
the	O
early	O
1980s	O
,	O
offered	O
their	O
own	O
dialect	O
of	O
BASIC	O
with	O
their	O
NSDOS	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
BBC	B-Language
BASIC	I-Language
,	O
used	O
on	O
the	O
BBC	B-Device
Micro	I-Device
and	O
other	O
Acorn	O
Computers	O
machines	O
,	O
did	O
not	O
feature	O
the	O
keywords	O
PEEK	B-Language
and	I-Language
POKE	I-Language
but	O
used	O
the	O
question	O
mark	O
symbol	O
(	O
?	O
</s>
<s>
)	O
,	O
known	O
as	O
query	O
in	O
BBC	B-Language
BASIC	I-Language
,	O
for	O
both	O
operations	O
,	O
as	O
a	O
function	O
and	O
command	O
.	O
</s>
<s>
The	O
end	O
of	O
the	O
string	O
is	O
marked	O
with	O
the	O
Carriage	O
return	O
character	O
(	O
0D	O
in	O
ASCII	B-Protocol
)	O
;	O
when	O
read	O
back	O
,	O
this	O
terminating	O
character	O
is	O
not	O
returned	O
.	O
</s>
<s>
BASIC	O
XL	O
for	O
the	O
Atari	B-Device
8-bit	I-Device
family	I-Device
uses	O
a	O
"	O
D	O
"	O
(	O
for	O
"	O
double	O
"	O
)	O
prefix	O
:	O
DPEEK	O
and	O
DPOKE	O
.	O
</s>
<s>
The	O
Sinclair	B-Device
QL	I-Device
has	O
PEEK_W	O
and	O
POKE_W	O
for	O
16-bit	O
values	O
and	O
PEEK_L	O
and	O
POKE_L	O
for	O
32-bit	O
values	O
.	O
</s>
<s>
ST	B-Language
BASIC	I-Language
for	O
the	O
Atari	O
ST	O
uses	O
the	O
traditional	O
names	O
but	O
allows	O
defining	O
8/16/32	O
bit	O
memory	O
segments	O
and	O
addresses	O
that	O
determine	O
the	O
size	O
.	O
</s>
<s>
The	O
Commodore	O
64	O
,	O
ZX	B-Operating_System
Spectrum	I-Operating_System
and	O
Amstrad	B-Device
CPC	I-Device
also	O
allowed	O
players	O
with	O
the	O
relevant	O
cartridges	O
or	O
Multiface	B-Device
add-on	O
to	O
freeze	O
the	O
running	O
program	B-Application
,	O
enter	O
POKEs	O
,	O
and	O
resume	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Knight	B-Application
Lore	I-Application
for	O
the	O
ZX	B-Operating_System
Spectrum	I-Operating_System
,	O
immunity	O
can	O
be	O
achieved	O
with	O
the	O
following	O
command	O
:	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
value	O
201	O
corresponds	O
to	O
a	O
RET	B-Language
instruction	I-Language
,	O
so	O
that	O
the	O
game	O
returns	O
from	O
a	O
subroutine	O
early	O
before	O
triggering	O
collision	O
detection	O
.	O
</s>
<s>
Such	O
codes	O
were	O
generally	O
identified	O
by	O
reverse-engineering	O
the	O
machine	B-Language
code	I-Language
to	O
locate	O
the	O
memory	B-General_Concept
address	I-General_Concept
containing	O
the	O
desired	O
value	O
that	O
related	O
to	O
,	O
for	O
example	O
,	O
the	O
number	O
of	O
lives	O
,	O
detection	O
of	O
collisions	O
,	O
etc	O
.	O
</s>
<s>
Modern	O
operating	B-General_Concept
systems	I-General_Concept
enforce	O
virtual	B-Architecture
memory	I-Architecture
protection	O
schemes	O
to	O
deny	O
external	O
program	B-Application
access	O
to	O
non-shared	O
memory	O
(	O
for	O
example	O
,	O
separate	O
page	B-General_Concept
tables	I-General_Concept
for	O
each	O
application	O
,	O
hence	O
inaccessible	O
memory	O
spaces	O
)	O
.	O
</s>
<s>
"	O
POKE	O
"	O
is	O
sometimes	O
used	O
to	O
refer	O
to	O
any	O
direct	O
manipulation	O
of	O
the	O
contents	O
of	O
memory	O
,	O
rather	O
than	O
just	O
via	O
BASIC	O
,	O
particularly	O
among	O
people	O
who	O
learned	O
computing	O
on	O
the	O
8-bit	O
microcomputers	B-Architecture
of	O
the	O
late	O
1970s	O
and	O
early	O
1980s	O
.	O
</s>
<s>
BASIC	O
was	O
often	O
the	O
only	O
language	O
available	O
on	O
those	O
machines	O
(	O
on	O
home	O
computers	O
,	O
usually	O
present	O
in	O
ROM	B-Device
)	O
,	O
and	O
therefore	O
the	O
obvious	O
,	O
and	O
simplest	O
,	O
way	O
to	O
program	B-Application
in	O
machine	B-Language
language	I-Language
was	O
to	O
use	O
BASIC	O
to	O
POKE	O
the	O
opcode	B-Language
values	O
into	O
memory	O
.	O
</s>
<s>
Doing	O
much	O
low-level	O
coding	O
like	O
this	O
usually	O
came	O
from	O
lack	O
of	O
access	O
to	O
an	O
assembler	B-Language
.	O
</s>
<s>
An	O
example	O
of	O
the	O
generic	O
usage	O
of	O
POKE	B-Language
and	I-Language
PEEK	I-Language
is	O
in	O
Visual	B-Language
Basic	I-Language
for	I-Language
Windows	I-Language
,	O
where	O
DDE	B-Operating_System
can	O
be	O
achieved	O
with	O
the	O
LinkPoke	O
keyword	O
.	O
</s>
