Advertisement
argentinapb

aoc4

Sep 24th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. .data
  2. str1: .asciiz "digite x: "
  3. str2: .asciiz "digite y: "
  4. str3: .asciiz "digite z: "
  5. str4: .asciiz "o resultado é: "
  6. str5: .asciiz "\ndeseja realizar um novo calculo se sim digite 1, se nao digite 0:"
  7.  
  8. .text
  9. Loop:
  10. la $a0, str1
  11. li $v0, 4
  12. syscall
  13.  
  14. li $v0, 5
  15. syscall
  16.  
  17. move $t0, $v0
  18.  
  19. la $a0, str2
  20. li $v0, 4
  21. syscall
  22.  
  23. li $v0, 5
  24. syscall
  25.  
  26. move $t1, $v0
  27.  
  28. la $a0, str3
  29. li $v0, 4
  30. syscall
  31.  
  32. li $v0, 5
  33. syscall
  34.  
  35. move $t2, $v0
  36.  
  37. mul $t3, $t0, $t0 #multiplica x*x e armazena em t3
  38. mul $t3, $t3, $t0 #multiplica (x*x)*x
  39. mul $t3, $t3, 3 #multiplica 3*x^3
  40.  
  41. mul $t4, $t1, $t1 #multiplica y*y e armazena em t4
  42. mul $t4, $t4, 4 #multiplica 4*x^2
  43.  
  44. mul $t2, $t2, 10 #multiplica 10*z e armazena em t2
  45.  
  46. sub $t3, $t3, $t4 #subtrai 3x^3-4y^2 e armazena em t3
  47. add $t3, $t3, $t2 #soma (3x^3-4y^2) + 10z e armazena em t3
  48. subi $t3, $t3, 2 #subtrai a equaçao -2 e armazena em t3
  49.  
  50. la $a0, str4
  51. li $v0, 4
  52. syscall
  53.  
  54. move $a0, $t3
  55. li $v0, 1
  56. syscall
  57.  
  58. la $a0, str5
  59. li $v0, 4
  60. syscall
  61.  
  62. li $v0, 5
  63. syscall
  64.  
  65. move $t5, $v0
  66. beq $t5, 1, Loop
  67.  
  68. li $v0, 10
  69. syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement