Question: Question 1 a. Write a procedure ArrayToStack which copies the N elements of an array, Vector, onto the runtime stack. Vector is an array of

Question 1

a. Write a procedure ArrayToStack which copies the N elements of an array, Vector, onto the runtime stack. Vector is an array of unsigned doubleword integer. Register ESI should initially contain the offset address of Vector, and register EBX contains N.

b. Write a procedure StackToArray which copies back to Vector the last N double-word elements pushed onto the stack (by procedure ArrayToStack). Again, EBX contains the number N, and ESI initially contains the offset address of Vector. StackToArray should not reverse Vector (that is, the elements should return to their initial positions as before the execution of ArrayToStack).

c. To test these two procedures, your main program should display the following interaction with you (things in reds are your inputs)

What do you want to do now? > 0

What is the size N of Vector? > 13

What are the 13 values in Vector? > 1 2 3 4 5 6 7 8 9 10 11 12 13

Size of Vector is N = 13

Vector = 1 2 3 4 5 6 7 8 9 10 11 12 13

Stack is empty

What do you want to do now? > 1

Vector is 1 2 3 4 5 6 7 8 9 10 11 12 13 before ArrayToStack

Stack is 13 12 11 10 9 8 7 6 5 4 3 2 1 after ArrayToStack

Vector is 0 0 0 0 0 0 0 0 0 0 0 0 0 after ArrayToStack

Stack not empty

What do you want to do now? > 2

Stack is 13 12 11 10 9 8 7 6 5 4 3 2 1 before StackToArray

Vector is 1 2 3 4 5 6 7 8 9 10 11 12 13 after StackToArray

Stack is empty

What do you want to do now? > -1

I am exiting Thank you Honey and Get lost

As you see: 0 is to create a new Vector, 1 is to fill in a stack from a vector, 2 is to fill in a vector from a stack, and -1 is to exit.

PLEASE PROVIDE ASSEMBLY LANGUAGE CODE, which works on Visual STUDIO .. INCLUDE IRVINE32.INC

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!