SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .text
  2. .main
  3. addi $t0, $zero, -1         #i = -1
  4.  
  5. for1loop:
  6. addi $t0, $t0, 1            #i += 1
  7. slt $t2, $t0, $s0           #i < a
  8. beq $t2, $zero, exit        #if $t2 == 0, go to exit
  9. and $t1, $t1, $zero         #j = 0
  10.  
  11. for2loop: slt $t2, $t1, $s1 #j < b
  12. beq $t2, $zero, for1loop    #if $t2 == 0, branch to for1tst        
  13. sll $t4, $t1, 4             #reg $t4 = 4 * j
  14. add $t2, $t0, $t4           #reg $t2 = i + 4 * j
  15. add $t3, $s2, $t1           #reg $t3 = &D[j]
  16. sw $t2, 0($t3)              #store $s2 in address pointed by $t3
  17. addi $t1, $t1, 1            #j += 1
  18. j for2loop                  #jump to for2tst
  19.  
  20. li $v0,10 # code for exit
  21. syscall # exit program
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top