Pretty cool, though the assembly could be tightened in a few hot loops, eg:
mov r3, r10 adds r5, r5, r3 mov r9, r5
mov r9, r10 add r9, r5