Question: Question 1 : Write the assembly code to REVERSE the elements of your name array. Do not copy the elements to any other array. You
Question :
Write the assembly code to REVERSE the elements of your name array. Do not copy the elements to any other array. You can use direct or indirect addressing.
If name array is holding Sam then the output for your program should look approximately like following:
maS
Logic:
Address
Contents
H
e
l
l
o
null terminator
Step : Registers and Pointers
Set ESI and EDI to the start of the string First character
ECX should hold the number of iterations needed for reversal.
Now Update EDI to the end of the string Last character
Step: Logic to swap
Characters are exchanged between ESI and EDI while moving toward the center of the string.
ESI moves forward, EDI moves backward, and characters are swapped:
Iteration : HoESI pointing to H EDI pointing to o
Iteration : el and so on
This process continues until the loop completes ecx iterations
Step: Write the array after reversing.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
