COMP 2033, Spring 2018 Homework 4 Instructor: Dr. Ahmed Abdelmoamen Ahmed Due: 0
ID: 3707687 • Letter: C
Question
COMP 2033, Spring 2018 Homework 4 Instructor: Dr. Ahmed Abdelmoamen Ahmed Due: 04/23/2018 at 11:55 PM Marks: 100 points Submission Instructions: 1. Upload your asm files to eCourse in a zip file. 2. Please include a readme file that has (i) your name and student ID; and (ii) detailed instructions on how to run your programs. 3. Must 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 i.e., appropriate comments, but also choice of variable names), as well as excellent external documentation (i.e., in the readme.txt file as described previously). [30 points] Code instructions that implement the following pseudocode using conditional jump instructions. Do not use the IF directive. Assume that integers are unsigned: 1. dl5 else 2. [30 points] Code instructions that implement the following pseudocode using conditional jump instrutins. Do not use .WHILE or IF directives. Assume that integers are unsigned: while( int2>intl) ebx +m 2; if ebx> int2) ebx0; else ebxintl; 3. [40 points] Suppose EAX, EBX, and ECX contained three unsigned integers. Write a program that displays the largest of the three integers using conditional jump instructions.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:
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.