anyway im still lazy so ill just give the idea
Code:
[TileNo] = ((((([rowSlot]+16)-1)/16)-1)*4) + ((([columnSlot]+16)-1)/16)
[TileNo] = (((((64+16)-1)/16)-1)*4) + (((2+16)-1)/16)
[TileNo] = (((((80)-1)/16)-1)*4) + (((18)-1)/16)
[TileNo] = (((79/16)-1)*4) + (17/16)
[TileNo] = ((4-1)*4) + 1
[TileNo] = (3*4) + 1
[TileNo] = 12 + 1
[TileNo] = 13
Code:
[SlotNo] = ((([rowSlot] - ((([rowSlot]-1)/16)*16))-1)*16) + ([columnSlot] - ((([columnSlot]-1)/16)*16))
[SlotNo] = (((64 - ((64-1/16)*16))-1)*16) + ((2 - (((2-1)/16)*16))
[SlotNo] = (((64 - ((63/16)*16))-1)*16) + (2 - ((1/16)*16))
[SlotNo] = (((64 - ((3)*16))-1)*16) + (2 - (0*16))
[SlotNo] = (((64 - 48)-1)*16) + (2 - 0)
[SlotNo] = (((16-1)*16) + 2
[SlotNo] = ((15 * 16) + 2
[SlotNo] = ((15 * 16) + 2
[SlotNo] = 240 + 2
[SlotNo] = 242
Code:
[FinalAddress] = ((([TileNo]-1) * 256) + ([SlotNo]-1))*2) + 0x021E3124
[FinalAddress] = (((13-1) * 256) + (242-1)*2) + 0x021E3124
[FinalAddress] = ((12 * 256) + 241)*2) + 0x021E3124
[FinalAddress] = (3072 + 241)*2) + 0x021E3124
[FinalAddress] = (3313*2) + 0x021E3124
[FinalAddress] = 0x19E2 + 0x021E3124
[FinalAddress] = 0x21E4B06
obviously in asm it can be shorten a polish a bit .. but still as i imagine this .. final code would be as long as my LOZ Dpad
PS. all remainder is ignored
for division in ARM ASM use this routine
Code:
mov r0,#0
mov r1,#0x3E @---dividend
mov r2,#0xF @---divisor
div:
cmp r1,r2
addge r0,#1
subge r1,r2
bge div
after the routine r0 = has the qoutient & r1 = has the remainder/Modulus