Advertisement
GiaGio

Untitled

Oct 24th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. .text
  2. .globl main
  3. main:
  4. li $s3 , 1
  5. lw $s0, LEN
  6. la $s1, BASE
  7. addi $t0, $s0, -1
  8. sll $t0,$t0,2
  9. add $t0, $t0,$s1
  10. lw $s2, 0($t0)
  11.  
  12. loop:
  13. slti $t1, $s3, 1
  14. bne $t1, $zero, exit
  15. slt $t1, $s3, $s0
  16. beq $t1, $zero, exit
  17.  
  18. add $t2, $s3, -1
  19. sll $t2, $t2, 2
  20. add $t2, $t2, $s1
  21. lw $t2, 0($t2)
  22.  
  23. slt $t3, $t2, $s2
  24. beq $t3, $zero, false
  25.  
  26. addi $s3, $s3, 1
  27. j loop
  28.  
  29. false:
  30. add $t7, $zero, 0
  31. syscall
  32. exit:
  33. add $t7, $zero, 1
  34. syscall
  35.  
  36. .data
  37. BASE: .word 9, 1, 8, 3, 4
  38. LEN: .word 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement