Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- li $s0, 0 #row index
- li $s1, 0 #col index
- li $t2, '.'
- la $t1, grid
- li $t3, 40 #number columns //also the size of a row
- li $t4, 20 #number of rows
- mul $s2, $t3, 1 #rowsize = #cols * charsize
- clearLoop1:
- beq $s0, $t4, endClear #if row index >= 20, break
- li $s1, 0 #column index = 0
- clearLoop2:
- beq $s1, $t3, endClear2 #if column index >= 40, break
- mul $t5, $s0, $t3 #t0 = row index * rowsize
- add $t5, $t5, $s1 #offset = (t5 + s1)(rowValue*40+ColValue)
- sw $t2, grid($t5) #save '.' into grid($t5), where $t5 is current offset
- addi $s1, $s1, 1 #col ++
- j clearLoop2
- endClear2:
- addi $s0, $s0, 1 #row ++
- j clearLoop1
- endClear1:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement