I was dealing with 2nd assignment, I am checking all tiles to find a free place I can place randomly 2 or 4 but even I find the free place I couldn’t figure out how to change the tiles we know the addresses of?
lw 0($a0), $a3 # $a3 is the register which contains new tile I want to place.
I know this is wrong and will throw an error during assemblying but I just wanted to show what my intention is.
Thanks in advance.
placing a tile requires saving that value at the specified address. The correct instruction would look like this
sh $a3, ($a0)
Mind the switched order of registers compared to lw.
Hope this helps,
Thank you for your answer, I think values on the board are defined as half-words. So I suppose using sh will work for it. Please let me know if I’m thinking wrong, thanks again for taking your time to answer.
Yes, sorry my mistake. I edited my answer above.