Ok, I'm almost there:
If I dereference the memory location, then add to it, then re-reference
it, I can get close:
__asm__("\tDADD %1, %0": "=g" (total) : "n" (25) );
1374: b2 a0 19 00 00 02 dadd #25, &0x0200 ;#0x0019
__asm__("\tDADC %0": "=g" (*((&total)+1) ) );
137a: 82 a3 04 02 dadc &0x0204 ;
Not sure how to get it to get to 0x0202. Perhaps if it's declared as an
int it would increment one "int" length (one word).
Also. I just noticed an error. This code (the asm above and the += test
below) sits inside the BT IRQ. I have "total" declared global and
volitile, but this code is generated:
total += 25;
1376: b2 50 19 00 04 02 add #25, &0x0204 ;#0x0019
137c: 82 63 06 02 adc &0x0206 ;
Quite obviously, these two code snippits are referencing the exact same
veriable: total. However, the += one is somehow looking at the wrong
memory location??!? When this variable is accessed in main, it is
referencing it as 0x0200. This is confusing. I can write a simplified
test program if necessary.
Any ideas?
-Mark
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mark
Stokes
Sent: Friday, January 03, 2003 1:59 PM
To: [email protected]
Subject: [Mspgcc-users] ASM accessing high word of long int?
I'm having trouble telling my assembly about a high byte of a long int.
Is there an easy way to do this?
Example:
void DADDLongInt( unsigned long int total )
{
// for now, just add 25 each time
__asm__("\tDADD %1, %0\n\tDADC %0": "=g" (total) : "n" (25) );
}
Written another way:
void DADDLongInt( unsigned long int total )
{
// for now, just add 25 each time
__asm__("\tDADD %1, %0": "=g" (total) : "n" (25) );
__asm__("\tDADC %0": "=g" (total) );
}
What do I use for the operand of the second assembly instruction? I
want to just say "(total(2))" or "(total+2)", but neither work.
Thanks
-Mark
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users