SCAS : Scan String Byte or String Word:-
This instruction scans a string of words or byte for an operand word or byte specified in the register AL or register AX. The string is pointed to by ES: DI register pair. The length of the string is stored in register CX. The DF controls the mode for scanning of the string as stated in the case of MOVSB instruction. Whenever a match to the mention operand is found in string, execution stops and the zero flag is goes set. If no match is found, the zero flag is reset. The REPNE prefix is utilized with the SCAS instruction. The counters and pointers are updated automatically, until a match is found. Following string of instructions elaborates the use of SCAS instruction.
This string of instructions finds out, if contains WORD. If the WORD is found in the word string, before register CX becomes zero, the ZF is set, or else the ZF is reset. The scanning will continue until a match is found. Once a match is establish, the execution of the programme furtherproceeds.