From 9e0ebadb61342d7efb141285c0e80c0f9f9dbe72 Mon Sep 17 00:00:00 2001 From: MarcusMedeiros99 Date: Sun, 26 Apr 2020 23:16:06 -0300 Subject: [PATCH] =?UTF-8?q?Implementa=C3=A7=C3=A3o=20do=20c=C3=A1lculo=20d?= =?UTF-8?q?o=20imc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.asm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/main.asm b/main.asm index 8da029f..e8c4e70 100644 --- a/main.asm +++ b/main.asm @@ -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 @@ -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 @@ -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