EEE342-MP-9b-String instructions-CMPS, LODS, STOS
EEE342-MP-9b-String instructions-CMPS, LODS, STOS
and
Interfacing
• String manipulation
• Instructions CMPS, SCAS, LODS, STOS
Slides courtesy:
1. Book ‘The Intel Microprocessors, Architecture,
Programming and Interfacing” , 7ed, by Barry B. Brey
2. http://www.pcpolytechnic.com/computer/ppt/micro/Chap
%203_1.pptx
8086 Microprocessor
Instruction Set
8086 and above instruction set includes instruction for string movement,
comparison, scan, load and store.
2
8086 Microprocessor
Instruction Set
CMPS
CMPS
4
8086 Microprocessors
Instruction Set
Example procedure
5
8086 Microprocessor
Instruction Set
6
8086 Microprocessor
Instruction Set
SCAS
SCASW
MAE = (ES) x 1610 + (DI)
Modify flags (AX) - (MAE)
8
8086 Microprocessor
Instruction Set
• After loading AL with ONE byte, AX with TWO bytes, or EAX with
FOUR bytes, the contents of SI is either increment (if D=0) by 1, 2 or 4,
Or the contents of SI is decrement (if D=1) by 1, 2 or 4.
9
8086 Microprocessor
Instruction Set
LODS
10
8086 and Above
Microprocessors
Instruction Set
11
8086 and Above
Microprocessors
Instruction Set
12
8086 Microprocessor
Instruction Set
• Stores AL, AX, or EAX (in 80386 and above) at the extra segment
memory location addressed by DI.
13
8086 Microprocessor
Instruction Set
STOS
14
8086 Microprocessor
Instruction Set
15