13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

24594 Rev. 3.10 February 2005 AMD64 TechnologySCASSCASBSCASWSCASDSCASQScan StringCompares the AL, AX, EAX, or RAX register with the byte, word, doubleword, orquadword pointed to by ES:rDI, sets the status flags in the rFLAGS register accordingto the results, <strong>and</strong> then increments or decrements the rDI register according to thestate of the DF flag in the rFLAGS register.If the DF flag is 0, the instruction increments the rDI register; otherwise, itdecrements it. The instruction increments or decrements the rDI register by 1, 2, 4, or8, depending on the size of the oper<strong>and</strong>s.The forms of the SCASx instruction with an explicit oper<strong>and</strong> address the oper<strong>and</strong> atES:rDI. The explicit oper<strong>and</strong> serves only to specify the size of the values beingcompared.The no-oper<strong>and</strong>s forms of the instruction use the ES:rDI registers to point to the valueto be compared. The mnemonic determines the size of the oper<strong>and</strong>s <strong>and</strong> the specificregister containing the other comparison value.For block comparisons, the SCASx instructions support the REPE or REPZ prefixes(they are synonyms) <strong>and</strong> the REPNE or REPNZ prefixes (they are synonyms). Fordetails about the REP prefixes, see “Repeat Prefixes” on page 10. A SCASxinstruction can also operate inside a loop controlled by the LOOPcc instruction.Mnemonic Opcode DescriptionSCAS mem8SCAS mem16SCAS mem32SCAS mem64AEAFAFAFCompare the contents of the AL register with the byte at ES:rDI,<strong>and</strong> then increment or decrement rDI.Compare the contents of the AX register with the word at ES:rDI,<strong>and</strong> then increment or decrement rDI.Compare the contents of the EAX register with the doubleword atES:rDI, <strong>and</strong> then increment or decrement rDI.Compare the contents of the RAX register with the quadword atES:rDI, <strong>and</strong> then increment or decrement rDI.SCASx 265

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!