ion (in assembly), you should (1) first separately write the Programs 1, 2, and 3 below, in order to make sure that they execute correctly, and then (2) put them all together appropriately into one single main program [this single main program is Program 4, below, which will be name Ass3.asm.   Of course, you do not need to do what I wrote above; you can directly start implementing the Program 4 below.   1. Write a program ArrayToStack which copies (ie, pushes) the N elements of an array, Vector, onto the runtime stack. Vector is an array of unsigned double-word integers.    2.  Write a program StackToArray which copies back to Vector the last N double-word elements pushed onto the stack (by some piece of code such as ArrayToStack). StackToArray should not reverse Vector (that is, the elements should return to their initial positions as before the execution of ArrayToStack).    3.  Write a program StackReverse which uses the runtime stack to reverse an ar

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question
For this question (in assembly), you should (1) first separately write the Programs 1, 2, and 3 below, in order to make sure that they execute correctly, and then (2) put them all together appropriately into one single main program [this single main program is Program 4, below, which will be name Ass3.asm.
 
Of course, you do not need to do what I wrote above; you can directly start implementing the Program 4 below.
 
  • 1. Write a program ArrayToStack which copies (ie, pushes) the N elements of an array, Vector, onto the runtime stack. Vector is an array of unsigned double-word integers. 
 
  • 2.  Write a program StackToArray which copies back to Vector the last N double-word elements pushed onto the stack (by some piece of code such as ArrayToStack). StackToArray should not reverse Vector (that is, the elements should return to their initial positions as before the execution of ArrayToStack). 
 
  • 3.  Write a program StackReverse which uses the runtime stack to reverse an array Vector of N unsigned double-word integers.
 
  • 4.  To test these three programs, your main program should display the following interaction with you (things in reds are your inputs). Fix the maximum size of the array to be = 20; thus, your runtime stack will never overflow .
 
  • 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? > 3
  •  
  • Vector is 1   2   3   4   5   6   7   8   9   10   11   12   13 before StackReverse
  • Stack not empty
  • Vector is 13   12   11   10   9   8   7   6   5   4   3   2   1 after StackReverse
  • Stack is empty
  •  
  • What do you want to do now? > 3
  •  
  • Vector is 13   12   11   10   9   8   7   6   5   4   3   2   1 before StackReverse
  • Stack not empty
  • Vector is 1   2   3   4   5   6   7   8   9   10   11   12   13 after StackReverse
  • Stack is empty
  •  
  • What do you want to do now? > 2
  • Error – Stack is empty: Cannot perform StackToArray 
  •  
  • What do you want to do now? > 0
  •  
  • What is the size N of Vector? >   6 
  • What are the 6 values in Vector? >   8   9   10   11   12   13
  •  
  • Size of Vector is N = 6
  • Vector = 8   9   10   11   12   13
  • Stack is empty
  •  
  • What do you want to do now? > 1
  •  
  • Vector is 8   9   10   11   12   13 before ArrayToStack
  • Stack is 13   12   11   10   9   8  after ArrayToStack 
  • Vector is 0   0   0   0   0   0   after ArrayToStack
  • Stack not 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,  3 is to reverse a vector using the stack stack, and  -1 is to exit.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education