[Solved] CS2110 Timed Lab6-Direct Memory Access

$25

File Name: CS2110_Timed_Lab6-Direct_Memory_Access.zip
File Size: 357.96 KB

SKU: [Solved] CS2110 Timed Lab6-Direct Memory Access Category: Tag:
5/5 - (1 vote)

For this assignment, you will complete five functions to draw an animation with 60 frames on the GBA screen. The animation has been provided as an array of unsigned short in snoopframes.c. We have also provided for your reference snoopframes.bmp, which displays the array in snoopframes.c.

The animation contained in the array has been provided for your reference as (snoop-inputanimation.gif). After completing the functions correctly, the animation should display as snoop-outputexpected.gif.

Note: In the snoopframes array, frames 0 14 are not flipped at all, frames 15 29 are flipped horizontally only, frames 30 44 are flipped both ways, and frames 45 59 are flipped vertically only.

3.1 Provided Files

Several files are provided for running the animation:

main.c : Calls your code to draw the animation. You dont need to touch this.

gba.c : Library functions for GBA and Mode 3 gba.h : Header file for GBA and Mode 3, as well as function prototypes dma.h : Header file for DMA uint.h : Header file for integer typedefs font.c : A font array used to draw text

The animation frames in snoopframes.c are accompanied by the header file snoopframes.h.

3.2 Running the Animation

Please use the provided Makefile to start the program with make emu.

Once the animation has begun, you can manipulate it with the following input: Button A (Z) : Play and pause the animation

Button L (A) : If paused, step one frame backward

Button R (S) : If paused, step one frame forward

3.3 Completing the Animation (tl06.c)

You must implement the following five functions in tl06.c:

  1. getPointerToCurrentFrame
  2. drawSquareImage
  3. drawSquareImageFlippedHorizontal
  4. drawSquareImageFlippedVertical
  5. drawSquareImageFlippedBoth

Note: The only file you need to edit is tl06.c.

4 Instructions

4.1 Getting the Correct Animation Frame

The animation frames are consecutive to one another in the snoopframes array. Observe that each frame is 160 160 (i.e. 25,600) pixels, there are 60 frames in the animation, and snoopframes has 1,536,000 unsigned shorts: (160 160) 60 = 1,536,000.

Open snoop-inputimage.bmp to see the image this array was created from.

The function getPointerToCurrentFrame takes as parameters: a pointer to the beginning of the frames array (frames), the dimension of each square frame (img dimension), and the current frame (count).

You must calculate and return a pointer to the beginning of the correct frame.

4.2 Drawing the Images

Some of the frames in the animation have been flipped horizontally, vertically, or both ways. To properly draw the animation, you will need to implement four functions with Direct Memory Access (DMA).

Note: Calling the correct functions on the correct frames is taken care of for you in main.c, provided youve correctly implemented getPointerToCurrentFrame.

All four of these functions will draw the image starting at the top left corner of the screen. Each image has an img dimension which is the size of its width, the same as its height. Remember, you must use DMA!

For more details on implementation please read the comments provided in tl06.c.

  1. drawSquareImage(const u16 *image, int img dimension):
  2. drawSquareImageFlippedHorizontal(const u16 *image, int img dimension):
  3. drawSquareImageFlippedVertical(const u16 *image, int img dimension):
  4. drawSquareImageFlippedBoth(const u16 *image, int img dimension):

5 Testing Your Work

To debug your work, run make emu in the directory and step through frame-by-frame to check how your functions are drawing to the screen.

Uploading tl06.c to the Gradescope assignment will check your assignment against our tests. You may resubmit your work as many times as needed, until you sign out and leave the classroom.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS2110 Timed Lab6-Direct Memory Access
$25