PEEK$ function

Purpose:

PEEK$ returns a block of bytes from a specified memory location.

Syntax:

ByteBlock = PEEK$(Address, ByteBlockSize AS INTEGER)

Return Value:

  • Data type: STRING
    ByteBlock A block of bytes from memory.

Parameters:

  • Data type: Identifier
    Address The memory address of beginning of block of bytes.
  • Data type: INTEGER
    ByteBlockSize The size of a memory block of bytes.
' =====================================
' Example using PEEK and POKE in BCX
' to quickly copy one array to another,
' which is MUCH faster than using a
' FOR-NEXT loop to move each element
' =====================================

DIM a![10000]
DIM b![10000]

FOR integer i = 0 TO 9999
 a![i] = i + 0.1
NEXT

POKE(b,PEEK$(a,SIZEOF(a)),SIZEOF(a))

FOR integer i = 0 TO 9999
 PRINT b![i] ' now contains the same data as in A![]
NEXT