Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Memory /
Chapter 2 - Memory Manager / Memory Manager Reference
Memory Manager Routines / Manipulating Blocks of Memory


BlockMove

To copy a sequence of bytes from one location in memory to another, you can use the BlockMove procedure.

PROCEDURE BlockMove (sourcePtr, destPtr: Ptr; byteCount: Size);
sourcePtr
The address of the first byte to copy.
destPtr
The address of the first byte to copy to.
byteCount
The number of bytes to copy. If the value of byteCount is 0, BlockMove does nothing.
DESCRIPTION
The BlockMove procedure moves a block of byteCount consecutive bytes from
the address designated by sourcePtr to that designated by destPtr. It updates
no pointers.

The BlockMove procedure works correctly even if the source and destination
blocks overlap.

SPECIAL CONSIDERATIONS
You can safely call BlockMove at interrupt time. Even though it moves memory, BlockMove does not move relocatable blocks, but simply copies bytes.

The BlockMove procedure currently flushes the processor caches whenever the number of bytes to be moved is greater than 12. This behavior can adversely affect your application's performance. You might want to avoid calling BlockMove to move small amounts of data in memory if there is no possibility of moving stale data or instructions. For more information about stale data and instructions, see the discussion of the processor caches in the chapter "Memory Management Utilities" in this book.

ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit for BlockMove are
Registers on entry
A0Pointer to source
A1Pointer to destination
D0Number of bytes to copy
Registers on exit
D0Result code

RESULT CODE
noErr0No error

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996