Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is for Assembly Language: x86 how can I modify this so that it will output

ID: 3747854 • Letter: T

Question

This is for Assembly Language: x86

how can I modify this so that it will output the string in reverse?

the current output is:

Enter a string

hello

h

e

l

l

o

I want the output to be:

Enter a string

hello

o

l

l

e

h

data prompt BYTE "Enter a string", 0dh, Oah, 0 text BYTE 101 DUP?) code main proc mov edx, OFFSET prompt call WriteString mov edx, OFFSET text mov ecx, 100 call ReadString mov ebx, e mov edx, OFFSET text call StrLength mov ecxeax L1: mov al, text[ebx] call WriteChar call Crlf inc eb>x loop L1 invoke ExitProcess,0 main endp end main

Explanation / Answer

Code Segment Assume cs:code, ds:data Begin: mov ax, data mov ds, ax mov es, ax mov cx, strlen1 add cx, -2 lea si, str1 lea di, strrev add si, strlen1 add si, -2 L1: mov al, [si] mov [di], al dec si inc di loop L1 mov al, [si] mov [di], al inc di mov dl, '$' mov [di], dl Print: mov ah, 09h lea dx, strrev int 21h Exit: mov ax, 4c00h int 21h Code Ends End Begin

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote