Question: I need to create a code in assembly that will READ AN IMPUT FROM THE USER and reverse the string using an array as you

I need to create a code in assembly that will READ AN IMPUT FROM THE USER and reverse the string using an array as you can see being called in my code below. The purpose of the array is so the program knows which character to swap with which character in the loop called afterward. First with Last, Second to Second to the last, etc.. For example if the user imputs "Hello" output is "olleH"; "abcdef" outputs "fedcba"... etc. Please do not give me a a different version of your own type of code. I would like my variables and calls to remain the same and simply have my code fixed and additional comments if applicable to get a better way of learning. Thank you.

Here is my code so far: -----------------------------------------------------------------------------------------------------------------------

INCLUDE Irvine32.inc

.data MAX = 80 myString BYTE MAX+1 DUP (?) myLength DWORD ? numLoops DWORD ?

.code Main PROC call Clrscr

mov edx,OFFSET myString ;buffer size -1 mov ecx,MAX call ReadString call StrLength ;stores string length in eax

mov myLength,eax

xor edx,edx mov ebx,2 div ebx

mov numLoops,eax ;ebx is left, edx is right, ecx current mov ebx,OFFSET myString mov edx,OFFSET myString add edx,myLength dec edx

mov ecx,numLoops

L1: mov eax,0 mov al,[numLoops] mov [eax],al dec numLoops inc eax call WriteString call Crlf

;inc ebx ;dec edx loop L1 mov numLoops,OFFSET myString mov ebx, 1 mov ecx, myLength-ebx call DumpRegs exit main ENDP

END main ------------------------------------------------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!