beautypg.com

Memcpy (copy memory), Memcpy1 (copy memory from offset), Memset (set memory) – Echelon Neuron User Manual

Page 190

background image

_memcpy (Copy Memory)

This function performs the equivalent of a memcpy() function for a non-zero

amount of data. len cannot be 0. Also, _memcpy does not handle overlapping

source and destinations.

Stack Transformation: (dst(2), src(2), len -- )
Location: Near
Registers Affected: P0 becomes the original “src”, and P3 becomes the original

“dst”

Example:
This example copies 4 bytes from h’eff0 to h’eff8.

pushs #d’4 ; (d’4)

pushd #h’eff0 ; (h’f0, h’ef, d’4)

pushd #h’eff8 ; (h’f8,h’ef,h’f0,h’ef,d’4)

call _memcpy ; ()

_memcpy1 (Copy Memory from Offset)

This function performs the equivalent of a memcpy() function from P0 to P3 for a

non-zero amount of data at a given offset. len cannot be 0.

Stack Transformation: (offset, len -- )
Location: near
Registers Affected: P0 must be “src” and P3 must be “dst”

Example:
This example copies four bytes at offset 3 from within P0 to P3. That is, P3[3] =

P0[3], and so on.

pushs #d’4 ; (d’4)

pushs #d’3 ; (d’3, d’4)

call _memcpy1 ; ()

_memset (Set Memory)

This function performs the equivalent of a memset() function for a non-zero

amount of data. len cannot be 0.

Stack Transformation: (dst(2), val, len -- )
Location: Near
Registers Affected: P0 becomes “dst”

180

System-Provided Functions