mips1

Friday, July 15, 2016

Mips Function Argument and Return Values

Hi there this tutorial site will teach how to make an argument and return the value. This is kine of very interesting program that allow you to make an argument and then allow you to return it. 


.data 
.text
        main:
                     addi $a1, $0, 1500         #add 1500 + 0 = store in $a1
                     addi $a2, $0, 200           #add 200 + 0 = store in $a2
jal totalAdd
     li $v0, 1
    addi $a0, $v1, 0
   syscall 

   #The following code tell the system that program is done
    li $v0, 10
    syscall 

totalAdd:
   add $v1, $a1, $a2             # $a1 + $a2 = $v1
    jr $ra 




No comments:

Post a Comment