Peek$ and poke – Remote Processing CAMBASIC User Manual

Page 128

Advertising
background image

Comm ands - 95

PEEK$ and POKE$

Memory Function and Statement

SYNTAX:

x$ = PEEK$( address)
x$ = PEEK$( address, segment )

POKE $ address, X$
POKE$ address, X$, segment

PURPOSE:

PEE K$ returns a str ing from succ essive mem ory addr esses.
POKE$ w rites a string to memory.

REMARK S:

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.

NOTE: Due to compiler memory allocation, executing PEEK$ in the immediate mode will return an
error 30, < Expected )> error.

RELATED:

DPEE K, DP OKE, PEEK, FPEE K, PO KE, F POKE

EXAMPLE:

10 A$ = "string"
20 B$ = " stuffer"
30 POKE$ 0,A$,1
40 POKE$ 10,B$,1
50 PRINT PEEK$(0,1);PEEK$(10,1)
RUN

string stuffer

ERROR:

< Data negative> – for address, data and segment
< Data > 65,535> – for address
< String too long> – if string > 254 characters
< Data range> – if segment > 15

Advertising