# This MIPS program adds 2 numbers input # Filename : add.s # start xspim/spim/qtspim # load mips file # run #input data .data .align 2 Input: .asciiz "\nEnter two integers \n" Output: .asciiz "\n\nExp(firstNum, SecondNum) " .text .globl main main: li $v0,4 # System call code for print string la $a0,Input # Argument string as Input syscall # Print the string li $v0,5 # System call code to read int input syscall # Read it move $s0,$v0 # move the num entered into $s0 li $v0,5 # System call code to read int input syscall # Read it move $s1,$v0 # move the num entered into $s1 addi $s3,1 iterate: bgt $s1,$0, multiply b print nop multiply: mul $s3,$s3,$s0 addi $s1,-1 b iterate nop print: li $v0,4 la $a0,Output syscall li $v0,1 # system call code for print int move $a0, $s3 syscall Exit: li $v0,10 # System call code for exit syscall # exit