Machine Problem 5, due November 17

Part of the homework for 22C:60, Fall 2008
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Submit the source file mp5.a (or mp5.txt if you must) for your solution to ICON on or before the indicated date.

The Problem

Homework 9 problem 1 discussed Park and Miller's minimal standard pseudorandom number generator. Implement this!

Your pseudorandom number generator package should have an interface compatible with the following interface specificaton file:

        ; random.h -- interface spec for pseudorandom number generator

        ; all routines conform to the standard, with
        ;   R1 -- return address
        ;   R2 -- stack pointer
        ;   R3-7 -- parameters and results
        ;   R8-15 -- unchanged, or restored if used

        EXT     SETSEED
        ;   R3 -- on entry, new seed value, an arbitrary 32-bit
        ;   number, but if 0 or a value greater than #7FFFFFFE
        ;   are passed, the the value must be forced into the
        ;   permitted range.

        EXT     RANDOM
        ;   R3 -- on exit, the next random number in the sequence.

        END

You are responsible for testing your pseudorandom number generator. Consider using the main program documented in the assignment for MP4 from the Fall 2003 offering of this course (it was 22C:40 back then).

Unlike the assignment from the Fall of 2003, the emphasis of this assignment is on separate assembly of the main program and the pseudorandom number generator package. Your pseudorandom number generator will be assembled and linked to our main program for grading, and it should be coded using only 32-bit arithmetic, as suggested in the homework.

Half of the credit on the final result will depend on cleanliness of the comments and clarity of the structure of your code.

Note: Significant parts of the second midterm will be based on this machine problem.