I have some questions about getting the Address value and the content saved in this address.
la $a0, board # the base address of the board is now in $a0 move $t0, $a0 # this means now $t0 also saved the base Adress?
if I want to load the saved content or value from an Address, should I set the following instruction?
lh $t1, 0($t0) # like in this task every board block address save their content in halfword...so use lh or lw?
the value next to base address:
lh $t1, 4($t0) ? And what about the address increment
suppose we know the position index is 7, $a0 is still the base address
so if we want to get the address from the 7th position, then we should do:
addi $t3, $t3, 0 addi $t3, $t3, 7 # index 7 is now saved in $t3 mulu $t3, $t3, 4 # every address has 4 bytes, so 4? Not sure, because according to our project instruction we should do 7*2...
so if we want to get the 7th position
then we should do:
addu $t0, $t0, $t3 ?
finally, we can get the value from this address by doing
lh $t4, 0($t0) ?
Another question about judging if a tile is empty or occupied…
if the tile is empty then it has the value of 0 or it has a value which is not the power of 2?
Thanks in advance!