Thanks for the open eye.. I really need to get more sleep (not gonna happen 'til my kids get older). It looks like the test for negative is actually two bytes smaller than the test against 0x80. Thanks again. -Mark
-----Original Message----- From: mspgcc-users-ad...@lists.sourceforge.net [mailto:mspgcc-users-ad...@lists.sourceforge.net] On Behalf Of Bill Knight Sent: Friday, March 07, 2003 11:45 AM To: mspgcc-users@lists.sourceforge.net Subject: Re: [Mspgcc-users] Macro expansion? On Fri, 7 Mar 2003 11:35:02 -0500, Mark Stokes wrote: >I have a macro: >#define SPITXWAIT while ( !( IFG1 & UTXIFG0 ) ); // Wait for the TX >That is expanding to this: > SPITXWAIT; // USART0 TX buffer ready? > 1994: c2 93 02 00 cmp.b #0, &0x0002 > 1998: fd 37 jge $-4 ;abs dst addr >0x1994 >Even though this is seeminging to work, why is UTXIFG0 being expanded to >"#0" instead of "0x80" as it should be. Here is the macro definitions >in the header file: >#define UTXIFG0 (1<<7) >Try as I might, I cannot get the cmp.b to compare w/ 0x80. It seems >stuck on only comparing Zero with IFG1. This also happens when I use >something else, like U0TCTL. Or if I use this macro definition: >#define SPITXWAIT while ( !( IFG1 & 0x80 ) ); // Wait for the TX >Any ideas? >-Mark It is not doing a bit test, it is checking if the value is negative i.e. if the high order bit of the byte is set -Bill Knight R O SoftWare ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users