Dpeek and dpoke – Remote Processing CAMBASIC User Manual

Page 73

Advertising
background image

Comm ands - 40

DPEEK and DPOKE

Memory Function and Statement

SYNTAX:

n = DPEE K(address)
n = DPEE K (address, segment )

DPOKE address, data
DPOKE address, data, segm ent

PURPOSE:

DPE EK returns a 16– bit value from memor y.
DPO KE writes a 16– bit value to memory.

REMARK S:

A 16– bit word is form ed with the lower 8 bits as the value located at mem ory addr ess “ address
and the upper 8 bits as the value located at memory location “ address + 1” .

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

DPEE K is an extension of PEEK and executes twice as fast as two PEEK functions. DP OKE is an
extension of POK E and executes tw ice as fast as two pokes.

RELATED:

DPOKE, PEEK, FPEEK, PEEK$, POKE, FPOKE, POKE$

EXAMPLE:

The following routine POKEs or writes two numbers into memory. The DPEEK statement allows
both to be retrieved and printed ( 256 x 3 + 45 = 813). You could also say DP OKE 2000, 813.

10 POKE &A000,45 : POKE &A001,3
20 PRINT DPEEK(&A000)
RUN
813

10 A=DPEEK(1000,2)

T h is r et r ie v es d at a f r om address 1000 at segment 2.

ERROR:

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

Advertising