X86-assembly/Instructions/scasb

From aldeid
Jump to navigation Jump to search
VoirAussi.png
You might also see: repne

Description

  • The SCAS instruction is used to scan a string (SCAS = SCan A String). It compares the content of the accumulator (AL, AX, or EAX) against the current value pointed at by ES:[EDI].
  • When used together with the REPNE prefix (REPeat while Not Equal), SCAS scans the string searching for the first string element which is equal to the value in the accumulator.

The instruction scasb searches the memory for the byte in EAX, starting at EDI:

  • Compare a byte of memory with the AL register
  • Increments EDI by 1 after each byte comparison
  • Decreases ECX by 1 after each byte comparison
ZF = AL == BYTE PTR[EDI]