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

Using MARS, it needs to be in MIPS machine language code, computer architecture

ID: 3666517 • Letter: U

Question

Using MARS, it needs to be in MIPS machine language code, computer architecture improve the provided program:

# An example MIPSbot program that shows controlling MIPSbot's velocity

to draw the letters "JB"

Implement the pseudocode above for each line segment that you wish to display.

The coordinate system is that used by the Java graphics. The origin (0, 0) is at the upper left. X increases to the right, Y increases downward. The lower right corner is (512, 512).

The speed is not a specifiable value. Hypothetically, the MARSbot may move at different rates (mimicking uphill/downhill).

The MARSbot will be initially positioned at (0, 0).

Explanation / Answer

#Program to draw lines

#Text segment

#        (all programs start with next 3 lines)

          .text                         #directive identifying the start of the instructions

          .global     _start

_start :

#------------------- print prompt on "console" ---------------

            la             &a0 ,prompt     # address of prompt goes in

            li      $v0, 4          # service code for print string

            syscall

# ------------- define function here --------------------------

registers :

            $a0 , input argument unchanged

            $a1, input argument unchanged

            $a2 , input argument unchanged

            $a3 , input argument unchanged

            $v0, char value returned

JBLinesDraw:

           

            andi $v0 $a0 0x0f       # mask off 4 lower bits

            ori     $v0, $v0, 0x30 # make it ASCII digit

            addi $a1 ,$a0,0x10

            addi $a2 ,$a1, 0x10

            addi $a3,$a2,0x10

            addi $v0 ,$a3,0x10

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote