title: MIPS Program with Integer and Argument Example
body: <p>I'm stuck on an exercise, and am unsure how to proceed. This is the exercise:</p>
  
  <p>Write a MIPS assembly language procedure, Test, that accepts 2 integers as arguments and 
  returns 0 if the integers are equal, 1 if the first is less than the second, and 2 if the first is greater 
  than the second. 
  Write a MIPS assembly language program that reads in 2 integers, calls the procedure Test, then 
  outputs one of the following messages: 
  The integers are equal 
  The first integer is less than the second 
  The first integer is greater than the second </p>
  
  <p>What would be an example to carry this out? Mips is very confusing to me, as I'm used to Java. Thank you.</p>
  
  <p>EDIT: Here is the program I am using as a foundation, since I am unsure where to start:</p>
  
  <pre><code>.data 
  str1: .asciiz "Please Enter Integer 1: "  # a
  str2: .asciiz "Please Enter Integer 2: "  # a
  str3: .asciiz "The sum is "  # a
  newline: .asciiz "\n"  # g
  
   .text 
  main: addi $v0, $zero, 4   
   la $a0, str1          
   syscall                   
  
   addi $v0, $zero, 5       
   syscall           
  
   add $s0, $zero, $v0       
  
   addi $v0, $zero, 4        
   la $a0, str2          
   syscall               
  
   addi $v0, $zero, 5        
   syscall               
  
   add $s1, $zero, $v0       
  
  L1: beq $s1, $zero, cont  
      addi $v0, $zero, 1    
      add $a0, $s0, $zero   
      addi $s1, $s1, -1     
      syscall               
      j L1              
  
   cont: addi $v0, $zero, 4      
   la $a0, newline       
   syscall           
  
   addi $v0, $zero, 10       
   syscall           
  
   jr $ra            
  </code></pre>