ASSEMBLY LANGUAGE PROGRAMMING
Write the program for the 8th exercise ( copy string backwards) on page 138 of your book:
8. Copy a String Backwards
Write a program using the LOOP instruction with 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(‘#’)
Insert the following statements immediately after the loop to display the hexadecimal contents
of the target string:
mov esi,OFFSET target ; offset of variable
mov ebx,1 ; byte format
mov ecx,SIZEOF target ; counter
call DumpMem
If your program works correctly, it will display the following sequence of hexadecimal bytes:
67 6E 69 72 74 73 20 65 63 72 75 6F 73 20 65 68
74 20 73 69 20 73 69 68 54
(The DumpMem procedure is explained in Section 5.3.2.) (A VideoNote for this exercise is posted
on the Web site.)
Also count the number of words in the string. You must display the reversed string and the number of words. To display a string and a number, you can use the The Irvine library functions as explained in the chapter 5 section 4.
Hint: You can look for Ascii value 32 which represents the space in the string.
Needs help with similar assignment?
We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

