Ok, I'm starting a new thread because that last bug/whatever was getting
lost in the discussion about the DADD high byte conversation.
I found something weird. If I have the following:
interrupt (BASICTIMER_VECTOR) wakeup BasicTimerIRQ(void)
{
total = total + 25;
1378: b2 50 19 00 04 02 add #25, &0x0204 ;#0x0019
137e: 82 63 06 02 adc &0x0206 ;
__asm__( "dadd %A1, %A0\n\t"
1382: b2 a0 19 00 00 02 dadd #25, &0x0200 ;#0x0019
1388: 82 a3 02 02 dadc &0x0202 ;
"dadd %B1, %B0" : "=rm" (total) : "i" (25));
__asm__("\tDADD %1, %0": "=rm" (total) : "n" (25) );
138c: b2 a0 19 00 00 02 dadd #25, &0x0200 ;#0x0019
__asm__("\tDADC %0": "=rm" (*((&total)+1) ) );
1392: 82 a3 04 02 dadc &0x0204 ;
_BIC_SR_IRQ(LPM3_bits);
1396: b1 c0 d0 00 00 00 bic #208, 0(r1) ;#0x00d0
//P1OUT=~P1OUT; //invert port 1
}
139c: 00 13 reti
Notice the first assignment is referencing the incorrect RAM location of
204 and 206. This is curious. However, if I remove the last ASM
statement, it works fine:
interrupt (BASICTIMER_VECTOR) wakeup BasicTimerIRQ(void)
{
total = total + 25;
1378: b2 50 19 00 00 02 add #25, &0x0200 ;#0x0019
137e: 82 63 02 02 adc &0x0202 ;
__asm__( "dadd %A1, %A0\n\t"
1382: b2 a0 19 00 00 02 dadd #25, &0x0200 ;#0x0019
1388: 82 a3 02 02 dadc &0x0202 ;
"dadd %B1, %B0" : "=rm" (total) : "i" (25));
__asm__("\tDADD %1, %0": "=rm" (total) : "n" (25) );
138c: b2 a0 19 00 00 02 dadd #25, &0x0200 ;#0x0019
//__asm__("\tDADC %0": "=rm" (*((&total)+1) ) );
_BIC_SR_IRQ(LPM3_bits);
1392: b1 c0 d0 00 00 00 bic #208, 0(r1) ;#0x00d0
//P1OUT=~P1OUT; //invert port 1
}
1398: 00 13 reti
Any ideas? Apparently, "(*((&total)+1) )" is somehow affecting the use
of "total" in the first assignment??! Again, a quick check of the
"main" function, and "total" is being referenced at 0x0200 (which is
where it is).
-Mark