Perform Multiplication and division of Float Number in Assembly language MIPS on Mars
Division and Multiplication in MIPS
Task
1: program to take two float numbers from user and perform
division, also display the result.
.data cin:.asciiz"Enter 1st num:" cin1:.asciiz"Enter 2nd num:" cout:.asciiz"Your div is:" .text li $v0,4 la $a0,cin syscall li $v0,6 syscall li $v0,4 la $a0,cin1 syscall mov.s $f1,$f0 li $v0,6 syscall li $v0,4 la $a0,cout syscall mov.s $f2,$f0 div.s $f4,$f1,$f2 li $v0,2 mov.s $f12,$f4 syscall
Task 2:
Write a program to take two double numbers and perform multiplication, and also display the result.
.data
cin:.asciiz"Enter 1st num:"
cin1:.asciiz"Enter 2nd num:"
cout:.asciiz"Your mul is:"
.text
li $v0,4
la $a0,cin
syscall
li $v0,7
syscall
li $v0,4
la $a0,cin1
syscall
mov.d $f2,$f0
li $v0,7
syscall
li $v0,4
la $a0,cout
syscall
mov.d $f4,$f0
mul.d $f6,$f2,$f4
li $v0,3
mov.d $f12,$f6
syscall
Comments
Post a Comment