string manipulation instructions n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
string manipulation Instructions PowerPoint Presentation
Download Presentation
string manipulation Instructions

Loading in 2 Seconds...

play fullscreen
1 / 17

string manipulation Instructions - PowerPoint PPT Presentation


  • 115 Views
  • Uploaded on

string manipulation Instructions. 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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'string manipulation Instructions' - thuong


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
string introduction
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
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
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

slide6
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

mov string byte or word
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

string comparison
String comparison

data segment

str db "welcome to MIT$"

lenequ ($-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

repecmpsb

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
Length of the string

data segment

strdb "manipal$"

lendw ?

data ends

code segment

assume cs:code, ds:data, es:data

start: movax,data

movds,ax

moves,ax

mov al,'$'

lea di,str

mov cx,00h

cld

go: inc cx

scasb

jnz go

dec cx

movlen,cx

mov ah,4ch

int 21h

code ends

end start

equ equate
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_factorequ 03h

Add al,correction_factor ; add al,03h

length of the string1
Length of the string

data segment

str db "manipal$"

lenequ ($-str)

strlendw ?

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