this is the continuation of the recent code we are using .. obviously this is just a sample and very badly coded .. it might have error and obviously it can be shorten .. i just try to make it understandable to every one and hope even for the newbie ..
since r0 = rowSlot and r1 = columnSlot from viewtopic.php?p=3421#p3421
Code:
@((((([rowSlot]+16)-1)/16)-1)*4) + ((([columnSlot]+16)-1)/16)
@[TileNo] r2 will have the [TileNo]
add r8,r0, #16
bl checke
sub r6,#1
mov r2,r6, lsl #2
add r8,r1, #16
bl checke
add r2,r6
@((([rowSlot] - ((([rowSlot]-1)/16)*16))-1)*16) + ([columnSlot] - ((([columnSlot]-1)/16)*16))
@[SlotNo] r3 will have the [SlotNo]
mov r8,r0
bl checke
mov r3,#16
mul r4,r3,r6
sub r4,#1
mul r4,r3
sub r4,r0
mov r8,r1
bl checke
mul r3,r6
sub r3,r1
add r3,r4
@FInalAddress r0 will have the Final Address
@((([TileNo]-1) * 256) + ([SlotNo]-1))*2) + 0x021E3124
sub r3, #1
lsl r3, #8
sub r4,#1
lsl r4, #1
add r4,r3
ldr r1, =0x021E3124
add r4,r1
Here is the last macro and must be added on the last part of the wholecode
Code:
checke:
sub r8, #1
mov r6,#0
div:
cmp r8,#16
addge r6,#1
subge r8,#16
bge div
bx lr
r4 will contain the Final Address