From 137e3fdbd59994909f106f9d8563e1b8ecc870c8 Mon Sep 17 00:00:00 2001 From: MarcusMedeiros99 Date: Sun, 26 Apr 2020 21:48:08 -0300 Subject: [PATCH] =?UTF-8?q?Ap=C3=B3s=20execu=C3=A7=C3=A3o=20da=20opera?= =?UTF-8?q?=C3=A7=C3=A3o,=20agora=20=C3=A9=20necess=C3=A1rio=20dar=20enter?= =?UTF-8?q?=20para=20mostrar=20o=20menu.=20Assim,=20d=C3=A1=20para=20ver?= =?UTF-8?q?=20o=20resultado=20antes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.asm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/main.asm b/main.asm index 84c17fe..06525e4 100644 --- a/main.asm +++ b/main.asm @@ -19,6 +19,8 @@ .data .align 0 +continue: .asciiz "\nPressione para continuar\n" + title: .asciiz "\nEscolha a opção\n" op_1: .asciiz " 1 - soma\n" op_2: .asciiz " 2 - subtrai\n" @@ -83,6 +85,8 @@ ler_op: add $t9, $v0, $zero #armazenar op + beq $t9, $zero, quit + bltz $t9, invalid_op #op negativa addi $t8, $zero, 10 @@ -102,6 +106,7 @@ ler_arg:#leitura do primeiro argumento ler_arg2: #leitura do segundo argumento, se necessário addi $v0, $zero, 5 syscall + exec_op:#preparação para chamada das funções do menu #argumentos dos procedimentos @@ -127,6 +132,7 @@ soma: jr $ra + #------------------------------------------------------------------------------------------ # RAIZ # v0 = raiz(a0) @@ -180,7 +186,7 @@ raiz_end: #------------------------------------------------------------------------------------------ exec_tabuada: jal tabuada - j main + j print_continue tabuada: move $t0, $a0 # salva x em t0 @@ -225,6 +231,14 @@ print_result: add $a0, $v0, $zero addi $v0, $zero, 1 syscall + +print_continue: + la $a0, continue + addi $v0, $zero, 4 + syscall + + addi $v0, $zero, 12 + syscall j main invalid_op: