Project 8: Flip Ya!

April 25, 2011

Due Monday, May 2 at 11:59PM

Objective

Test your MIPS assembly knowledge by solving this puzzling problem.

Requirements

The goal of this problem is to write a MIPS function flipimage which flips an image horizontally. For example, a simple image is shown on the left, and its flip is shown on the right.

A picture is composed of individual dots, or pixels, each of which will be represented by a single byte. The entire two-dimensional image is then stored in memory row by row. For example, we can store a 4 x 6 picture in memory starting at address 1000 as follows:

First, in order to validate that your fliprow and flipimage subroutines work correctly, seed some "image data" representing the 4 x 6 pixel image pictured above by using .data directives.

Next, you must first implement a MIPS subroutine fliprow to flip a single row of pixels. The function has two arguments, passed in $a0 and $a1: the address of the row and the number of pixels in that row. There is no return value, so don't worry about storing a return value or making a jr call. (500 points)

Lastly, using your fliprow function, you should now be able to write flipimage. This function has three arguments: the base memory address where the image is stored, the number of rows in the image, and the number of columns in the image. Again, there is no return value. (500 points)

Hints

Start with declaring the image data. What numeric value will you use for black pixels vs. white pixels? Next, focus on only fliprow and conduct a few test runs on different rows of pixels. If you've gotten this far, implementing flipimage should be straightforward.

Grading Criteria (1000 points)

Copy your code and paste it into the text area of your blackboard submission. Be sure to review your submission to make sure it is commented and appears properly (eg, has proper line breaks).

Your program must be functionally correct for full credit.