Advertisement
chete

Practica 6

Apr 10th, 2014
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data
  2. cadenainicio: .asciiz "introuzca 5 numeros"
  3. num1:
  4. .globl main
  5. .text
  6.  
  7. main:
  8.  
  9.  
  10.  
  11. li $v0,5
  12. syscall
  13. move $t4,$v0
  14.  
  15.  
  16. li $v0,5
  17. syscall
  18. move $a1,$v0
  19.  
  20.  
  21. li $v0,5
  22. syscall
  23. move $a2,$v0
  24.  
  25.  
  26. li $v0,5
  27. syscall
  28. move $a3,$v0
  29.  
  30.  
  31. li $v0,5
  32. syscall
  33. move $t1,$v0
  34.  
  35.  
  36. addi $sp, $sp, -1
  37. sb $v0, 0($sp)
  38.  
  39. move $a0, $t4
  40.  
  41. jal decimal
  42.  
  43. move $t0,$v0
  44. li $v0,1
  45. move $a0,$t0
  46. syscall
  47. li $v0,10
  48. syscall
  49.  
  50. decimal:
  51.  
  52.     li $t3, 0 #contador
  53.    
  54.     lb $t2,($sp) #valor que hemos cargado en la pila
  55.     addi $sp,$sp, 1
  56. #crear el numero
  57.     sll $a1, $a1,1
  58.     sll $a2, $a2,2
  59.     sll $a3, $a3,3
  60.     sll $t2, $t2,4
  61. #a0=0 a1=00 a2=000 a3=1000 a4=10000---->suma=11000
  62.     or $t3,$t3, $a0
  63.     or $t3,$t3, $a1
  64.     or $t3,$t2, $a2
  65.     or $t3,$t3, $a3
  66.     or $t3,$t3, $t2
  67.    
  68.     move $v0,$t3
  69.     jr $ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement