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:
> I am going crazy about why this assembly code works :
>
> /* SUM BETWEEN LARGE INTEGERS */
>
> for (i = 0; i < digits; i++) {
> asm volatile ("rrc %1 \n\t"
> "addc %3, %2 \n\t"
> "mov %2, %0 \n\t"
> "rlc %1 \n\t"
>
> :"=r"(a[i]),"+r"(carry)
> :"r"(b[i]), "r"(c[i])
> );
> }
>
>
> and this other doesn't work :
>
> /* DIFFERENCE BETWEEN LARGE INTEGERS */
> for (i = 0; i < digits; i++) {
> asm volatile ( "rrc %1 \n\t"
> "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])
> );
> }
>
> The first does sum between two large integer (array), b and c, and result
> is stored in a , and it works fine
> The second does difference but it doesnt' work !!!
> The only difference is that in the second I use subc instead of addc.
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help