12/06/2024, 00:54 Assignment 3-Winter 2024
COMP-2660 – Assignment #3
DUE DATE is: Wednesday, March 13, 2024. To be submitted via BrightSpace by 11:59P
M.
WARNINGS: You must only use instructions and directives discussed from Lecture 1 to
Lecture 8 (ie, Chapt_06).
This is a group assignment of no more than 4 students in a group. However, submit
individually as usual but making sure you include as a comment the last-name, first-name
and student-number of each member in the group. What I mean: all member of the group
should submit the work as if it was done individually. Simply, I do not know how to
correctly set the group submission feature on Blackboard.
Programming Exercise-1 (40 points): [call it Ass3.asm]
For this question, 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 and is what you should submit].
Of course, you do not need to do what I wrote above; you can directly start implementing
the Program 4 below.
1. (10 points) 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. (10 points) 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. (10 points) Write a program StackReverse which uses the runtime stack to
reverse an array Vector of N unsigned double-word integers.
4. (10 points) 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 N = 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
➢
about:blank 1/2
COMP-2660 – Assignment #3
DUE DATE is: Wednesday, March 13, 2024. To be submitted via BrightSpace by 11:59P
M.
WARNINGS: You must only use instructions and directives discussed from Lecture 1 to
Lecture 8 (ie, Chapt_06).
This is a group assignment of no more than 4 students in a group. However, submit
individually as usual but making sure you include as a comment the last-name, first-name
and student-number of each member in the group. What I mean: all member of the group
should submit the work as if it was done individually. Simply, I do not know how to
correctly set the group submission feature on Blackboard.
Programming Exercise-1 (40 points): [call it Ass3.asm]
For this question, 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 and is what you should submit].
Of course, you do not need to do what I wrote above; you can directly start implementing
the Program 4 below.
1. (10 points) 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. (10 points) 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. (10 points) Write a program StackReverse which uses the runtime stack to
reverse an array Vector of N unsigned double-word integers.
4. (10 points) 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 N = 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
➢
about:blank 1/2