Advertisement
Guest User

Untitled

a guest
Apr 14th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     li $s0, 0 #row index
  2.     li $s1, 0 #col index
  3.     li $t2, '.'
  4.     la $t1, grid
  5.     li $t3, 40 #number columns //also the size of a row
  6.     li $t4, 20 #number of rows
  7.     mul $s2, $t3, 1 #rowsize = #cols * charsize
  8. clearLoop1:
  9.     beq $s0, $t4, endClear #if row index >= 20, break
  10.     li $s1, 0 #column index = 0
  11. clearLoop2:
  12.     beq $s1, $t3, endClear2 #if column index >= 40, break
  13.     mul $t5, $s0, $t3 #t0 = row index * rowsize
  14.     add $t5, $t5, $s1 #offset = (t5 + s1)(rowValue*40+ColValue)
  15.     sw  $t2, grid($t5) #save '.' into grid($t5), where $t5 is current offset
  16.     addi $s1, $s1, 1 #col ++
  17.     j clearLoop2
  18. endClear2:
  19.     addi $s0, $s0, 1 #row ++
  20.     j clearLoop1
  21. endClear1:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement