The cmpsb instruction is used to compare a byte in the memory address specified by esi with a byte in the memory address specified by edi, to determine if they contain the same data. The cmpsb is normally used with repe (repe cmpsb) to compare two memory buffers; in this case, ecx will be set to the buffer length, and the comparison will continue until ecx=0 or the buffers are not equal.