Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MIPS ASSEMBLY LANGUAGE Write a MIPS assembly program that when run in MARS at 25

ID: 3604716 • Letter: M

Question

MIPS ASSEMBLY LANGUAGE

Write a MIPS assembly program that when run in MARS at 25 instructions/second will display in the Memory segment a 4-byte “sprite” that moves from left to right across the top of the memory display.

Important: set the MARS slider bar to execute at a slower speed. Omitting this step will run at full speed and no output will be apparent.

You may choose the hex digits used for the “background” and the “sprite” – select two hex digits that have as much contrast as possible for best visibility. For instance, the digits e and c are poor choices because they look so similar.

Your program will involve a series of nested loops. Write this program in stages – do not attempt to write the entire program top-down!

For example, consider the portion of the assignment where the sprite moves from left to right. Assuming that you chose a "background" of the hex digit e and a "sprite" of the hex digit 0, a "time lapse" series of snapshots of the Memory segment display would look like the data belo Time 1: 0x0eeeeeee0xeeeeeeee Time 2: 0xe0eeeeee Oxeeeeeeee Time 3: 0xee0eeeee 0xeeeeeeee. · . Time 4: 0xeee0eeee 0xeeeeeeee Time 5: 0xeeee0eee Oxeeeeeeee Time 6: 0xeeeee0ee Oxeeeeeeee Time 7: Oxeeeeee0e 0xeeeeeee Time 8: Oxeeeeeee0 0xeeeeeeee Time 9: 0xe 0 is the sprite character 0x0eeeeeee

Explanation / Answer

CODE AS REQUIRED

.data

   InArr: .word   0x0eeeeeee

        .text

        .globl main

       

   main:

   #

        li $s2,0x0eeeeeee

        li $s3,0

   #

   loop:

        ror $s2,$s2,4   # $s2 = $s2 >>4

        sw $s2,InArr   # InArr(0) = $s2

        #addi   $s2,$s2,4

        bne $s2,$s3,loop    # until i==0

   #

        li $v0,10      # System(exit)

        syscall

THANK YOU FOR THE OPPURTUNITY

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote