Assignment 3 Specification
COMP003 – Lab 2 (6%)
MIPS Assembly Programming 2
Due 11:59pm, Saturday, 30 October 2021
• DESCRIPTION:
Write a “merge” program that merges two ordered lists of integers into a new ordered list. For
example, given two ordered lists (1, 4, 6, 9) and (0, 2, 3, 7) as input arguments, “merge”
should produce a new list (0, 1, 2, 3, 4, 6, 7, 9) which is also ordered. Another example could
be to merge (-3, 0, 6) and (-2, 0, 4, 5, 9) to produce (-3, -2, 0, 0, 4, 5, 6, 9).
The “merge” program assumes that the two input lists (in increasing order) of integers are
stored in the data area. It loads the integers and merges them into an ordered list. The
resulting ordered list (e.g. (-3, -2, 0, 0, 4, 5, 6, 9)) should be stored back into the data area. It
is at your own choice how the data area (i.e. the lists) is arranged, and whether the resulting
list is overwritten onto the original two lists. But be sure to give meaningful labels and clearly
indicate (using a label or comments) where the merged list is stored. Before your program
terminates, it should print out the merged list of integers (comma or space separated) which
should be in increasing order.
Hints: You may refer to wikipedia entry of Merge Algorithm for the outline of the algorithm
at https://en.wikipedia.org/wiki/Merge_algorithm.
Note: Please do NOT implement any sorting algorithm! You will receive a grade of zero (0)
if you do so.
• SUBMISSION:
You should store your merge program in one SINGLE file called “X.s”, where “X” is your
last name (use only the first eight characters if it is more than eight). At the top of the
program, use comments (starting with “#”) to write your name and also comment how your
programs are implemented. Your submitted program must be in plain text format and must be
runnable on QtSPIM.
In general, you need to document clearly which instruction does what in terms of the problem
solving (instead of saying “#add 4 to $s1 and send back” for “addi $s1, $s1, 4”), and which
register stores what data (e.g. list index, counter, etc). Write your general comments on top of
your program and specific comments after individual instructions.
Late submissions will be penalized (1% deducted for each day delay and no submissions
accepted after 3-day delay).
https://en.wikipedia.org/wiki/Merge_algorithm