Ok, sorry, my bad, the script doesn't work, and i don't know why. In the past months i only worked with ASM, so i'm a but rusty with scripts. Here's a routine.
Try callingasm this routine:
.align 2
.thumb
main:
push {r0-r4, lr}
ldr r0, =0x3E8 @flag base
ldr r1, =0x0 @counter
loop:
cmp...