166 of 318
ZBasic System Library 156 ZX Microcontroller Family MemCmp Type Function returning Integer Invocation MemCmp(addr1, addr2, count) Parameter Method Type Description addr1 ByVal integral The address of the first block of memory to be compared. addr2 ByVal integral The address of the second block of memory to be compared. count ByVal integral The number of bytes to compare. Discussion This function can be used to compare two arbitrary sequences of data in RAM. If all of the bytes in the two blocks are the same (over the given number of bytes to compare) the value zero is returned. Otherwise, the return value will be greater than zero if at the position of the first mismatch the byte in the first block is greater than the corresponding byte in the second block. If the converse is true, the return value will be less than zero. All three parameters are converted internally to UnsignedIntege®. Example Dim a1(1 to 10) as Byte Dim a2(1 to 10) as Byte Dim ival as Integer ival = MemCmp(a1.DataAddress, a2.DataAddress, SizeOf(a1)) Compatibility This function is not available in BasicX compatibility mode. See Also MemCopy, MemSet