|
Thank Mr. Polastre (and Mr. Siirtola) the error is really the (weird for me) behaviour of SUBC. For who is interested a working large integer subtraction is here: for (i = 0; i < digits; i++) { asm volatile ("rrc %1 \n\t" "jc .Llab%= \n\t" "setc \n\t" "jmp .Lcon%= \n\t" ".Llab%= : clrc \n\t" ".Lcon%=: subc %3, %2 \n\t" "mov %2,%0 \n\t" "rlc %1 \n\t" :"=r"(a[i]), "+r"(borrow) :"r"(b[i]), "r"(c[i]) ); } Where a ,b and c are integer array of digits elements. Code could be simpler if some instruction for negate CARRY bit (if CARRY == 1 then CARRY =0 ; and viceversa) exists but I didn't find any. Joe Polastre wrote: This is a task for the handy-dandy MSP430 x1xx User's Guide. If you look up the ADDC and SUBC instructions, ADDC does carry, whereas SUBC will borrow/.NOT. carry. This may be a source of confusion.Don't know how that helps you, but I wanted to point it out :) Relevant section is page 3-67, but you probably already know that. -Joe On 11/16/05, Andrea Pacini <[EMAIL PROTECTED]> wrote: |
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
