Hi,
I have a question regarding msp430 assembly language, I am trying to do a
big integer multiplier, wrote the following code (only the first half
loop). The program is to compute c[] = a[] * b[]. When I compiles the
code, the compiler reports "inconsistent operand constraints in an `asm'",
I guess there is something wrong at indexed addressing, how can I fix the
code?
Thanks!!!
haodong
void integer_mul(uint16_t * a, uint16_t *b, uint16_t *c) {
uint8_t k, m;
register uint8_t i, j;
register uint16_t s0, s1, s2;
__asm__ __volatile__ (
" mov #0x0, %0 \n"
"LP1: \n"
" mov #0x0, %1 \n"
"LP2: \n"
" mov %0, %2 \n"
" mov %1, %3 \n"
" sub %1, %2 \n"
" mov %2(%7), &0x0130 \n"
" mov %3(%8), &0x0138 \n"
" add &0x013a, %4 \n"
" addc &0x013c, %5 \n"
" adc %6 \n"
" inc %1 \n"
" cmp %1, %0 \n"
" jge LP2 \n"
" mov %4, %3(%9) \n"
" mov %5, %4 \n"
" mov %6, %5 \n"
" mov #0x0, %6 \n"
" inc %0 \n"
" cmp %10, %0 \n"
" jl LP1 \n"
:"+r"(i), "+r"(j), "+I"(k), "+I"(m), \
"+r"(s0), "+r"(s1), "+r"(s2)
:"r"(a), "r"(b), "r"(c), "r"(nwords)
);
}