Download presentation
Presentation is loading. Please wait.
Published bynoor fatima Modified over 5 years ago
2
T opic: S TRING I NSTRUCTION P RESENTED B Y: N OOR FATIMA M AHA AKRAM ASIF
3
An Instruction is binary pattern design in microprocessor to perform a specific The entire group of instruction that the microprocessor support is called Instruction Set. Instruction Set
4
Data Transfer Instruction. Bit manipulation instruction. Arithmetic instruction. Program execution transfer instruction String instruction Process control insrtuction. CLASSIFICATION OF INSTRUCTION SET
5
It is the classification of Instruction Set. String in assembly language is just a sequentially stored bytes o words By using these string instruction the size of the program is considerably reduced STRING INSTRUCTION
6
A special prefix repeats the instruction in hardware called the REP Prefix The REP Prefix allow these instruction to operate on a number of data element in one instruction REP repeats the following string instruction CX times. There are two REP Prefix REPE REPNE What is REP Prefix
7
Firstly they all work on a block of data. DI and SI are used to access memory. SI and DI are called Source Index and Destination Index because of string instruction. In this case override is possible. Whenever a string instruction needs a memory destination, ES:DI holds the pointer to it. No override is possible in this case Whenever a Byte register is needed, AL holds the value. Whenever a Word register is used AX holds the value. If DF(Direction Flag) is Cleared, this is called auto-increment If DF is Se t, this is called auto-decrement. EXPLANATION
8
Cld ; clear the direction flag Std ;set direction flag There are two Instruction
9
STOS LODS SCAS MOVS CMPS TYPES OF STRING INSTRUCTION
10
Stands for Store Information. STOS transfer a byte or word from register AL or AX to string element addressed by ES:DL and update DI to point to the next location. STOS Memory AX
11
EXAMPLE OF STOS
12
Stands for LOAD STRING. LODS transfers a byte or word from the source location DS:SI to AL or AX and update SI to point to the next location. LODS is generally used in a loop. LODS memory AX
13
EXAMPLE OF LODS
14
Stands for SCAN STRING. SCAS compares a source byte or word in register AL or AX with the destination string element addresses by ES:DI and update the flags. The prefixes REPE (Repeat while equal) and REPNE (Repeat while not equal) are used with this instruction. SCAS memory AX OR AL Compare from
15
EXAMPLE OF SACS
16
MOVS transfer a byte or word from the source location DS:SI to the destination ES:DI and updates SI and DI to point to the next location. MOVS is used to move a block of memory. MOVS memory MOVE MOVE Date f
17
EXAMPLE OF MOVS
18
Stands for COMPARE STRING. CMPS compare two blocks of memory for equality or inequality of block. CMPS subtracts the source location DS:SI from the destination location ES:DI. Source and destination are unaffected. CMPS
19
EXAMPLE OF CMPS
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.