Page 193 of 346 Start Back Next End ZBasic System Library 181 ZBasic Microcontrollers MemCopy Type Subroutine Invocation MemCopy(destination, source, count) Parameter Method Type Description destination ByVal integral The address to which to begin copying. source ByVal integral The address from which to begin copying. count ByVal integral The number of bytes to copy. Discussion This subroutine can be used to copy a block of data from one location in RAM to another location. An overlapping copy (when the destination is in the midst of the data being copied) is handled correctly so that the data to be copied is not overwritten. All three parameters are converted internally to UnsignedInteger. Note that MemCopy() has the same functionality as BlockMove() but has a different parameter order; one that you may be accustomed to. Caution This subroutine should be used with care because it is possible to overwrite important data on the stack or other areas of memory which may cause your program to malfunction. Example Dim ba(1 to 10) as Byte Dim ival as Integer ba(3) = &H48 ba(4) = &H55 Call MemCopy(ival.DataAddress, ba(3).DataAddress, SizeOf(ival)) After execution, ival will have the value &H5548. Note the use of the SizeOf() function. This is a better programming practice than using a specific value because it makes the code easier to maintain. Compatibility This routine is not available in BasicX compatibility mode. See Also BitCopy, MemCmp, MemSet