Lecture 6 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

Slides:



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

Register In computer architecture, a processor register is a small amount of storage available on the CPU whose contents can be accessed more quickly than.
Judul Mata Kuliah Judul Pokok Bahasan 1/total Data Movement Instructions.
DOS and BIOS Interrupts DOS and BIOS interrupts are used to perform some very useful functions, such as displaying data to the monitor, reading data from.
Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
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.
The 8086 Assembly Programming Data Allocation & Addressing Modes
Lecture 2 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
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.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 4 Data Movement Instructions by.
Microcomputer & Interfacing Lecture 3
Topic – string – Ch. 11 [Marut] Ch. 4 [Brey] String Data Transfer Instructions – The Direction Flag – LODS Instructions – STOS Instructions – MOVS Instructions.
Topics Control Flow Structure – Conditional Jump – Unconditional Jump Control Flow Structures – IF-THEN – IF-THEN-ELSE – CASE Branches with Compound Conditions.
Microprocessor Programming II
Lecture 8 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
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:
Lecture 13 Basic I/O Interface
11.1/36 Repeat: From Bits and Pieces Till Strings.
Lecture 4 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
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)
Lecture 5 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
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.
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.
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.
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.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Khaled A. Al-Utaibi  Introduction  The MOV Instruction  The LEA Instruction  The Stack Instructions  The String Data Transfer.
Lecture 11 Text mode video
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.
Introduction to 8086 Microprocessor
BYTE AND STRING MANIPULATON
ADDRESSING MODES.
Chapter 4 Data Movement Instructions
Lecture 4 Control Flow Structures (LOOPS)
EE3541 Introduction to Microprocessors
INSTRUCTION SET.
ADDRESSING MODES.
Assembly Lang. – Intel 8086 Addressing modes – 1
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
8086 MICROPROCESSOR PROGRAMMING – INTEGER INSTRUCTIONS AND COMPUTATIONS Amar Saraswat.
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
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-I 80386DX Architecture
Chapter 6 –Symbolic Instruction and Addressing
CNET 315 Microprocessor & Assembly Language
Presentation transcript:

Lecture 6 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU

Agenda String Data Transfer Instructions – The Direction Flag – LODS Instructions – STOS Instructions – MOVS Instructions – INS and OUTS Instructions More Examples

String Data Transfers Five Instructions – LODS, STOS, MOVS, INS and OUTS Each instruction allows data transfer either a single byte, word or double word

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) STD instruction sets the D flag (D = 1) 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, AX or EAX with data indexed by SI register LODSB – load string byte Table 4-10: from Brey’s book

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

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

REP (Repeat Prefix)) REP is used to execute string instructions repeatedly by CX times. REP automatically decrements CX by 1 REP works for any string instructions except LODS instruction

Example : Clear the video text display **** ****** abc 07H Video display Text memory cbacba 20H B800H Example 4-5: From Brey’s Book

MOVS Instructions MOVSB – move string byte 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

Example: Scroll Up One Line **** ****** Video display Text memory B800H Example 4-6: From Brey’s Book 160 **** **** SI DI

INS Instructions INSB – Input String Byte, from I/O device to memory location Table 4-14: From Brey’s Book

Example Read 50 bytes of data from an I/O device whose address in 03ACH and store the data in LISTS array Example 4-7: From Brey’s Book

OUTS Instructions OUTSB – Output String Byte, from string memory location to I/O device Table 4-15: From Brey’s Book

Example Transfer data form memory array (ARRAY) to an I/O device at I/O address 3ACH Example 4-8: From Brey’s Book

Agenda String Data Transfer Instructions – The Direction Flag – LODS Instructions – STOS Instructions – MOVS Instructions – INS and OUTS Instructions More Examples

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

Mid Term, Fall 2010 October 30, Saturday At 9:00 AM to 10:30 NAC 311

References Ch 11, Assembly Language Programming – by Charls Marut Section 4-4, Intel Microprocessors – by Brey