Sorry for this other message but even if I thougth to have solved the problem , the problem is still present.
Now it seems that sub instruction doesn't set carry (borrow) bit . For example:

/* SIMPLE SUBTRACTION WITH BORROW  */

     op1=5;
     op2=6;

     asm volatile("sub %2,%1                           \n\t"
                            "jc .Lcarry1%=                        \n\t"
                            "mov #0,%0                             \n\t"
                            "jmp .Lexiting%=                    \n\t" 
                            ".Lcarry1%=: mov #1,%0      \n\t"
                            ".Lexiting%=: nop                   \n\t"

                             : "=r"(borrow)
                             : "r"(op1) , "r"(op2)
       );


This simple code simply does a subtraction (5-6) (op1 and op2 are uint16_t variables).
The result is correct (65535 or 0xFFFF) but the carry bit is 0 instead of 1 !
SubC has the same behavour .


_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to