Boost Your Grades With Us Today!

support@writernursing.com      Contact us +1 (332)-240-3699

Browse Over 3 Million Questions

We have made it easier for you to place an order

+1 (332) 240-3699

support@writernursing.com

Connect With Us For a Fruitful Engagement

student_PNG181-2.png

Computer Science homework help

Name: ______________________

CSC 220 – Exam 2

 

Part I (24 Points):

  1. Define the data structure Stacks.

 

  1. Which instructions pushes and pops all of your 32-bit general purpose registers onto the stack?

 

  1. What are alternative instructions involving stacks to save and load our status flags (SAHF and LAHF)?

 

  1. Define the ESP register and describe what happens to the address of the ESP when pushing and popping values on the stack.

 

  1. When pushing register values onto the stack and then popping them back into the appropriate registers. In what the order is the values are returned? Why?

 

  1. Describe the CALL and RET instructions and how the runtime stack is involved.

 

Part II (36 Points):

  1. Write an instruction that clears bit 0, 2, 5, 7 in register AL.

 

  1. Write an instruction that checks if bits 3, 4, 5, 6 are set in register AL.

 

  1. Write an instruction that clears the zero flag when bit 5 is set and sets the zero flag when bit 5 is not set in register AL WITHOUT altering the values within AL.

 

  1. Given SetX, SetY, and SetZ. Find the union of SetX and SetY that intersects SetZ.

 

  1. Write a sequence of push and pop instructions to swap the values of EAX and EBX.

 

  1. Trace this program and describe what happens and why.

main PROC

mov EAX, 0

mov EDX, 10000h

push EDX

call mySubroutine

main ENDP

 

mySubroutine PROC

PUSHAD

PUSH 20000h

POP EBX

POP ECX

POPAD

RET

mySubroutine ENDP

 

Part III (40 Points):

  1. Create a Procedure that returns the original value of EBX and EDX after the procedure ends. Increment EBX and decrement EDX. Afterwards, it will swap the values of EBX and EDX then it will perform EAX = EAX + EBX each time the procedure is called.

 

After creating your procedure, initialize EAX as 0, EBX as 20, EDX as 25. Create a loop that loops 5 times calling your procedure.

 

  1. Create a procedure that sums up the given array and in the main procedure call the procedure you created then move the sum into EAX.

.data

array DWORD 10000000h, 2000000h, 300000h, 40000h

.code

 

  1. Translate the following code to Assembly:

(signed)

    1. if ( A < B ) {

C = A ;

B = B – 10 ;

}

else {

C = B ;

A = A + 10 ;

}

 

 

 

 

 

 

 

 

(unsigned)

    1. if ( (EAX == EBX) && (ECX > EDX) ) {
      EAX ++ ;

EAX = ECX;

}

else if ( (EAX < EBX) || (ECX < EDX) ) {

EBX ++ ;

EBX += EAX ;

}

else {

EBX ++ ;

EBX = EAX ;

}

Do you need a similar assignment written for you from scratch? We have qualified writers to help you.
You can rest assured of an A+ quality paper that is plagiarism free. Order now for an Amazing Discount!
Use Discount Code "NewClient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we write an original paper exclusively for you.

What Students Get

Free Features

We Offer Custom Writing Services with 3 Key Benefits

Affordable Writing Service

We guarantee a perfect price-quality balance to all students. The more pages you order, the less you pay.

The Best Support Service

Get 24⁄7 help with proofreading and editing your draft – fixing your grammar, spelling, or formatting.

Quality Essay Help

Our team of professional writers guarantees top-quality essay writing results.