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)

Slides:



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

Defining and processing tables
ICS312 Set 6 Operands. Basic Operand Types (1) Register Operands. An operand that refers to a register. MOV AX, BX ; moves contents of register BX to.
第 4 章习题参考答案: 2 、取 SIZE 属性 A1——2 字节( 4 ) A2——3 字节( 6 ) A3——20 字节( 40 ) A4——4 字节( 60 ) 4 、 L=6 5 、 PLENTH=22, 可用于确定循环次数。 7 、( AX ) =1 ( BX ) =20 ( CX ) =1.
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
8086 : INSTRUCTION SET By, Pramod Sunagar Assistant Professor
Assembly Language for Intel-Based Computers Chapter 5: Procedures Kip R. Irvine.
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
Review Questions Chapters What TUTOR command is used to enter a string of ASCII bytes into memory? /MA 2.What are the names of the 8086 index.
Topic – string – Ch. 11 [Marut] Ch. 4 [Brey] String Data Transfer Instructions – The Direction Flag – LODS Instructions – STOS Instructions – MOVS Instructions.
Factorial of a number data segment x1 db 4 fact dw ? data ends
Microprocessor Programming II
3.7 String Instructions Specifying the Operands’ Size and Address and the String Direction STRING = a data collection in memory. String ELEMENTS can be:
COSC 456 Lesson 8 Cool Codes ADD AL,SIAL AL + SI ADD AL,[SI]AL AL + [SI] INC BXBX BX + 1 INC [BX]Ambiguity error INC BYTE PTR [BX][BX] [BX] + 1 INC WORD.
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.
11.1/36 Repeat: From Bits and Pieces Till Strings.
Strings, Procedures and Macros
ICS312 Lecture13 String Instructions.
Writing and using procedures
Processing String Data and Binary Data (continue)
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.
Review of Assembly language. Recalling main concepts.
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 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.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#7) By Dr. Syed Noman.
Introduction to assembly programmıng language
Format of Assembly language
Presentation on Real Mode Memory Addressing
COURSE OUTCOMES OF MICROPROCESSOR AND PROGRAMMING
Assembly 07 String Processing.
BYTE AND STRING MANIPULATON
Chapter 9.
Chapter 4 Data Movement Instructions
EE3541 Introduction to Microprocessors
INSTRUCTION SET.
INSTRUCTION SET.
اصول اساسی برنامه نویسی به زبان اسمبلی
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
Chapter 4: Instructions
Chapter 4 Data Movement Instructions
Microprocessor Lab CSL1543 0:0:2
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
(Array and Addressing Modes)
Microprocessor Lab CSL1543 0:0:2
Assembly Language Programming
Symbolic Instruction and Addressing
(Array and Addressing Modes)
Assembly Language for Intel-Based Computers, 5th Edition
Flow Control Instructions
T opic: S TRING I NSTRUCTION P RESENTED B Y: N OOR FATIMA M AHA AKRAM ASIF.
X86 Assembly Review.
Data Movement Instructions
UNIT-II Assembly Language Programs Involving Logical
Chapter 6 –Symbolic Instruction and Addressing
CNET 315 Microprocessor & Assembly Language
(Array and Addressing Modes)
Presentation transcript:

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) Direction Flag (DF) - DF=0 ->increment - DF=1 ->decrement Counter CX

CLD: Clear Direction Flag Clear direction flag to 0 DF=0, SI and DI will automatically be incremented when one of the string instructions, such as MOVS, CMPS, or SCAS, Executes Syntax: CLD

STD: Set Direction Flag set direction flag to 1 DF=1, SI and DI will automatically be decremented when one of the string instructions, such as MOVS, CMPS, or SCAS, Executes Syntax: STD

REP…. REPE/REPZ: Repeat if Equal/Zero Termination condition: CX=0 or ZF=1 REPNE/REPNZ: Repeat if not Equal/Zero Termination condition: CX=0 or ZF=0

MOVS/MOVSB/MOVSW

Mov string byte or word data segment tr db "tis time for a new home$" new db 23 dup(0) data ends code segment assume cs:code, ds:data,es:data start: mov ax,data mov ds,ax mov es,ax lea si,str lea di,new mov cx,23 cld rep movsb mov ah,4ch int 21h code ends end start

Example

String comparison data segment str db "welcome to MIT$" len equ ($-str) input db "welcome to MIT$" aa db ? data ends code segment assume cs:code, ds:data, es:data start: mov ax,data mov ds,ax mov es,ax lea si,str lea di,input mov cx,len cld repe cmpsb jne do mov al,01 mov aa,al do:mov aa,02 mov ah,4ch int 21h code ends end start

Length of the string data segment str db "manipal$" len dw ? data ends code segment assume cs:code, ds:data, es:data start: mov ax,data mov ds,ax mov es,ax mov al,'$' lea di,str mov cx,00h cld go: inc cx scasb jnz go dec cx mov len,cx mov ah,4ch int 21h code ends end start

EQU-Equate Used to give a name to some value or symbol Each time the assembler finds the given name in the program, it will replace the name with the value or symbol you equated with the name. Example: Correction_factor equ 03h Add al,correction_factor ; add al,03h

Length of the string data segment str db "manipal$" len equ ($-str) strlen dw ? data ends code segment assume cs:code, ds:data, es:data start: mov ax,data mov ds,ax mov es,ax mov cx,len mov strlen,cx mov ah,4ch int 21h code ends end start