Skip to content

Commit

Permalink
Implementação do cálculo do imc
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusMedeiros99 committed Apr 27, 2020
1 parent 12d4aea commit 9e0ebad
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ exec_op:#preparação para chamada das funções do menu

addi $t8, $zero, 1
beq $t8, $t9, exec_soma # se operação for 1, soma

addi $t8, $zero, 6
beq $t8, $t9, exec_calc_imc

addi $t8, $zero, 7
beq $t8, $t9, exec_raiz # se operação for 7, raiz
Expand Down Expand Up @@ -160,8 +163,18 @@ fat_loop:
end_fat:
jr $ra

exec_fibonacci:

exec_calc_imc:
jal calc_imc

j print_float
calc_imc:
mtc1 $a0, $f1
cvt.s.w $f1,$f1

mul.s $f0, $f0, $f0
div.s $f0, $f1, $f0

jr $ra

#------------------------------------------------------------------------------------------
# RAIZ
Expand Down Expand Up @@ -256,6 +269,13 @@ subtr:

#TODO - outras opções

print_float:
add.s $f12, $f30, $f0
addi $v0, $zero, 2
syscall

j print_continue

print_result:
#impressão do resultado de uma função
add $a0, $v0, $zero
Expand Down

0 comments on commit 9e0ebad

Please sign in to comment.