# Demo of syscall by first inputting two numbers,
# adding and then printing result
.text
.globl main
main:
li $v0,4 # output a prompt
la $a0, msg1
syscall
li $v0,5 # input a number
syscall # User input is now in $vo
move $t0, $v0 # Put the input into a $t0
li $v0,4 # output prompt again
la $a0, msg1
syscall
li $v0,5 # input a second number
syscall # User input is now in $vo
move $t1, $v0 # Put the second input in $t1
add $t3, $t1, $t0 # Add the two numbers saving result in $t3
li $v0,4 # output a label for results
la $a0, msg2
syscall
li $v0,1 # output the answer
la $a0, msg2
move $a0, $t3
syscall
j $ra #return
.data
msg1: .asciiz "\nAn integer? "
msg2: .asciiz "\nThe sum is: "