CIS 351

Homework 5: Branches

Winter 2022

For this Homework, you are going to write and test some assembly code using branches. You may want to watch this video first.

As with previous assignments, in order for your solution to work with my MUnit tests, you must follow these rules:

For this assignment you may only use "real" branch and comparison instructions. In other words you may use beq, bne, and the various slt instructions. You may not use the branch and comparison pseudoinstructions like blt, bgt, seq, sle, sgt. If in doubt, look at your assembled code. If an assembled branch or comparison instruction turns into multiple instructions, then you may not use it.

To be clear: This limitation only applies to branches and comparisons. You may use other pseudoinstrctions like li.

You must also write a reasonably complete set of unit tests.

Problems

  1. makes10(int a, int b) from CodingBat.
  2. intMax(int a, int b, int c) from CodingBat.
  3. close10(int a, int b) from CodingBat. Don't use the abs pseudoinstrction.
  4. max1020(int a, int b) from CodingBat.
  5. dateFashion(int you, int date) from CodingBat.
  6. redTicket(int a, int b, int c) from CodingBat.

This GitHub Classroom repository has a file you can use as the starting point for your MUnit tests.

Submission and grading

Be sure to document and comment your code!

When your code passes all tests, commit your code with [Grade Me] in the message.

Hints:

For more practice

If you are looking for more assembly coding practice, consider these CodingBat problems:


Updated Tuesday, 8 February 2022, 3:25 PM

W3c Validation