SCAS SCAN (BYTE OR SCAS

WORD) STRING

Operation:

Flags Affected:

(LSRC) - (RSRC)

AF,CF,OF,PF,SF,ZF

if (OF) = 0 then (01) ~ (01) + OELTA

 

else (01) ~ (01) - OELTA

 

Description:

seAS destination-string

SCAS (Scan String) subtracts the destination string element (byte or word) addressed by DI from the content of AL (byte string) or AX (word string) and updates the flags, but does not alter the destination string or the accum- ulator. SCAS also updates DI to point to the next string element and AF, CF, OF, PF, SF and ZF to reflect the relationship of the scan value in ALIAX to the string element. If

SCAS is prefixed with REPE or REPZ, the operation is interpreted as "scan while not end-of-string (CX not 0) and string-element = scan-value (ZF = 1)." This form may be used to scan for departure from a given value. If SCAS is prefixed with REPNE or REPNZ, the operation is interpreted as "scan while not end-of-string (CX not 0) and string-element is not equal to scan-value (ZF = 0)." This form may be used to locate a value in a string.

Encoding:

11010111wl

if w = 0 then LSRC = AL, RSRC = (01), OELTA = 1 else LSRC = AX, RSRC = (01) +1:(01), OELTA = 2

SCAS Operands

Clocks*

Transfers

Bytes

SCAS Coding Example

dest-string

15(19)

1

1

SeAS INPUT_LINE

(repeat) dest-string

9 + 15(19)/rep

1/rep

1

REPNE SeAS BUFFER

*b(w): where b denotes the number of clock cycles for byte operands and w denotes the number of clock cycles for word operands.

2-149

Page 184
Image 184
Intel 210200-002 manual Scas Scan Byte or Scas Word String, 11010111wl, SeAS destination-string, + 1519/rep