#Copyright 2021 by John Bowman #Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), #to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, #and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: #The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #This program performs basic arithmetic operations on two inputs #Developed using MARS 4.5 MIPS Assembler and Runtime Simulator .data lblFirst: .asciiz "Enter a number: " lblSecond: .asciiz "Enter another number: " lblAdd: .asciiz "The sum of the two numbers is: " lblSub: .asciiz "\nThe difference of the two numbers is: " lblMult: .asciiz "\nThe product of the two numbers is: " lblDiv: .asciiz "\nThe quotient of the two numbers is: " .text #Ask for first number li $v0, 4 la $a0, lblFirst syscall #Receive first number from console li $v0, 5 syscall #Fetch return value and store in $t0 move $t0, $v0 #Ask for second number li $v0, 4 la $a0, lblSecond syscall #Receive second number from console li $v0, 5 syscall #Fetch return value and store in $t1 move $t1, $v0 #Add two values add $t2, $t0, $t1 #Subtract two values sub $t3, $t0, $t1 #Multiply two values move $t4, $t0 mult $t4, $t1 mflo $t5 #Divide two values move $t6, $t0 div $t6, $t1 mflo $t6 #Print results li $v0, 4 la $a0, lblAdd syscall li $v0, 1 la $a0, ($t2) syscall li $v0, 4 la $a0, lblSub syscall li $v0, 1 la $a0, ($t3) syscall li $v0, 4 la $a0, lblMult syscall li $v0, 1 la $a0, ($t5) syscall li $v0, 4 la $a0, lblDiv syscall li $v0, 1 la $a0, ($t6) syscall #Terminate li $v0, 10 syscall