Scan String                                 

86/88

Y

186

Y

286

Y

386

Y

486

Y

SCAS/SCASB/SCASW/SCASD destination

Ovfl

Y

Dir

N

Int

N

Trap

N

Sign

Y

Zero

Y

Aux

Y

Prty

Y

Carry

Y

    This instruction compares the accumulator (AL or AX) to the byte or
    word pointed to by ES:DI. SCAS sets the flags according to the results
    of the comparison; the operands themselves are not altered. After the
    comparison, DI is incremented (if the direction flag is cleared) or
    decremented (if the direction flag is set), in preparation for
    comparing the next element of the string.

       Notes:         This instruction is always translated by the
                      assembler into either SCASB, Scan String Byte, or
                      SCASW, Scan String Word, depending upon whether
                      destination-string refers to a string of bytes or
                      words. In either case, however, you must explicitly
                      load the DI register with the offset of the string.

                      SCAS is useful for searching a block for a given
                      byte or word value. Use CMPS, Compare String, if you
                      wish to compare two strings (or blocks) in memory,
                      element by element.

------------------------------------ Timing ----------------------------------

OpCode          Instruction             386     286     86
AE              SCAS m8                 7       7       15
AF              SCAS m16                7       7       15
AF              SCAS m32                7
AE              SCASB                   7       7       15
AF              SCASW                   7       7       15
AF              SCASD                   7

------------------------------------ Logic -----------------------------------

        CMP accumulator, (ES:DI)
        if DF = 0
                DI = DI + n
        else
                DI = DI - n

See Also CMP CMPS LODS MOVS STOS REP REPE REPNE CLD STD Flags


Copyright © 1985 to 2022 Beta Systems                            Last modified: Wednesday, January 05, 2022 .