4.3 Move Check Out of Range

Hi, so basically after i pull the first halfword out of the array via

lhu $t1 ($a0)

(works fine) i try to get the second halfword to compare them via

addiu $a0 $a0 2
lhu $t2 ($a0)

now when i run the test on my complete code i get the error:

Error in /home/… line 16 ( the secon pull line ( lhu $t2 ($a0 )) : Runtime exeption at 0x00400254: adress out of range 0x10400000

I cant seem to find the reason for this happening. My thought was that it might have something to do with working on one line and not the whole playing field.

Thank you in advance

Your thought is correct. move_check does not receive the playing field but a buffer with addresses of the tiles of one row/column. This means you cannot load half words as e.g. in check_victory.

1 Like

Oh yeah that makes sense. One more thing tho do the adresses in the buffer still contain the values as half words?

Yes, the addresses are addresses of half words so to speak, since they are the addresses of the tiles of the board, which are half words.

1 Like