Question: Instructions: Construct a Pep / 9 assembly language program that grabs an input vector from the user ( using a full prompt that includes indices

Instructions:
Construct a Pep/9 assembly language program that grabs an input vector from the user
(using a full prompt that includes indices that are normal, decimal numbers), and then
performs operations on the vector according to a menu (rotate left, rotate right, exchange,
and quit). These specifications must be followed:
1. Your program must follow a structured design, with methods that are called and
set up using the stack. (See Methods You Must Have below)
2. The menu must be implemented as a jump table.
3. The vector must be created in the heap. The user should be prompted for the size
of the vector, followed by the integers to fill the vector.
4. After the vector is full, the user may select what to do (in upper or lower case):
L or l to rotate the vector left
R or r to rotate the vector right
E or e to exchange two elements in the vector
Q or q to quit
The vector is printed after each request.
5. All data, except strings and heap stuff, must be local, i.e. on the stack.
6. Start your program in a Java-like style with a call to main, not a branch to main.
7. Continue to assume that all integers are 16 bits, i.e.2 bytes.
8. Stack pictures must always be shown using documentation and appropriate
.EQUATEs.
9. Trace tags (these are the # preceded items) must be used and working with the
stack. If we trace your program, we must be able to see the stack being
constructed, similar to this example:
Here is a sample of the output you must produce:
How big is your vector? 10
[1]: 21
[2]: 22
[3]: 23
[4]: 24
[5]: 25
[6]: 26
[7]: 27
[8]: 28
[9]: 29
[10]: 30
21222324252627282930
Enter command. L = left R = right E = exchange Q = quit l
22232425262728293021
Enter command. L = left R = right E = exchange Q = quit l
23242526272829302122
Enter command. L = left R = right E = exchange Q = quit l
24252627282930212223
Enter command. L = left R = right E = exchange Q = quit r
23242526272829302122
Enter command. L = left R = right E = exchange Q = quit r
22232425262728293021
Enter command. L = left R = right E = exchange Q = quit E
Exchange which 2 locations?
07
29232425262728223021
Enter command. L = left R = right E = exchange Q = quit E
Exchange which 2 locations?
113
29232425262728223021
Caution: Out of Bounds Exchange Attempted
Enter command. L = left R = right E = exchange Q = quit q
Bye bye
29232425262728223021
Methods You Must Have (You May Have More):
1. void inVect (int size, int[] vector)
;;Get integers from user to fill the vector, remembering
;;that vector is on the heap and size is its size.
2. void prinVect (int size, int[] vector)
;;Prints out a vector as a horizontal list of numbers
;;with spaces in between.
3. void rotLeft (int size, int[] vector)
;;Move everything in vector over one spot left, with front
;;wrapping to back.
4. void rotRight (int size, int[] vector)
;;Move everything in vector over one spot right, with
;;back wrapping to front.
5. boolean exchange (int loc1, int loc2, int size, int[] vector)
;;Exchange elements in position loc1 and loc2 in the vector.
;;The locations are indexed starting at 0.
;;No error message if the locations are invalid, but return
;;0(false) and make sure nothing bad happens to memory.
;;The error meesage in the example comes from main.
6. void main()
;;Initializes the vector and controls the menu and error
;;messages

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 Programming Questions!