Peek and poke – Remote Processing CAMBASIC User Manual

Page 127

Advertising
background image

Comm ands - 94

PEEK and POKE

Memory Function and Statement

SYNTAX:

n = PEEK( address)
n = PEEK( address,segment )
POKE address, data
POKE address, data, segm ent

PURPOSE:

PEEK returns a byte from m emory.
POKE w rites a byte to memory.

REMARK S:

The returned value from PEEK w ill be an integer in the range 0 to 255. address is the addre ss in
mem ory. PEE K is the com plement to th e POK E statem ent.

The first syntax applies to the first 64K of memor y (segment 0). F or addresses above segment 0,
use the second syntax. Not all products support segmented mem ory.

RELATED:

DPEE K, DP OKE, PEEK$, POKE$, FPEE K, FP OKE

EXAMPLE:

10 A=PEEK(&7000)

10 A=PEEK (&2000,1)
20 POKE &A000, 12, 1

ERROR:

< Data negative> – for address, data and segment
< Data > 65,535> – for address
< Data out of range> – if segment > 15

Advertising