Question: Copy a String in Reverse Order Write a program with a loop and indirect addressing that copies a string from source to target , reversing
Copy a String in Reverse Order
Write a program with a loop and indirect addressing that copies a string from source to target,
reversing the character order in the process. Use the following variables:
source BYTE "This is the source string",0
target BYTE SIZEOF source DUP('#')
This won't work:
INCLUDE Irvine32.inc
source BYTE"This is the source string", 0 target BYTE SIZEOF source DUP('#')
.code main PROC
mov esi,(OFFSET source)+(SIZEOF source) mov edi,OFFSET target mov ecx,SIZEOF source L1:mov al,[esi] mov[edi],al dec esi ;pointer to sorce inc edi ;pointer to target loop L1
mov esi,OFFSET target mov ebx,1 mov ecx, SIZEOF target-1 call Dumpmem
exit main ENDP END main
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
