Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

1. Code to assembly #1

Write the assembly code for the following:

if (x < y)

y=x;

else

Assume:

y= y*32;

i. ‘x' and ‘y' addresses are stored in %ecx and %edx.

ii. Use registers %eax and %ebx to store ‘x' and ‘y' during computations.

iii. Use immediate for any constants.

2. Code to assembly #2

Write the assembly level program for the following:

if (a[1] == 0)
    a[2]++;

else

     if (a[2]!= 0)
          a[2+i] += a[i+1];

Assume:
1. Base address of integer array a is stored in %esp
2. The value of i is available in %ecx

3. Computing assembly code output. Computing condition codes.

Given the following state of the registers and memory:

Address

Value

 

Register

Value

0x309

0xFF

%al

0x99

0x30A

0x1

%ebx

0x30C

0x30B

0x2

%ecx

0xFFFFFFFF

0x30C

0x20

%dl

0xFF

 

 

%esp

0x1

The following instructions are executed sequentially:

cmpb %dl, %al jge L1
cmovl $EC, %al subb %dl, %al js L2
L1:
subb $3, %ebx L2:
addb (%ebx), %dl

Fill up the below table as follows:

• Cross out the instructions that are not executed (if any).
• After every instruction is executed, write the status of the condition codes and changes to any register or memory location in the adjacent columns.
• What are the final hexadecimal values of the registers %al, %ebx %ecx and %dl?

Instruction

CF

ZF

SF

OF

Your calculations to determine output of move, compare and arithmetic operations & changes to register/memory (if any)

cmpb %dl, %al

 

 

 

 

 

jge L2

 

 

 

 

 

cmovl $EC, %al

 

 

 

 

 

subb %al, %dl

 

 

 

 

 

js L1

 

 

 

 

 

L1:

subb $3, %ebx

 

 

 

 

 

L2:

addb (%ebx), %dl

 

 

 

 

 

 

4. Stack creation

Each time a new procedure is called, a new stack frame is created for that procedure. Assume that a procedure P calls procedure Q and a new stack frame has been created.

You are given the following information:

1. Q has two arguments:
   a. Argument 1 of type Integer
   b. Argument 2 of type Character
2. The stack frame for P begins at memory address 0x200.
3. The memory address of Argument 1 is 0x100

Questions:

1. Draw a stack frame structure to show the caller frame P and the called frame Q. Draw the following in this frame structure:
   a. The "top" and "bottom" of procedure P's stack
   b. The location and memory address of Arguments 1 & 2.
   c. The first value stored in the new stack frame (In hex). What does this value represent?
   d. The value in %ebp after Q's stack is created
2. Which register stores Q's frame pointer after the stack frame for Q is created?
3. What is the value stored in this register before the stack for Q was created?

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91579616
  • Price:- $120

Guranteed 48 Hours Delivery, In Price:- $120

Have any Question?


Related Questions in Computer Engineering

A good sample of benzoic acid melts at 121-122 degrees

A good sample of benzoic acid melts at 121-122 degrees Celsius. However, a student had a sample that melted over a range, 105-115 degrees Celsius. What did the student conclude about that sample?

The standard math library cmath includes a function for

The standard math library cmath includes a function for taking the square root of a number. The heading (prototype) for this function is: double sqrt(double x) Write another function called closer_root that takes two rea ...

These sctp data chunks have arrived carrying the following

These SCTP DATA chunks have arrived carrying the following information: TSN:20 SI:2 SSN:8 BE:11 TSN:21 SI:2 SSN:9 BE:10 TSN:12 SI:2 SSN:7 BE:11 TSN:18 SI:3 SSN:15 BE:01 TSN:15 SI:3 SSN:15 BE:00 TSN:24 SI:1 SSN:23 BE:10 I ...

Elmers utility function isnbspuxnbspy minxnbspy2 if the

Elmer's utility function is  U ( x ,  y ) = min{ x ,  y 2 }. If the price of  x  is $10 and the price of  y  is $15 and if Elmer chooses to consume 4 units of  y , what must his income be? a. $220 b. $100 c. $320 d. Ther ...

Question two paragraphs eachseparate responds1 uml and omg

Question: TWO PARAGRAPHS EACH SEPARATE RESPONDS 1. "UML and OMG" Please respond to the following: Identify the benefits that UML brings to the software development industry. Speculate UML's development and its future inf ...

A sequence of natural numbers a1 a2 an is said to be a

A sequence of natural numbers (a 1 , a 2 , ..., a n ) is said to be a degree sequence if there exists an undirected graph on n vertices {v 1 , v 2 , ..., v n } such that the degree of v i  is a i  for each i = 1, 2, ..., ...

What are some differences between transaction processing

What are some differences between Transaction Processing Information Systems and Management Information Systems?

Who stole the ice cream during an investigation into the

Who Stole the Ice Cream? ?During an investigation into the mysterious disappearance of ice-cream from a Mr. Softee truck, the following statements were made by the prime suspects. ? Alan: I wouldn't steal ice-cream unles ...

Sorting amp searching i need this written in cwrite a

Sorting & Searching ( I need this written in C) Write a program that will allow a user the opportunity to compare and analyze the efficiency of several sorting algorithms. The program will sort integer arrays of size 10, ...

Ellen is an anthropologist who has been working at olduvai

Ellen is an anthropologist who has been working at Olduvai Gorge in Tanzania for the past six months. She has been conducting research on the Internet. She finds a Web site with an article that proposes a revolutionary t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As