Question

Please take a look at my solution and correct any errors I may have. Click on the link below to see the question. In my solution, I have codes such as

- add $v0, $a0

- add $s1, $a0

- add $v0, $s1

can I use "add" instead of "move"? Please provide an explanation, Thanks.

Question:

https://www.dropbox.com/s/agr7o0nx0fn4hkl/MIPS%201.PNG?dl=0

Answer:

int Service (intn) refun n refunn Service (n+)serice (n Service, odd i tsp,ssp,-12 s $10, 8 (S P) addi xo, sao,t licreate carqueme Jal service 1,4 s l, İVo //add return Value for servit eint) forvecws/e/一㈠ eKftt, Iw nn // Create arquement Crtt al Servite r ra

0 0
Add a comment Improve this question Transcribed image text
Answer #1
service:
        .frame  $fp,40,$31              # vars= 0, regs= 3/0, args= 16, gp= 8
        .mask   0xc0010000,-4
        .fmask  0x00000000,0
        .set    noreorder
        .cpload $25
        .set    nomacro
        addiu   $sp,$sp,-40
        sw      $31,36($sp)
        sw      $fp,32($sp)
        sw      $16,28($sp)
        move    $fp,$sp
        movz    $31,$31,$0
        .cprestore      16
        sw      $4,40($fp)
        lw      $2,40($fp)
        nop
        slt     $2,$2,11
        beq     $2,$0,$L2
        nop

        lw      $2,40($fp)
        b       $L3
        nop

$L2:
        lw      $2,40($fp)
        nop
        addiu   $2,$2,1
        move    $4,$2
        lw      $2,%got(service)($28)
        nop
        move    $25,$2
        .reloc  1f,R_MIPS_JALR,service
1:      jalr    $25
        nop

        lw      $28,16($fp)
        move    $3,$2
        lw      $2,40($fp)
        nop
        addu    $16,$3,$2
        lw      $2,40($fp)
        nop
        addiu   $2,$2,2
        move    $4,$2
        lw      $2,%got(service)($28)
        nop
        move    $25,$2
        .reloc  1f,R_MIPS_JALR,service
1:      jalr    $25
        nop

        lw      $28,16($fp)
        addu    $2,$16,$2
$L3:
        move    $sp,$fp
        lw      $31,36($sp)
        lw      $fp,32($sp)
        lw      $16,28($sp)
        addiu   $sp,$sp,40
        j       $31
        nop
Add a comment
Know the answer?
Add Answer to:
Please take a look at my solution and correct any errors I may have. Click on...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT