# 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 $a0,$v0 # move the num entered into $s0 li $v0,5 # System call code to read int input syscall # Read it move $a1,$v0 # move the num entered into $s1 jal exponent move $s3,$v0 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 .text .globl exponent exponent: move $s0,$a0 move $s1,$a1 addi $s3,1 iterate: bgt $s1,$0, multiply b return nop multiply: mul $s3,$s3,$s0 addi $s1,-1 b iterate nop return: move $v0,$s3 jr $ra