Work goes on... I have discovered why the 2 registers for mod are swapped: in thumb mode it should be used SWI 6 (r0->number, r1->denom); in arm mode SWI 7 (r1->number, r0->denom). So, no need to swap registers... I only have mistaken SWI ops:

BTW, now I have some problems with asm 'dialect' in fpc. Seems like it is not so much standard compliant. For example, it does not understand asm comments (@, but pascal ones (//); labels should always start with .L; in some cases, asm code that works in gas is not understood by fpc:

Code:
mov 	r0, #0x4000006
generates an "invalid constant" error;

Code:
mov    r0, r0, lsl #0x10
generates an obscure "internal error 200501051"; elsewhere 'lsl' is an invalid opcode. My asm skills are near to 0, so probably I'm doing something wrong in the code. :?: