CIS 351

Lab 2: Introduction Assembly

Fall 2018

For this lab, you are going to write some assembly code and test it using using the MUnit testing framework.

Step 1: Learn how to test your code

Before writing any code, you first need to learn how to write and run MUnit tests. Follow these steps:
  1. Create a new directory for this assignment.
  2. Download assemblyIntroSample.asm, AssemblyIntroSampleTest.java, and munit.jar into this directory (or copy them from ~kurmasz/public/CIS351/AssemblyIntro).
  3. Launch Mars, open assemblyIntroSample.asm and see if you can spot the bug.
  4. From the command line, run javac -cp munit.jar AssemblyIntroSampleTest.java. (If you are doing this on your own machine, make sure the javac executable is in your path.)
  5. Now, run java -jar munit.jar assemblyIntroSample.asm AssemblyIntroSampleTest.class. (Notice that you are specifying the name of the class file, not the name of the class.)

At this point, you should see the following output:

MIPSUnit::MUnit version 1.1 built Sun Apr 08 14:26:21 EDT 2018.
Built with MARS version 4.4

	Failure: triples_positive_number(AssemblyIntroSampleTest): expected:<6> but was:<4>
	Failure: triples_negative_numbers(AssemblyIntroSampleTest): expected:<-18> but was:<-12>
Tests run: 6, Failures: 2
These tests fail because there is a bug in triple. Edit assemblyIntroSample.asm and fix the bug. When you have fixed the bug, you will see
MIPSUnit::MUnit version 1.1 built Sun Apr 08 14:26:21 EDT 2018.
Built with MARS version 4.4

All tests (6) passed.

Do not continue until you have (1) figured out how to run my test code, and (2) have found and fixed the bug in triple!

Step 2: Write some Java

Go to CodingBat and solve these three problems:

Do not continue until CodingBat has indicated that you have solved all three problems correctly. If you don't know how to code these problems in Java, you certainly won't be able to do it in assembly!

Step 3: Write and test some MIPS assembly

Now solve each problem using MIPS assembly. In order for your solution to work with my testing software, you must follow these rules:

Each of these above rules is demonstrated in assemblyIntroSample.asm

To test your code, download this starter test file into your directory for this homework and follow the steps given in step 1. These tests are not complete; you will need to add some of your own.

Submission and grading

Demonstrate to the instructor that your code passes all tests; then, submit a printed copy of the assembly code

Hints:


Updated Monday, 1 October 2018, 10:05 AM

W3c Validation