Question: Using the assembly code below, please comment to the right of each code what each line does and at the end display the user input

Using the assembly code below, please comment to the right of each code what each line does and at the end display the user input following by the reversed string.

INCLUDE Irvine32.inc

.data

stringInput byte 50 dup(0)

promptIn byte "Enter the string: ",0

.code

swaping MACRO a,b

XOR a,b

XOR b,a

XOR a,b

ENDM

strlen proc

push ebp

mov ebp, esp

push ebx

mov eax, 0

mov ebx, [ebp+8]

Counter:

cmp byte ptr [ebx + eax], 0

je Done

inc eax

jmp counter

Done:

pop ebx

mov esp, ebp

pop ebp

ret TYPE ebp

strlen endp

strrev proc

Push ebp

MOV ebp, esp

Push eax

Push ebx

Push ecx

Mov ebx, [ebp+8]

Mov ecx, [ebp+8]

push ebx

call strlen

ADD ecx, eax

SHR al,1

count: CMP al,0

JZ finished

MOV ah, byte PTR [ebx]

swaping ah, byte ptr [ecx-1]

MOV BYTE PTR [ebx], ah

INC ebx

DEC ecx

DEC al

JMP count

finished: POP ecx

POP ebx

POP eax

MOV esp, ebp

POP ebp

RET (TYPE ebp)*4

strrev ENDP

main proc

mov eax, 0

mov edx, offset promptIn

call writeString

mov edx, offset stringInput

mov ecx, 51

call readString

push edx

call strrev

call crlf

call writestring

call crlf

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!