my country is currently experiencing "la nina" phenomenon .. and the current weather makes me so lazy anyway ill just base this according to your post
now instead of using a per byte check, we try to use a whole 32bit of coordinate both of x and y..
so for example if slot 2, 3rdd byte is 0x02 and 2nd byte is 0x30 then it is clear to say that lower than 0x023000 is Slot 1 and we just need to make a computation on more than slot 1
one whole row has 64 slots while column has 64 slot, so meaning the column 64 and row 64 has a value of 0x9F0xx in x - coordinate and 0x9F0xx in y - coordinate .. and so our formula will be
Legend:
x = x-coordinate
y = y-coordinate
Code:
if [x] < 0x023000 then rowSlot = 1 else
rowSlot = ((([x] lsr 8) - 0x0210)/32) + 1
if [y] < 0x023000 then columnSlot = 1 else
columnSlot = ((([y] lsr 8) - 0x0210)/32) + 1
in ASM
Code:
ldr r0, =0x21C6DEC
ldr r0,[r0]
cmp r0,#0
bxeq lr
mov r12,lr
ldr r3,[r0,#0xFFFFFAC0] @ y - coordinate , [value @ r0] - #0x540
bl checkslot @ check rowSlot
mov r1,r2 @ r1 has the rowSlot
ldr r3,[r0,#0xFFFFFAB8] @ x - coordinate , [value @ r0] - #0x548
bl checkslot @ check columnSlot
mov r0,r2 @ r0 has the columnSlot
@..........................
@ insert unsolve issues here
@..........................
mov pc, r12
checkslot:
lsr r3, #8
mov r2,#1
cmp r3,#0x0230
bxlt lr
sub r3, #0x0210
div:
cmp r3, #32
addge r2,#1
subge r3,#32
bge div
bx lr
so for example if x - coordinate has 0x9FO1F and y - coordinate has 0x230D7
rowSlot = ((((0x9FO1F ) lsr 8) - 0x0210)/0x20) + 1
rowSlot = ((((0x9FO) - 0x0210)/0x20) + 1
rowSlot = (0x7E0/0x20) + 1
rowSlot = 63 + 1
rowSlot = 64
columnSlot = ((((0x0230D7) lsr 8) - 0x0210)/0x20) + 1
columnSlot = (((0x0230) - 0x0210)/0x20) + 1
columnSlot = (0x20/0x20) +1
columnSlot = 1 + 1
columnSlot = 2
it means that the character is in Row 64 at column 2 of the map .. now there is one more issue need to be solve ..
the map has 16 tiles with 16x16 square .. (you can confirm it in animal map) .. and the first tile uses the first 512bytes while second tile uses the second 512bytes and so on .. so we cannot directly use .. 0x21E3124 + ((((rowSlot-1)*64) + (columnSlot-1))*2) .. instead we need a different approach