Machine Problem 5, due at the end of Nov 18

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

Framework: Your program must begin and end as follows:

        TITLE   "mp5.a by Your Name Here
        USE     "hawk.h"
        USE     "stdio.h"
        USE     "float.h"

        INT     PUTFLOAT

        ... your code here ...

        END

Obviously, where it says Your Name Here put your name, and where it says ... your code here ... put SMAL Hawk code to solve the problem.

Details: You must write a subroutine called PUTFLOAT that conforms to the standard Hawk calling conventions and implements the behavior documented by the C code to print a floating-point number given toward the end of Chapter 11 of the notes.

You will need to link your subroutine with a main program to test it, and you are entirely responsible for testing it to prove that it works, but the only code you submit should be the code for putfloat itself. This puts you in exactly the same situation as any commercial software vendor — the vendor does all the testing they can, and then passes their work to customers, where the vendor has no idea of how the customer will use the code.

Note: The header file float.h contains not only the definitions required to use the Hawk floating-point unit, but also the interface to a useful function that converts from floating to integer.

Grading: 5 points. Correct output is worth 2.5 points. The remaining credit will be offered only for those who have at least partially correct output.

Code that does not assemble will not earn any credit.

Stylistically clean code is important; that is why half the credit is reserved for style, but only if the code works. Bad indenting will be penalized up to 1 point from the 2.5 style points. Excessive or inadequate white space within and between lines will be penalized, again, up to 1 point. Excessive or inadequate comments will be judged similarly.

Note: Comments should not repeat the assignment. Assume that the reader of your code has read the assignment. Assume that the reader knows how to program, so commenting ADDSI R1,1 with R1=R1+1 would be stupid. Comments should help the reader when the code is hard to follow.

Before you submit: Assuming your code is in a file named mp5.a, please use the command

   [HawkID@fastx?? ~]$ ~dwjones/format mp5.a

This will gripe about over-length lines, strange mixing of tabs and spaces, and other file-format issues that will make your code hard to read when printed out for grading but might not be obvious when you have the file open for editing.

Submission: To submit your work, it must be in a file named mp5.a in your current directory on the CLAS Linux system, and you must know your section number. In the following transcript of a submission, what you type is shown in bold face.

   [HawkID@fastx?? ~]$ submit mp5.a
   Course (for CS:1210 use CS1210): CS2630
   Possible submit directories for /group/submit/CS2630 are:
   
   mp5/a3
   mp5/a2
   mp5/a4
   mp5/b11
   mp5/b12
   mp5/b13

   Choice:   mp5/a2
   * File/directory mp5.a has been 
   *  copied to /group/submit/CS2820/mp5/a2/mp5.a.HawkID.
   [HawkID@fastx?? ~]$

The output saying "File ... has been copied ..." is your confirmation of successful submission. In the event of insurmountable trouble, do not delete or edit files you have submitted. Keep them around. It is safe to make copies if you want to keep playing with them. Keep the original on the CLAS Linux system until your graded work is returned. This way, the time stamp marking the time of last edit is a trustworthy indicator of whether you did the work on time.

Note: If you need help and want to share your code with an instructor, just submit it. That is far easier for us to look at than screenshots, cellphone snapshots or uploading to code-sharing sites like pastebin.com. Then, in e-mail asking a question about it, make sure to mention what section you are in.