String Instructions String instructions were designed to operate on large data structures. The SI and DI registers are used as pointers to the data structures.

Slides:



Advertisements
Similar presentations
Princess Sumaya Univ. Computer Engineering Dept. Chapter 9:
Advertisements

Instruction Set of 8086 Engr. M.Zakir Shaikh
Judul Mata Kuliah Judul Pokok Bahasan 1/total Data Movement Instructions.
For the example slides do not click the mouse to see the full animation Microprocessor 1 Dr.Raed Al-qadi 2009 for the example slides do not click the mouse.
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
8086 : INSTRUCTION SET By, Pramod Sunagar Assistant Professor
Direct video practice and Keyboard Operations
Introduction to Computer Engineering by Richard E. Haskell Register Indirect Addressing Module M18.2 Section 12.3.
8-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
Assembly Language for Intel-Based Computers
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 4 Data Movement Instructions by.
Topic – string – Ch. 11 [Marut] Ch. 4 [Brey] String Data Transfer Instructions – The Direction Flag – LODS Instructions – STOS Instructions – MOVS Instructions.
Microprocessor Programming II
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 7: More on Addressing Modes, Structures, and Stack Constantine D. Polychronopoulos Professor, ECE.
3.7 String Instructions Specifying the Operands’ Size and Address and the String Direction STRING = a data collection in memory. String ELEMENTS can be:
Chapter Four-- The 80x86 Instruction Set Principles of Microcomputers 2015年10月6日 2015年10月6日 2015年10月6日 2015年10月6日 2015年10月6日 2015年10月6日 1 Chapter Four.
Text-mode Video Dr. Dimitrios S. Nikolopoulos CSL/UIUC
11.1/36 Repeat: From Bits and Pieces Till Strings.
String-Introduction String is a series of bytes or a series of words in sequential memory locations. Index registers - SI (Data segment) - DI (Extra segment)
Strings, Procedures and Macros
ICS312 Lecture13 String Instructions.
Processing String Data and Binary Data (continue)
Addressing Modes of 8086 Processor Ammar Anwar Khan Electrical Engineer King Saud University Riyadh Saudi Arabia.
Click to add Title Comunicación y Gerencia Click To add Subtitle Click to add Text Fundamentals of Assembly Language.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
Introduction to Assembly Language Programming 1. Overview of Assembly Language  Advantages:  Disadvantages: Faster as compared to programs written using.
String Instructions String instructions were designed to operate on large data structures. The SI and DI registers are used as pointers to the data structures.
String Processing Chapter 10 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
Microprocessor Programming II To discuss more complicated programming techniques Flag control instructions Compare and jump Subroutines Loop and string.
Khaled A. Al-Utaibi  I/O Ports  I/O Space VS Memory Space  80x86 I/O Instructions − Direct I/O Instructions − Indirect I/O Instructions.
LEA instruction The LEA instruction can be used to get the offset address of a variable Example ORG 100h MOV AL, VAR1 ; check value of VAR1 by moving it.
Review of Assembly language. Recalling main concepts.
Assembly 09. Outline Strings in x86 esi, edi, ecx, eax stosb, stosw, stosd cld, std rep loop 1.
Arrays. Outline 1.(Introduction) Arrays An array is a contiguous block of list of data in memory. Each element of the list must be the same type and use.
Khaled A. Al-Utaibi  Introduction  The MOV Instruction  The LEA Instruction  The Stack Instructions  The String Data Transfer.
Lecture 11 Text mode video
Lecture 6 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Chapter 8 String Operations. 8.1 Using String Instructions.
Chapter Nov-2010
Assembly Language for x86 Processors 6th Edition
Assembly 07 String Processing.
BYTE AND STRING MANIPULATON
8086 MICROPROCESSOR.
Today we are going to discuss about,
Instruction Set of 8086 Microprocessor
Chapter 9.
Chapter six of V4: The String Instructions
Chapter 4 Data Movement Instructions
EE3541 Introduction to Microprocessors
INSTRUCTION SET.
INSTRUCTION SET.
Intel 8088 (8086) Microprocessor Structure
Signed Numbers and Strings, Memory and Memory interfacing, 8255 I/O programming Module-3.
Symbolic Instruction and Addressing
3.6 Data transfer Instructions
Chapter 4 Data Movement Instructions
8086 Registers Module M14.2 Sections 9.2, 10.1.
Lecture 1 Instruction set of 8086 Лектор: Люличева И.А. 1.
Morgan Kaufmann Publishers Computer Organization and Assembly Language
32-bit instruction mode(80386-Pentium 4 only)
Symbolic Instruction and Addressing
Symbolic Instruction and Addressing
Assembly Language for Intel-Based Computers, 5th Edition
T opic: S TRING I NSTRUCTION P RESENTED B Y: N OOR FATIMA M AHA AKRAM ASIF.
Computer Architecture CST 250
CS-401 Computer Architecture & Assembly Language Programming
Data Movement Instructions
UNIT-II Assembly Language Programs Involving Logical
Chapter 6 –Symbolic Instruction and Addressing
CNET 315 Microprocessor & Assembly Language
Presentation transcript:

String Instructions String instructions were designed to operate on large data structures. The SI and DI registers are used as pointers to the data structures being accessed or manipulated. The operation of the dedicated registers stated above are used to simplify code and minimize its size.

String Instructions The registers(DI,SI) are automatically incremented or decremented depending on the value of the direction flag:  DF=0, increment SI, DI.  DF=1, decrement SI, DI. To set or clear the direction flag one should use the following instructions:  CLD to clear the DF.  STD to set the DF.

String Instructions The REP/REPZ/REPNZ prefixes are used to repeat the operation it precedes. String instructions we will discuss:  LODS  STOS  MOVS  CMPS  SCAS

LODS/LODSB/LODSW/LODSD Loads the AL, AX or EAX registers with the content of the memory byte, word or double word pointed to by SI relative to DS. After the transfer is made, the SI register is automatically updated as follows:  SI is incremented if DF=0.  SI is decremented if DF=1.

LODS/LODSB/LODSW/LODSD Examples:  LODSB AL=DS:[SI]; SI=SI  1  LODSW AX=DS:[SI]; SI=SI  2  LODSD EAX=DS:[SI]; SI=SI  4  LODS MEAN AL=DS:[SI]; SI=SI  1 (if MEAN is a byte)  LODS LIST AX=DS:[SI]; SI=SI  2 (if LIST is a word)  LODS MAX EAX=DS:[SI]; SI=SI  4 (if MAX is a double word)

LODS/LODSB/LODSW/LODSD

STOS/STOSB/STOSW/STOSD Transfers the contents of the AL, AX or EAX registers to the memory byte, word or double word pointed to by DI relative to ES. After the transfer is made, the DI register is automatically updated as follows:  DI is incremented if DF=0.  DI is decremented if DF=1.

STOS/STOSB/STOSW/STOSD Examples:  STOSB ES:[DI]=AL; DI=DI  1  STOSW ES:[DI]=AX; DI=DI  2  STOSD ES:[DI]=EAX; DI=DI  4  STOS MEAN ES:[DI]=AL; DI=DI  1 (if MEAN is a byte)  STOS LIST ES:[DI]=AX; DI=DI  2 (if LIST is a word)  STOS MAX ES:[DI]=EAX; DI=DI  4 (if MAX is a double word)

STOS/STOSB/STOSW/STOSD

MOVS/MOVSB/MOVSW/MOVSD Transfers the contents of the the memory byte, word or double word pointed to by SI relative to DS to the memory byte, word or double word pointed to by DI relative to ES. After the transfer is made, the DI register is automatically updated as follows:  DI is incremented if DF=0.  DI is decremented if DF=1.

MOVS/MOVSB/MOVSW/MOVSD Examples:  MOVSB ES:[DI]=DS:[SI]; DI=DI  1;SI=SI  1  MOVSW ES:[DI]= DS:[SI]; DI=DI  2; SI=SI  2  MOVSD ES:[DI]=DS:[SI]; DI=DI  4; SI=SI  4  MOVS MEAN ES:[DI]=DS:[SI]; DI=DI  1; SI=SI  1 (if MEAN is a byte)  MOVS LIST ES:[DI]=DS:[SI]; DI=DI  2; SI=SI  2 (if LIST is a word)  MOVS MAX ES:[DI]=DS:[SI]; DI=DI  4; SI=SI  4 (if MAX is a double word)

MOVS/MOVSB/MOVSW/MOVSD

CMPS/CMPSB/CMPSW/CMPSD Compares the contents of the the memory byte, word or double word pointed to by SI relative to DS to the memory byte, word or double word pointed to by DI relative to ES and changes the flags accordingly. After the comparison is made, the DI and SI registers are automatically updated as follows:  DI and SI are incremented if DF=0.  DI and SI are decremented if DF=1.

SCAS/SCASB/SCASW/SCASD Compares the contents of the AL, AX or EAX register with the memory byte, word or double word pointed to by DI relative to ES and changes the flags accordingly. After the comparison is made, the DI register is automatically updated as follows:  DI is incremented if DF=0.  DI is decremented if DF=1.

REP/REPZ/REPNZ These prefixes cause the string instruction that follows them to be repeated the number of times in the count register ECX or until:  ZF=0 in the case of REPZ (repeat while equal).  ZF=1 in the case of REPNZ (repeat while not equal).

REP/REPZ/REPNZ Use REPNE and SCASB to search for the character ‘f’ in the buffer given below. BUFFER DB ‘EE3751’ MOV AL,’f’ LEA DI,BUFFER MOV ECX,6 CLD REPNE SCASB JE FOUND

REP/REPZ/REPNZ Use REPNE and SCASB to search for the character ‘3’ in the buffer given below. BUFFER DB ‘EE3751’ MOV AL,’f’ LEA DI,BUFFER MOV ECX,6 CLD REPNE SCASB JE FOUND