SlideShare a Scribd company logo
String Processing Chapter 10 S. Dandamudi
Outline String representation Using string length Using a sentinel character String instructions Repetition prefixes Direction flag String move instructions String compare instructions String scan instructions Illustrative examples LDS and LES instructions Examples str_len str-cpy str_cat str_cmp str_chr str_cnv Indirect procedure call Performance: Advantage of string instructions
String Representation Two types Fixed-length Variable-length Fixed length strings Each string uses the same length Shorter strings are padded (e.g. by blank characters) Longer strings are truncated Selection of string length is critical Too large ==> inefficient Too small ==> truncation of larger strings
String Representation (cont’d) Variable-length strings Avoids the pitfalls associated with fixed-length strings Two ways of representation Explicitly storing string length (used in PASCAL) string  DB  ‘Error message’ str_len  DW  $-string $ represents the current value of the location counter $ points to the byte after the last character of  string Using a sentinel character (used in C) Uses NULL character Such NULL-terminated strings are called  ASCIIZ strings
String Instructions Five string instructions LODS LOaD String source STOS STOre String destination   MOVS MOVe String source  &  destination   CMPS CoMPare String source  &  destination   SCAS SCAn String destination   Specifying operands 32-bit segments: DS:ESI = source operand  ES:EDI = destination operand  16-bit segments: DS:SI = source operand  ES:DI = destination operand
String Instructions (cont’d) Each string instruction  Can operate on 8-, 16-, or 32-bit operands Updates index register(s) automatically Byte operands: increment/decrement by 1 Word operands: increment/decrement by 2 Doubleword operands: increment/decrement by 4 Direction flag DF = 0: Forward direction (increments index registers) DF = 1: Backward direction (decrements index registers) Two instructions to manipulate DF std set direction flag (DF = 1) cld clear direction flag (DF = 0)
Repetition Prefixes String instructions can be repeated by using a repetition prefix Two types Unconditional repetition rep REPeat Conditional repetition repe/repz    REPeat while Equal   REPeat while Zero repne/repnz  REPeat while Not Equal   REPeat while Not Zero
Repetition Prefixes (cont’d) rep while  (ECX    0) execute the string instruction ECX := ECX  1 end while ECX register is first checked If zero, string instruction is not executed at all More like the  JECXZ  instruction
Repetition Prefixes (cont’d) repe/repz while  (ECX    0) execute the string instruction ECX := ECX  1 if  (ZF = 0) then exit loop end if end while Useful with  cmps  and  scas  string instructions
Repetition Prefixes (cont’d) repne/repnz while  (ECX    0) execute the string instruction ECX := ECX  1 if  (ZF = 1) then exit loop end if end while
String Move Instructions Three basic instructions movs, lods, and stos Move a string (movs) Format movs  dest_string,source_string movsb  ; operands are bytes movsw  ; operands are words movsd   ; operands are doublewords First form is not used frequently Source and destination are assumed to be pointed by DS:ESI and ES:EDI, respectively
String Move Instructions (cont’d) movsb  --- move a byte string ES:EDI:= (DS:ESI) ; copy a byte if  (DF=0) ; forward direction  then ESI := ESI+1 EDI := EDI+1  else   ; backward direction ESI := ESI  1 EDI := EDI  1 end if Flags affected: none
String Move Instructions (cont’d) Example .DATA string1  db  'The original string',0 strLen  EQU  $ - string1 .UDATA string2  resb  80 .CODE .STARTUP mov  AX,DS  ; set up ES mov  ES,AX  ;  to the data segment mov  ECX,strLen  ; strLen includes NULL mov  ESI,string1 mov  EDI,string2 cld  ; forward direction rep  movsb
String Move Instructions (cont’d) Load a String (LODS) Copies the value from the source string  at DS:ESI to  AL ( lodsb ) AX ( lodsw )  EAX ( lodsd ) Repetition prefix does not make sense It leaves only the last value in AL, AX, or EAX register
String Move Instructions (cont’d) lodsb  --- load a byte string AL := (DS:ESI) ; copy a byte if  (DF=0) ; forward direction  then ESI := ESI+1  else   ; backward direction ESI := ESI  1 end if Flags affected: none
String Move Instructions (cont’d) Store a String (STOS) Performs the complementary operation Copies the value in  AL ( lodsb ) AX ( lodsw )  EAX ( lodsd ) to the destination string at ES:EDI Repetition prefix can be used if you want to initialize a block of memory
String Move Instructions (cont’d) stosb  --- store a byte string ES:EDI := AL ; copy a byte if  (DF=0) ; forward direction  then EDI := EDI+1  else   ; backward direction EDI := EDI  1 end if Flags affected: none
String Move Instructions (cont’d) Example:  Initializes  array1   with -1 .UDATA array1  resw  100 .CODE .STARTUP mov  AX,DS  ; set up ES mov  ES,AX  ;  to the data segment mov  ECX,100 mov  EDI,array1 mov  AX,-1 cld  ; forward direction rep  stosw
String Move Instructions (cont’d) In general, repeat prefixes are not useful with  lods  and  stos Used in a loop to do conversions while copying mov  ECX,strLen mov  ESI,string1 mov  EDI,string2 cld  ; forward direction loop1: lodsb or  AL,20H stosb loop  loop1 done:
String Compare Instruction cmpsb  --- compare two byte strings Compare two bytes at DS:ESI and ES:EDI and set flags if  (DF=0) ; forward direction  then ESI := ESI+1 EDI := EDI+1  else   ; backward direction ESI := ESI  1 EDI := EDI  1 end if Flags affected: As per  cmp  instruction  (DS:ESI)  (ES:EDI)
String Compare Instruction (cont’d) .DATA string1  db  'abcdfghi',0 strLen  EQU  $ - string1 string2  db  'abcdefgh',0 .CODE .STARTUP mov  AX,DS  ; set up ES mov  ES,AX  ;  to the data segment mov  ECX,strLen mov  ESI,string1 mov  EDI,string2 cld  ; forward direction repe  cmpsb dec  ESI dec  EDI  ;   ESI & EDI pointing to the last character that differs
String Compare Instruction (cont’d) .DATA string1  db  'abcdfghi',0 strLen  EQU  $ - string1 - 1 string2  db  'abcdefgh',0 .CODE .STARTUP mov  AX,DS  ; set up ES mov  ES,AX  ;  to the data segment mov  EECX,strLen mov  ESI,string1 + strLen - 1 mov  EDI,string2 + strLen - 1 std  ; backward direction repne  cmpsb inc  ESI ;  E SI & EDI pointing to the first character that matches  inc  EDI ;  in the backward direction
String Scan Instruction scasb  --- Scan a byte string Compare AL to the byte at ES:EDI & set flags if  (DF=0) ; forward direction  then EDI := EDI+1  else   ; backward direction EDI := EDI  1 end if Flags affected: As per  cmp  instruction  (DS:ESI)  (ES:EDI) scasw  uses AX and  scasd  uses EAX instead of AL
String Scan Instruction (cont’d) Example 1 .DATA string1  db  'abcdefgh',0 strLen  EQU  $ - string1 .CODE .STARTUP mov  AX,DS  ; set up ES mov  ES,AX  ;  to the data segment mov  ECX,strLen mov  EDI,string1 mov  AL,'e'  ; character to be searched cld  ; forward direction repne  scasb dec  EDI  ;  leaves EDI pointing to  e  in  string1
String Scan Instruction (cont’d) Example 2 .DATA string1  db  '  abc',0 strLen  EQU  $ - string1 .CODE .STARTUP mov  AX,DS  ; set up ES mov  ES,AX  ;  to the data segment mov  ECX,strLen mov  EDI,string1 mov  AL,' '  ; character to be searched cld  ; forward direction repe  scasb dec  EDI  ;  EDI pointing to the first non-blank character  a
Illustrative Examples LDS and LES instructions String pointer can be loaded into DS/SI or ES/DI register pair by using  lds  or  les  instructions Syntax lds  register,source les  register,source register  should be a 32-bit register source  is a pointer to a 48-bit memory operand register  is typically ESI in  lds   and EDI in  les
Illustrative Examples (cont’d) Actions of  lds  and  les lds register := (source) DS := (source+4)  les register := (source) ES := (source+4) Pentium also supports  lfs ,  lgs , and  lss  to load the other segment registers
Illustrative Examples (cont’d) Seven popular string processing routines are given as examples str_len str-cpy str_cat str_cmp str_chr str_cnv
Indirect Procedure Call Direct procedure calls specify the offset of the first instruction of the called procedure In indirect procedure call, the offset is specified through memory or a register If BX contains pointer to the procedure, we can use call  EBX   If the word in memory at  target_proc_ptr  contains the offset of the called procedure, we can use call  [target_proc_ptr]   These are similar to direct and indirect jumps
Performance: Advantage of String Instructions Two chief advantages of string instructions Index registers are automatically updated Can operate two operands in memory Example: Copy data from  array1  to  array2 cld rep  movsd Assumes:   DS:ESI points to  array1 ES:EDI points to  array2 ECX contains the array size
Performance: Advantage of String Instructions (cont’d) No string  instructions With string  instructions 50,000-element array-to-array copy Last slide

More Related Content

PPT
Assembly Language String Chapter
PPT
Assembly language
PPT
Theory of computing
PPTX
Chapter3pptx__2021_12_23_22_52_54.pptx
PDF
Chapter2CDpdf__2021_11_26_09_19_08.pdf
PDF
Regular language and Regular expression
PDF
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
PPTX
SS UI Lecture 4
Assembly Language String Chapter
Assembly language
Theory of computing
Chapter3pptx__2021_12_23_22_52_54.pptx
Chapter2CDpdf__2021_11_26_09_19_08.pdf
Regular language and Regular expression
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
SS UI Lecture 4

What's hot (19)

PPTX
[ASM] Lab1
PPTX
Theory of automata and formal language
PPTX
Strings in C language
PPTX
Theory of computation Lec2
PPTX
String C Programming
POT
Arrays and addressing modes
PPT
Instruction set
PPT
Strings
PPT
Lecture 3,4
PPT
Al2ed chapter13
PPTX
Automata theory - CFG and normal forms
PPTX
Regular expression (compiler)
DOC
String in c
PDF
Lecture: Regular Expressions and Regular Languages
PDF
05 c++-strings
PPTX
Thorup zwick compactrouting scheme
PPTX
strings in c language and its importance
PPT
Finite Automata
[ASM] Lab1
Theory of automata and formal language
Strings in C language
Theory of computation Lec2
String C Programming
Arrays and addressing modes
Instruction set
Strings
Lecture 3,4
Al2ed chapter13
Automata theory - CFG and normal forms
Regular expression (compiler)
String in c
Lecture: Regular Expressions and Regular Languages
05 c++-strings
Thorup zwick compactrouting scheme
strings in c language and its importance
Finite Automata
Ad

Similar to Al2ed chapter10 (20)

PPTX
[ASM]Lab8
PDF
N_Asm Assembly strings (sol)
PDF
String_manipulations.pdf
PPTX
String-Instructions-in-Assembly-Language.pptx
PPTX
Arrays, Strings & Loops in assembly Language.pptx
PDF
8086 String Instructions.pdf
PPT
Al2ed chapter4
PPTX
Reversing malware analysis training part4 assembly programming basics
PPT
02. chapter 3 lexical analysis
PPT
02. Chapter 3 - Lexical Analysis NLP.ppt
PPT
An instruction is a binary pattern designed inside a microprocessor to perfor...
PPTX
FLAG & PROCESSOR & STRING INSTRUCTIONS.pptx
DOCX
Instruction set of 8086 Microprocessor
PPTX
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
PPT
Assembly Language Lecture 4
PPT
chapt5 and 06assemblylanguagecodesandmachinelanguage.ppt
PPT
INTRUCTION SET OF 8086 FOR MICROPROCESSOR
[ASM]Lab8
N_Asm Assembly strings (sol)
String_manipulations.pdf
String-Instructions-in-Assembly-Language.pptx
Arrays, Strings & Loops in assembly Language.pptx
8086 String Instructions.pdf
Al2ed chapter4
Reversing malware analysis training part4 assembly programming basics
02. chapter 3 lexical analysis
02. Chapter 3 - Lexical Analysis NLP.ppt
An instruction is a binary pattern designed inside a microprocessor to perfor...
FLAG & PROCESSOR & STRING INSTRUCTIONS.pptx
Instruction set of 8086 Microprocessor
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
Assembly Language Lecture 4
chapt5 and 06assemblylanguagecodesandmachinelanguage.ppt
INTRUCTION SET OF 8086 FOR MICROPROCESSOR
Ad

More from Abdullelah Al-Fahad (15)

PPT
Al2ed chapter17
PPT
Al2ed chapter16
PPT
Al2ed chapter15
PPT
Al2ed chapter14
PPT
Al2ed chapter12
PPT
Al2ed chapter11
PPT
Al2ed chapter9
PPT
Al2ed chapter8
PPT
Al2ed chapter7
PPT
Al2ed chapter6
PPT
Al2ed chapter5
PPT
Al2ed chapter3
PPT
Al2ed chapter2
PPT
Al2ed chapter1
PPT
Al2ed chapter18
Al2ed chapter17
Al2ed chapter16
Al2ed chapter15
Al2ed chapter14
Al2ed chapter12
Al2ed chapter11
Al2ed chapter9
Al2ed chapter8
Al2ed chapter7
Al2ed chapter6
Al2ed chapter5
Al2ed chapter3
Al2ed chapter2
Al2ed chapter1
Al2ed chapter18

Recently uploaded (20)

PDF
Classroom Observation Tools for Teachers
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
Hazard Identification & Risk Assessment .pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
Empowerment Technology for Senior High School Guide
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PPTX
Unit 4 Skeletal System.ppt.pptxopresentatiom
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Indian roads congress 037 - 2012 Flexible pavement
PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Introduction to Building Materials
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Classroom Observation Tools for Teachers
History, Philosophy and sociology of education (1).pptx
Hazard Identification & Risk Assessment .pdf
Chinmaya Tiranga quiz Grand Finale.pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Paper A Mock Exam 9_ Attempt review.pdf.
Empowerment Technology for Senior High School Guide
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Orientation - ARALprogram of Deped to the Parents.pptx
Unit 4 Skeletal System.ppt.pptxopresentatiom
Final Presentation General Medicine 03-08-2024.pptx
Indian roads congress 037 - 2012 Flexible pavement
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Introduction to Building Materials
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
202450812 BayCHI UCSC-SV 20250812 v17.pptx
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين

Al2ed chapter10

  • 1. String Processing Chapter 10 S. Dandamudi
  • 2. Outline String representation Using string length Using a sentinel character String instructions Repetition prefixes Direction flag String move instructions String compare instructions String scan instructions Illustrative examples LDS and LES instructions Examples str_len str-cpy str_cat str_cmp str_chr str_cnv Indirect procedure call Performance: Advantage of string instructions
  • 3. String Representation Two types Fixed-length Variable-length Fixed length strings Each string uses the same length Shorter strings are padded (e.g. by blank characters) Longer strings are truncated Selection of string length is critical Too large ==> inefficient Too small ==> truncation of larger strings
  • 4. String Representation (cont’d) Variable-length strings Avoids the pitfalls associated with fixed-length strings Two ways of representation Explicitly storing string length (used in PASCAL) string DB ‘Error message’ str_len DW $-string $ represents the current value of the location counter $ points to the byte after the last character of string Using a sentinel character (used in C) Uses NULL character Such NULL-terminated strings are called ASCIIZ strings
  • 5. String Instructions Five string instructions LODS LOaD String source STOS STOre String destination MOVS MOVe String source & destination CMPS CoMPare String source & destination SCAS SCAn String destination Specifying operands 32-bit segments: DS:ESI = source operand ES:EDI = destination operand 16-bit segments: DS:SI = source operand ES:DI = destination operand
  • 6. String Instructions (cont’d) Each string instruction Can operate on 8-, 16-, or 32-bit operands Updates index register(s) automatically Byte operands: increment/decrement by 1 Word operands: increment/decrement by 2 Doubleword operands: increment/decrement by 4 Direction flag DF = 0: Forward direction (increments index registers) DF = 1: Backward direction (decrements index registers) Two instructions to manipulate DF std set direction flag (DF = 1) cld clear direction flag (DF = 0)
  • 7. Repetition Prefixes String instructions can be repeated by using a repetition prefix Two types Unconditional repetition rep REPeat Conditional repetition repe/repz REPeat while Equal REPeat while Zero repne/repnz REPeat while Not Equal REPeat while Not Zero
  • 8. Repetition Prefixes (cont’d) rep while (ECX  0) execute the string instruction ECX := ECX  1 end while ECX register is first checked If zero, string instruction is not executed at all More like the JECXZ instruction
  • 9. Repetition Prefixes (cont’d) repe/repz while (ECX  0) execute the string instruction ECX := ECX  1 if (ZF = 0) then exit loop end if end while Useful with cmps and scas string instructions
  • 10. Repetition Prefixes (cont’d) repne/repnz while (ECX  0) execute the string instruction ECX := ECX  1 if (ZF = 1) then exit loop end if end while
  • 11. String Move Instructions Three basic instructions movs, lods, and stos Move a string (movs) Format movs dest_string,source_string movsb ; operands are bytes movsw ; operands are words movsd ; operands are doublewords First form is not used frequently Source and destination are assumed to be pointed by DS:ESI and ES:EDI, respectively
  • 12. String Move Instructions (cont’d) movsb --- move a byte string ES:EDI:= (DS:ESI) ; copy a byte if (DF=0) ; forward direction then ESI := ESI+1 EDI := EDI+1 else ; backward direction ESI := ESI  1 EDI := EDI  1 end if Flags affected: none
  • 13. String Move Instructions (cont’d) Example .DATA string1 db 'The original string',0 strLen EQU $ - string1 .UDATA string2 resb 80 .CODE .STARTUP mov AX,DS ; set up ES mov ES,AX ; to the data segment mov ECX,strLen ; strLen includes NULL mov ESI,string1 mov EDI,string2 cld ; forward direction rep movsb
  • 14. String Move Instructions (cont’d) Load a String (LODS) Copies the value from the source string at DS:ESI to AL ( lodsb ) AX ( lodsw ) EAX ( lodsd ) Repetition prefix does not make sense It leaves only the last value in AL, AX, or EAX register
  • 15. String Move Instructions (cont’d) lodsb --- load a byte string AL := (DS:ESI) ; copy a byte if (DF=0) ; forward direction then ESI := ESI+1 else ; backward direction ESI := ESI  1 end if Flags affected: none
  • 16. String Move Instructions (cont’d) Store a String (STOS) Performs the complementary operation Copies the value in AL ( lodsb ) AX ( lodsw ) EAX ( lodsd ) to the destination string at ES:EDI Repetition prefix can be used if you want to initialize a block of memory
  • 17. String Move Instructions (cont’d) stosb --- store a byte string ES:EDI := AL ; copy a byte if (DF=0) ; forward direction then EDI := EDI+1 else ; backward direction EDI := EDI  1 end if Flags affected: none
  • 18. String Move Instructions (cont’d) Example: Initializes array1 with -1 .UDATA array1 resw 100 .CODE .STARTUP mov AX,DS ; set up ES mov ES,AX ; to the data segment mov ECX,100 mov EDI,array1 mov AX,-1 cld ; forward direction rep stosw
  • 19. String Move Instructions (cont’d) In general, repeat prefixes are not useful with lods and stos Used in a loop to do conversions while copying mov ECX,strLen mov ESI,string1 mov EDI,string2 cld ; forward direction loop1: lodsb or AL,20H stosb loop loop1 done:
  • 20. String Compare Instruction cmpsb --- compare two byte strings Compare two bytes at DS:ESI and ES:EDI and set flags if (DF=0) ; forward direction then ESI := ESI+1 EDI := EDI+1 else ; backward direction ESI := ESI  1 EDI := EDI  1 end if Flags affected: As per cmp instruction (DS:ESI)  (ES:EDI)
  • 21. String Compare Instruction (cont’d) .DATA string1 db 'abcdfghi',0 strLen EQU $ - string1 string2 db 'abcdefgh',0 .CODE .STARTUP mov AX,DS ; set up ES mov ES,AX ; to the data segment mov ECX,strLen mov ESI,string1 mov EDI,string2 cld ; forward direction repe cmpsb dec ESI dec EDI ; ESI & EDI pointing to the last character that differs
  • 22. String Compare Instruction (cont’d) .DATA string1 db 'abcdfghi',0 strLen EQU $ - string1 - 1 string2 db 'abcdefgh',0 .CODE .STARTUP mov AX,DS ; set up ES mov ES,AX ; to the data segment mov EECX,strLen mov ESI,string1 + strLen - 1 mov EDI,string2 + strLen - 1 std ; backward direction repne cmpsb inc ESI ; E SI & EDI pointing to the first character that matches inc EDI ; in the backward direction
  • 23. String Scan Instruction scasb --- Scan a byte string Compare AL to the byte at ES:EDI & set flags if (DF=0) ; forward direction then EDI := EDI+1 else ; backward direction EDI := EDI  1 end if Flags affected: As per cmp instruction (DS:ESI)  (ES:EDI) scasw uses AX and scasd uses EAX instead of AL
  • 24. String Scan Instruction (cont’d) Example 1 .DATA string1 db 'abcdefgh',0 strLen EQU $ - string1 .CODE .STARTUP mov AX,DS ; set up ES mov ES,AX ; to the data segment mov ECX,strLen mov EDI,string1 mov AL,'e' ; character to be searched cld ; forward direction repne scasb dec EDI ; leaves EDI pointing to e in string1
  • 25. String Scan Instruction (cont’d) Example 2 .DATA string1 db ' abc',0 strLen EQU $ - string1 .CODE .STARTUP mov AX,DS ; set up ES mov ES,AX ; to the data segment mov ECX,strLen mov EDI,string1 mov AL,' ' ; character to be searched cld ; forward direction repe scasb dec EDI ; EDI pointing to the first non-blank character a
  • 26. Illustrative Examples LDS and LES instructions String pointer can be loaded into DS/SI or ES/DI register pair by using lds or les instructions Syntax lds register,source les register,source register should be a 32-bit register source is a pointer to a 48-bit memory operand register is typically ESI in lds and EDI in les
  • 27. Illustrative Examples (cont’d) Actions of lds and les lds register := (source) DS := (source+4) les register := (source) ES := (source+4) Pentium also supports lfs , lgs , and lss to load the other segment registers
  • 28. Illustrative Examples (cont’d) Seven popular string processing routines are given as examples str_len str-cpy str_cat str_cmp str_chr str_cnv
  • 29. Indirect Procedure Call Direct procedure calls specify the offset of the first instruction of the called procedure In indirect procedure call, the offset is specified through memory or a register If BX contains pointer to the procedure, we can use call EBX If the word in memory at target_proc_ptr contains the offset of the called procedure, we can use call [target_proc_ptr] These are similar to direct and indirect jumps
  • 30. Performance: Advantage of String Instructions Two chief advantages of string instructions Index registers are automatically updated Can operate two operands in memory Example: Copy data from array1 to array2 cld rep movsd Assumes: DS:ESI points to array1 ES:EDI points to array2 ECX contains the array size
  • 31. Performance: Advantage of String Instructions (cont’d) No string instructions With string instructions 50,000-element array-to-array copy Last slide