#============================================================= # add2Numbers.s # - Takes as input 2 integers from the console command # line and displays their sum. #============================================================= .data # Data declarations go here prompt1: .asciiz "\nEnter first number: " prompt2: .asciiz "Enter second number: " answer: .asciiz "The sum is " .text # The section where your code lives .globl main main: la $a0, prompt1 # Load string address into a0 li $v0, 4 # Load syscall code into v0 for "print string" syscall # Print first prompt li $v0, 5 # Load syscall code into v0 for "read integer" syscall add $s0, $v0, $zero # Copy first number to s0 la $a0, prompt2 # Load string address into a0 li $v0, 4 # Load syscall code into v0 for "print string" syscall # Print first prompt li $v0, 5 # Load syscall code into v0 for "read integer" syscall add $s0, $s0, $v0 # Add second number to first la $a0, answer # Load answer prompt li $v0, 4 syscall move $a0, $s0 # move is a pseudo-instruction li $v0, 1 syscall # code for print integer exit: li $v0,10 # Syscall for exit syscall