Assembly Language
Please write an assembly code which includes Irvine library, Irvine32.inc.
Copy_a_String_Backwards
Write an assembly program that copies a string from source to target, reversing the character order in the process. A little challenging but more efficient is in-place reversing a string using xchg. Your algorithm can be like this:
1. Point ESI to the end of the source string.
2. Point EDI to the beginning of the target string.
3. Initialize the loop counter ECX and start a loop.
4. Get a character from source.
5. Store it in the target.
6. Update ESI and EDI.
7. Call WriteString to output the two strings.
Similar to this:
Please select from the menu:
1. Copy a string backwards.
2. Return the current original string.
3. Exit.
Enter your choice: 1
Please enter a string: I am happy
The reversed string: yppah ma I
Please select from the menu:
1. Copy a string backwards.
2. Return the current original string.
3. Exit.