Using Assembly Language (MIPS), design a program calculator that can perform the following: Addition, Subtraction, Multiplication, Division, Power and Square Root Functions. Code must be able to accept floating point as well.
Code (in MARS Editor):
.data
#for input
printExp1: .asciiz "Enter the First Number :"
#enter first number
printExp2: .asciiz "\nEnter the Second Number :"
#enter 2nd number
#user Choice
AddiExp: .asciiz "\nEnter 1 for Addition"
SubExp: .asciiz "\nEnter 2 for Substraction"
MulExp: .asciiz "\nEnter 3 for Multiplication"
DivExp: .asciiz "\nEnter 4 for Division"
UserChoice: .asciiz "\nchoice : >>"
resultExp: .asciiz "\nResult :"
.text
.globl main
main:
#Taking input 1 here:
#print Exp1
la $a0, printExp1
li $v0, 4
syscall
#taking input
li $v0, 7
syscall
#moving infrom from f0 to f4
mov.d $f4, $f0
#Taking input 2 here:
#print Exp2
la $a0, printExp2
li $v0, 4
syscall
#taking input
li $v0, 7
syscall
#moving infrom from f0 to f4
mov.d $f6, $f0
# Now user will choose what he wants to do
#additiion
la $a0, AddiExp
li $v0, 4
syscall
#substraction
la $a0, SubExp
li $v0, 4
syscall
#multiplication
la $a0, MulExp
li $v0, 4
syscall
#division
la $a0, DivExp
li $v0, 4
syscall
#choice
la $a0, UserChoice
li $v0, 4
syscall
#taking users choice
li $v0, 5
syscall
#moving input from v0 to t0
move $t0, $v0
#setting up the constants for comparison like 1 for addtion
addi $t1, $zero, 1
addi $t2, $zero, 2
addi $t3, $zero, 3
addi $t4, $zero, 4
#if user choose 1 for addition
beq $t0, $t1, Addition #for Addition
beq $t0, $t2, Substraction #for Substraction
beq $t0, $t3, Multiplication #for Multiplication
beq $t0, $t4, Division #for Division
#program ends
li $v0, 10
syscall
#now addition:
Addition:
add.d $f4, $f4, $f6
#print exp
la $a0, resultExp
li $v0, 4
syscall
#print sum
mov.d $f12, $f4
li $v0, 3
syscall
#end program
li $v0, 10
syscall
#now substraction:
Substraction:
sub.d $f4, $f4, $f6
#print exp
la $a0, resultExp
li $v0, 4
syscall
#print sum
mov.d $f12, $f4
li $v0, 3
syscall
#end program
li $v0, 10
syscall
Multiplication:
#now multiplication:
mul.d $f4, $f4, $f6
#print exp
la $a0, resultExp
li $v0, 4
syscall
#print sum
mov.d $f12, $f4
li $v0, 3
syscall
#end program
li $v0, 10
syscall
#now division:
Division:
div.d $f4, $f4, $f6
#print exp
la $a0, resultExp
li $v0, 4
syscall
#print sum
mov.d $f12, $f4
li $v0, 3
syscall
#end program
li $v0, 10
syscall
Using Assembly Language (MIPS), design a program calculator that can perform the following: Addition, Subtraction, Multiplication,...
Convert the following C fragment to equivalent MIPS assembly language Write mini calculator that take two integer numbers as input and ask the user if he need to compute addition, subtraction, remainder, division, or multiplication then print the result. Hint: you can give each operation a special number. For example, the addition (1), subtraction (2), …. And so on. The output must be something like: Enter the first integer number: 5 Enter the second integer number: 3 Which operation? 1...
Using labview from national instruments ator that can do the following: addition, subtraction, multiplication, division, (8) Design a calcul square, square root, sinO, coso. T to display results of the operation performed. he front panel should have controls for inputs and an indicator
Problem 3 (35) Design a calculator that performs four operations: addition, multiplication, division and subtraction with 2 integer type numbers a) Ask user what type of operation to perform (+, , * or/) a. If the user inputs 'none' then the program terminates. Otherwise it will keep continuing the calculation. (hint: use while) b) Ask user to provide 2 integer number inputs c) Perform operation (whatever operation they mentioned in a) d) Print result e) In division operation, perform a...
Write a java calculator program that perform the following operations: 1. function to Addition of two numbers 2. function to Subtraction of two numbers 3. function to Multiplication of two numbers 4. function to Division of two numbers 5. function to Modulus (a % b) 6. function to Power (a b ) 7. function to Square root of () 8. function to Factorial of a number (n!) 9. function to Log(n) 10. function to Sin(x) 11. function to Absolute value...
Using c++.. 1. Write a program to find the sum(), Subtraction(), Multiplication(), Division() operations using Switch statement and functions. 2. Write a program to find the summation of N numbers. Use two functions. One function will take the input from user and the other will perform the summation from 1 to N. 3. Write a program to find the factorial of a number. Use two functions. One function will take the input from user and the other will perform the...
Multiplication and Division using PIC16F PIC16 is a very basic microcontroller with the capability of limited arithmetic and logical operations. It has dedicated arithmetic instructions for addition, subtraction, increment and decrement. If we want to perform a multiplication and division operations then we need to write a program for it. Multiplication is nothing but repeated addition. However, division can be implemented using repeated subtraction. This mini-project presents assembly or C language program for the multiplication and division of two 8-bits...
PLEASE HELP ASAP Write a 8088 assembly language program to accept input expressions from standard input consisting of an integer, an operator, and another integer and output the value of the expression to standard output. Valid operators are +, -, x and/ for addition, subtraction, multiplication and division respectively.
Construct a program using assembly language to perform the addition of two values - the first value; 4AH stored in register B and the second value; 36H stored in register D. The result of the addition is then stored in memory location 0x2020. Include comments to each instruction line of the program.
Create a program using C#, more specific a calculator where the user chooses addition, subtraction, addition. MUST use a FUNCTION, or METHOD. Each function use addition, subtraction, etc.
program in assembiy language x86 In assembly language using float point Quadratic Formula Prompt the user for coefficients a, b, and c of a polynomial in the form ax²+bx +C =0. Calculate and display the real roots of the polynomial using the quadratic formula. If any root is imaginary, display an appropriate message. Your result must be calculated in floating point whenever it applies, otherwise you will NOT get any credit.