Assignment 9, due Oct 31

Part of the homework for CS:2630, Fall 2019
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper in discussion section on Thursday. Some parts of assignments may be submitted on-line and completed in discussion section. Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!

  1. Background: Look at machine problem 4 and the posted solution to Homework 8, problem 1. The first posted solution to problem 1 contains this code to exchange two elements of the array data:

                char * temp = data[low];
                data[low] = data[high];
                data[high] = temp;
    

    a) Write SMAL Hawk code equivalent to the above. Assume R8 contains the address of the array data, R9 contains the index low, and R10 contains the index high, and assume that R3 to R7 are available to use as needed. (0.5 points)

    b) The assumptions given above require that, on entry to the SMAL Hawk version of qsort, certain registers must have been saved in the activation record. Which ones? (0.5 points)

  2. A small problem: Write a Makefile for machine problem 4, assuming no change to the code for MP4. You can use this to test your code. (0.5 points)

  3. A problem: Assume that you break your code for MP4 into two files, one containing MAIN and one containing QSORT, and assume that the version of QSORT you use takes three parameters, the pointer to the array and two array indices.

    a) What USE directives go in each of the two assembly language files? (0.5 points)

    b) What INT and EXT directives go in each of the two files? (0.5 points)

    c) Write a Makefile for the reorganized version of MP4. (Please do not mess with your code for MP4 in doing this problem!) (0.5 points)