Briefly explain CMPS-00516
This subjective question is related to the book/course vu cs304 Object Oriented Programming. It can also be found in vu cs304 Mid Term Solved Past Paper No. 1.
Question 1: Briefly explain CMPS.
Answer:
CMPS subtracts the source location DS:SI from the destination location ES:DI. Source and Destination are unaffected. SI and DI are updated accordingly. CMPS compares two blocks of memory for equality or inequality of the block. It subtracts byte by byte or word by word. If used with a REPE or a REPNE prefix is repeats as long as the blocks are same or as long as they are different. For example it can be used for find a substring. A substring is a string that is contained in another string. For example "has" is contained in "Mary has a little lamp." Using CMPS we can do the operation of a complex loop in a single instruction. Only the REPE and REPNE prefixes are meaningful with this instruction