First, I have to discover the byte with the exits of the current loc. Then, I have to discover if I have to use the first half of the byte or the second one. Then, I have to extract the byte of the exits and, finally, I check if it is a 1, there is an exit or 0, no exit.
It seems a lot of work but using bit masks it will be easy.
This is the code of the first steps, where I take the byte and the right half of the byte. I add the beginning of the north command so you can see that a command verb calls this subroutine first to get the right half of the byte.
MovementCommands
; I have in a the current loc.
; I store two locs in each position of the exit vecter
; So I divide the loc by two to obtain the index
lsr
tax
lda exits,x
tay
; I load the current loc again and
; I check the first bit.
; this is the way to see if loc is pair / odd
lda loc
and #%00000001
; If loc is odd, the exists are in 4
; lower bits, so their nothing else to do
bne Go_Back
; It is pair, so it is in the 4 ihest bits
; I move that bits four positions right
tya
lsr
lsr
lsr
lsr
tay
Go_Back
rts
Norte ; North
jsr MovementCommands