title: MIPS program to get two integers from the user, save it to an array, and print it
body: <p>I am trying to write a MIPS assembly program to get two integers from the user, save it to the memory in an array and print it. This is what i have so far. My program prints some big number  that I didn't put in. I am very new to this game. Somebody help please!</p>
  
  <p>Here's my code:</p>
  
  <pre><code>.text
  .globl main
  
      main:
          li $v0, 4       
          la $a0, prompt  
          syscall
  
          li $t0, 0      #count for the loop to get two integers
      getnum:
          li $v0, 5   #read integer
          syscall
          sw $v0, num($s0)    #save the integer from user input into num and $s0 has address for num, I'm not sure if i did this right
          addi $s0, $s0, 4    # increment $s0 by 4 to save another integer
          addi $t0, $t0, 1    #increment the counter
          ble $t0, 1, getnum       #if counter $t0, is less then or equal to 1, it will go through the loop again
  
      printnum:   
          la $a0, num($s0)        #load address of num to print
          li $v0, 1           #print int
          syscall 
          addi $s0, $s0, 4    
          addi $t1, $t1, 1
          ble $t1, 1, printnum        #does it twice
  
          li $v0, 10  
          syscall
  .data 
  
      num:
           .word 0, 0  # i want to store my two numbers here
      prompt: 
          .asciiz "Enter 2 positive integers: "
  </code></pre>