Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

4. Who would lead the group?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago