title: How to add two Integer variables in MIPS
body: <p>I'm trying to Prompt the user to input two numbers, store them in Variables A and B, and then add the variables and save the sum to variable S. I know I can do this by saving the values directly to the registers, but I need to know how to do it using the variables themselves.</p>
  
  <p>Here's my code</p>
  
  <pre><code>.data
  prompt1: .asciiz "Enter an Integer A: /n"
  prompt2: .asciiz "Enter another Integer B: /n"
  response: .asciiz "The sum of A and B (A + B) is: "
  A: .word 
  B: .word
  S: .word
  .text
  
  #Prompt for input
  li $v0, 4
  la $a0, prompt1 
  syscall
  
  #receive input
  li $v0, 5
  syscall
  
  #Store input to A
  sw $v0, A
  syscall
  
  #Prompt for second input
  li $v0, 4
  la $a0, prompt2 
  syscall
  
  #receive input
  li $v0, 5
  syscall
  
  #Store input to B
  sw $v0, B
  syscall
  
  #Add A and B and store to register t0
  add $s0, A, B
  syscall
  
  #Store total to variable S
  move S, $t0
  syscall
  
  #Display response
  li $v0, 4
  la $a0, response
  syscall
  
  li $v0, 1
  move $a0, S
  syscall
  </code></pre>