Computer Sciences Dept.

CS/ECE 252 Introduction to Computer Engineering

Spring 2011 All Sections
Instructor: Andy Phelps
TAs: Newsha Ardalani, Peter Ohmann, Jai Menon

URL: http://www.cs.wisc.edu/~aephelps/courses/cs252/Spring2011/

Homework 8 // Due by 11:59 P.M. Fri, May 6 (in your dropbox)

Primary contact for this homework: Peter Ohmann [ohmann at cs dot wisc dot edu]

You may do this homework with one or two other people from your section. You must put both names in a comment at the top of your assembly code. Both partners should place the assembly code in their dropboxes.

Expanding HW7... (20 points)

Now that you have a working calculator program for HW7, we are going to expand it a bit to make it a more useful calculator. Essentially, you should add a few new functions to your calculator.

1. After performing an operation, rather than asking the user if they wish to enter another input, you should simply wait for more input. If the user enters an operator followed by another number, you should perform the new operation on your previous result and the new number. For example, take the following entries and results (the program should print the lines in bold):

11↵
+↵
10↵
21
/↵
7↵
3

2. The user should be able to store the current result in a memory location (for future use). They would do this by pressing the "s" key after an operation has been performed. The user can then reference this location later by pressing the "m" key during an operation. For example, take the following entries and results (the program should print the lines in bold):

11↵
+↵
10↵
21
s↵
3↵
+↵
m↵
24

3. Finally, the user should be able to clear the memory location if they wish. To do this, they should press the "c" key any time EXCEPT during an operation. This should set the memory location back to x0000. For example, take the following entries and results (the program should print the lines in bold):

11↵
+↵
10↵
21
s↵
m↵
-↵
10↵
11
c↵
5↵
+↵
m↵
5

A word on testing

This homework assignment will be tested in a somewhat different manner than previous assignments. Very soon, we will be providing you with the exact tests we will be running to test your program. The tests are worth exactly one point each (complete details will be provided with the tests).

The tests will progress from very simple (tests which could be completed with only part of HW7) to more complex. All of the tests will require certain subroutines to be working in order to receive any credit (for example, the decimal output routine). As such, you should be sure to complete anything you were unable to complete previously on HW7 first, then move on to the HW8 changes.

Finally, and most importantly, the reason we are providing the tests is so that you can work hard and know exactly what grade you will get. That being said, run the tests. The only way to guarantee that you haven't made some small mistake which will net you a zero is to RUN THE TESTS.

The files for the tests are below. You should place all of these files into the same directory as your Pennsim.jar.

script.txt
tests
human_readable_tests

To run the tests, type the following line into the Pennsim command line:
script script.txt
If your program is called something other than h8.asm you should either change it's name or edit the name within script.txt.

Updates

1. There was an issue with Windows inserting extra x0D bytes into the tests file when it was downloaded. The above updated script and tests files should fix the problem. If they don't you can try the following archive. If that still doesn't work, send us an email or stop by.
2. You do not need to actually have your program output in bold. This effect is simply used so that you can tell the difference between our expectations for input and output.

 
Computer Sciences | UW Home