the following is an array in mips
.byte
16,16,16,16,16,16,16,16,16,16,16
16,12,12,12,41,22,22,22,22,25,16
16,12,12,12,21,22,22,22,22,25,16
16,12,12,12,21,22,22,22,22,25,16
16,12,14,14,83,42,24,24,24,24,16
16,12,21,12,98,32,32,43,34,34,16
16,12,11,13,12,32,34,23,42,32,16
16,16,16,16,16,16,16,16,16,16,I6
I made mips code where when keyboard input is provided element 83 will move inside the array in any of 4 directions so when element 83 reaches element 98 . element 98 needs to be displayed again randomly in a new position inside the arIay. i did read through a stack overflow answer for generating random numbers but those were not exactly helpful as those generate random number and i want to generate element 98 in random position. i assumed the outterbounds where the total number of element in the array and t tried to write a code t=using syscall 42 but i was stuck in completing the code
#t0 is the array address
li $a0,98 la $a1,88 #outterbounds li $v0,42 syscall sb $a0,($t0) addi $t0,$t0,1 #increase array address
Note that according to the documentation I found, the random number is returned in
$a0so you should not use that for your98.