String Instructions



 CMPS Des, Src:
  • It compares the string bytes or words.


 SCAS String:
  • It scans a string.
  • It compares the String with byte in AL or with word in AX.


 MOVS / MOVSB / MOVSW:
  • It causes moving of byte or word from one string to another.
  • In this instruction, the source string is in Data Segment and destination string is in Extra Segment.
  • SI and DI store the offset values for source and destination index.


 REP (Repeat):
  • This is an instruction prefix.
  • It causes the repetition of the instruction until CX
  • becomes zero.
E.g.: REP MOVSB STR1, STR2
  • It copies byte by byte contents.
  • REP repeats the operation MOVSB until CX becomes zero.