Topic – string – Ch. 11 [Marut] Ch. 4 [Brey] String Data Transfer Instructions – The Direction Flag – LODS Instructions – STOS Instructions – MOVS Instructions.

Slides:



Advertisements
Similar presentations
Judul Mata Kuliah Judul Pokok Bahasan 1/total Data Movement Instructions.
Advertisements

Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Addressing modes – 1 The way in which an operand is specified is called the Address Mode.
Lecture 2 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Princess Sumaya University
8-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 4 Data Movement Instructions by.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Microcomputer & Interfacing Lecture 3
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2014 Lecture 4: x86 memory.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
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.
Ch. 7 Logic, Shift and Rotate instr.
3.7 String Instructions Specifying the Operands’ Size and Address and the String Direction STRING = a data collection in memory. String ELEMENTS can be:
1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.
MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR1 Addressing Mode.
Types of Registers (8086 Microprocessor Based)
Lecture 4 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
ECE291 Computer Engineering II Lecture 3 Josh Potts University of Illinois at Urbana- Champaign.
Strings, Procedures and Macros
5. Assembly Language. Basics of AL Program data Pseudo-ops Array Program structures Data, stack, code segments.
ICS312 Lecture13 String Instructions.
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.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 4.
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.
ECE291 Computer Engineering II Lecture 3 Dr. Zbigniew Kalbarczyk University of Illinois at Urbana- Champaign.
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.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
Khaled A. Al-Utaibi  Introduction  The MOV Instruction  The LEA Instruction  The Stack Instructions  The String Data Transfer.
Lecture 6 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Intel MP Organization. Registers - storage locations found inside the processor for temporary storage of data 1- Data Registers (16-bit) AX, BX, CX, DX.
Chapter 8 String Operations. 8.1 Using String Instructions.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Assembly 07 String Processing.
ADDRESSING MODES.
Chapter 4 Data Movement Instructions
Lecture 4 Control Flow Structures (LOOPS)
EE3541 Introduction to Microprocessors
INSTRUCTION SET.
ADDRESSING MODES.
University of Gujrat Department of Computer Science
Assembly Lang. – Intel 8086 Addressing modes – 1
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
3.6 Data transfer Instructions
Chapter 4 Data Movement Instructions
8086 Registers Module M14.2 Sections 9.2, 10.1.
Morgan Kaufmann Publishers Computer Organization and Assembly Language
32-bit instruction mode(80386-Pentium 4 only)
Symbolic Instruction and Addressing
(Array and Addressing Modes)
Symbolic Instruction and Addressing
(Array and Addressing Modes)
T opic: S TRING I NSTRUCTION P RESENTED B Y: N OOR FATIMA M AHA AKRAM ASIF.
Computer Architecture CST 250
Data Movement Instructions
Unit-I 80386DX Architecture
Chapter 6 –Symbolic Instruction and Addressing
Intel 8086.
(Array and Addressing Modes)
Presentation transcript:

Topic – string – Ch. 11 [Marut] Ch. 4 [Brey] String Data Transfer Instructions – The Direction Flag – LODS Instructions – STOS Instructions – MOVS Instructions Few Examples

String Data Transfers 8086 – string  a byte or word array What is array? Need – register indirect addressing mode Allow mem2mem operations Five Instructions – LODS, STOS, MOVS, INS and OUTS Each instruction allows data transfer either a single byte, word or double word

Flags - recap 6 status flags 3 control flags – to control Processor’s ops.  Direction flag [DF]: to determine the direction in which string operations will proceed. By 2 index registers – Si and DI

Recap – ch. 3 write on board SP, BP, SI and DI – point to [contain the offset addresses of] mem locations. SP – stack pointer BP – base pointer SI – source index register is used to point to mem locations in the data segment addressed by DS [DS is one of the Segment registers – CS-code/DS- data/SS-stack/ES-extra segment] DI – Destination index – same as DI. Esp. for string ops that use DI to access memory locations addressed by ES.

The Direction Flag, DF DF = 0, auto-increment mode of SI, DI DF = 1, auto-decrement mode of SI, DI CLD instruction clears the D flag (D = 0) – clears direction flag STD instruction sets the D flag (D = 1) – sets DF CLD, STD have no effect on other flags SI (Source Index) points to DS (Data Segment) i.e., DS:[SI] DI (Destination Index) points to ES (Extra Segment) i.e., ES:[DI]

LODS Instructions LODS instructions loads AL [with a Byte], AX [with a Word] or EAX [with a Boubleword] with data indexed by SI register [EAX for 80386/+] LODSB – load string byte LODSW – load string doubleword Table 4-10: from Brey’s book

Example STRING1 DB‘ABC’ MOV MOV DS, AX LEA SI, STRING1 CLD LODSB Read

STOS Instructions STOS instructions stores data form AL, AX or EAX to memory indexed by DI register STOSB – store string byte Table 4-11: from Brey’s book

Example STRING1 DB‘HELLO’ MOV MOV ES, AX LEA DI, STRING1 CLD MOV AL, ‘A’ STOSB Read

MOVS Instructions MOVS – move string from one memory location to other Table 4-13 : From Brey’s Book

Example.DATA STRING1DB ‘HELLO’ STRING1 DB 5 DUP (?) MOV MOV DS, AX MOV ES, AX LEASI, STRING1 LEADI, STRING2 CLD MOVSB Read

Agenda String Data Transfer Instructions – The Direction Flag – LODS Instructions – STOS Instructions – MOVS Instructions More Examples Read

Concatenate Two Input Strings Then Display Input String 1: Hello Input String 2: World! Concatenated String: Hello World! Display message 1 Read first string Display message 2 Read second string Concatenate the two strings Display the result

Display message 1 Read first string Display message 2 Read second string Concatenate the two strings Display the result Display message 1 Read first string

Display message 1 Read first string Display message 2 Read second string Concatenate the two strings Display the result Display message 2 Read second string

Display message 1 Read first string Display message 2 Read second string Concatenate the two strings Display the result Concatenate the two strings Display the result

References materials are from Dr. Sazzad, NSU Ch 11, Assembly Language Programming – by Charls Marut Section 4-4, Intel Microprocessors – by Brey