In MIPS, I am trying to create an array of 7 words that can either be hard coded or entered from the user. I have been unable to find a helpful tutorial on this. An answer with an explanation would be much appreciated.
.data
list: .word 6,11,13,17,40,45,70
size: .word 7
THIS IS THE ARRAY OF SIZE 7 in MISP THE DATA IS HARDCODED SO THAT YOU CAN EASILY UNDERSTAND THE STRUCTURE INPUTTING IN THE ARRAY MAY BE A LITTLE DIFFICULT FOR YOU AT THIS TIME AS YOU ARE NEW TO ARRAY
la $t3, list # we are placing the list address into
$t3
li $t2, 6 # now we are placing the sixth index of our list in
$t2
add $t2, $t2, $t2
add $t2, $t2, $t2
add $t1, $t2, $t3
# the above code is increasing array cell first two
lines are making it four times bigger and then we are combining our
data from $t2 and $t3
lw $t4, 0($t1) # getting value from array
cell
THE ABOVE INSTRUCTIONS ARE USED FOR ACCESSING THE ARRAY
DATA FOR INSTANCE
IF YOU HAVE ANY QUERY PLEASE COMMENT DOWN BELOW
PLEASE GIVE A THUMBS UP
Get Answers For Free
Most questions answered within 1 hours.