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 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:
Your program must follow a structured design, with methods that are called and
set up using the stack. See Methods You Must Have below
The menu must be implemented as a jump table.
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.
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.
All data, except strings and heap stuff, must be local, ie on the stack.
Start your program in a Javalike style with a call to main, not a branch to main.
Continue to assume that all integers are bits, ie bytes.
Stack pictures must always be shown using documentation and appropriate
EQUATEs.
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?
:
:
:
:
:
:
:
:
:
:
Enter command. L left R right E exchange Q quit l
Enter command. L left R right E exchange Q quit l
Enter command. L left R right E exchange Q quit l
Enter command. L left R right E exchange Q quit r
Enter command. L left R right E exchange Q quit r
Enter command. L left R right E exchange Q quit E
Exchange which locations?
Enter command. L left R right E exchange Q quit E
Exchange which locations?
Caution: Out of Bounds Exchange Attempted
Enter command. L left R right E exchange Q quit q
Bye bye
Methods You Must Have You May Have More:
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.
void prinVect int size, int vector
;;Prints out a vector as a horizontal list of numbers
;;with spaces in between.
void rotLeft int size, int vector
;;Move everything in vector over one spot left, with front
;;wrapping to back.
void rotRight int size, int vector
;;Move everything in vector over one spot right, with
;;back wrapping to front.
boolean exchange int loc int loc int size, int vector
;;Exchange elements in position loc and loc in the vector.
;;The locations are indexed starting at
;;No error message if the locations are invalid, but return
;;false and make sure nothing bad happens to memory.
;;The error meesage in the example comes from main.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
