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

Instructor: Dr. Ahmed Abdelmoamen Ahmed Due: 04/05/2018 at 11:55 PM (sharp!) Mar

ID: 3701088 • Letter: I

Question

Instructor: Dr. Ahmed Abdelmoamen Ahmed Due: 04/05/2018 at 11:55 PM (sharp!) Marks: 100 points Submission Instructions: Upload your asm files to eCourse in a zip file. 2. Please include a readme file that has () your name and student ID, and (ii) detailed 1. instructions on how to run your programs fust receive instructor's approval in advance if an alternative time and method of submission becomes necessary Solve each of the following problems. To receive full marks on your documentation, you should have excellent internal documentation (ie, appropriate comments, but also choice of variable names), as well as excellent extemal documentation (ie, in the readme.txt file as described previously) 1. [60 points) Using the String Reverse program as a starting point [find this asm file a) Modify the program so the user can input a string containing between 1 and 50 b) Modify the program so it inputs a list of 32-bit integers from the user, and then uploaded on eCourse]: characters displays the integers in reverse order (40 points] Write a program that does the following a. Assigns integer values to EAX, EBX, ECX EDX, ESI, and EDI b. Uses PUSHAD to push the general-purpose registers on the stack 2. c. Using a loop, your program should pop each integer from the stack and display it on the screen

Explanation / Answer

section .text

global _start

_start:

movl $1,%eax

movl $2,%ebx

movl $3,%ecx

movl $4,%edx

movl $5,%esi

movl $6,%edi

pushad

movl $6,%ebx

movl $0,%ecx

LOOP_OUTER:

cmp ecx,ebx

jz exit

pop eax

xorl %esi, %esi

loop:

movl $0, %edx

movl $10, %ebx

divl %ebx

addl $48, %edx

pushl %edx

incl %esi

cmpl $0, %eax

jz next

jmp loop

next:

cmpl $0, %esi

jz exit

decl %esi

movl $4, %eax

movl %esp, %ecx

movl $1, %ebx

movl $1, %edx

int $0x80

addl $4, %esp

jmp next

addl $1,%ecx

jmp LOOP_OUTER

exit:

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