Official Release 1 ( 17-Dec-2002) does not generate this problem.
This is a bug when using  patches from 10 Feb 2003.

The first scenario (right shift 3) generates incorrect code. it should be

                        bit.b #llo(8), &0x0030

c-code :

      /* Initialise key matrix variables */
      KP_CurKeyVal = (P5IN & 0x08) >> 3;

list file output:

246:src/keys.c    ****  /* Initialise key matrix variables */
 247:src/keys.c    ****       KP_CurKeyVal = (P5IN & 0x08) >> 3;
 223                          .stabn 68,0,247,.LM16-KEYS_InitSW
 224                    .LM16:
 225 0054 F2B0 0300           bit.b #llo(3), &0x0030
 225      3000
 226 005a C243 0000           clr.b &KP_CurKeyVal
 227 005e C263 0000           adc.b &KP_CurKeyVal



Correct code is generated for a right shift of 2
c-code:

      /* Initialise key matrix variables */
      KP_CurKeyVal = (P5IN & 0x08) >> 2;

list file:

 246:src/keys.c    ****       /* Initialise key matrix variables */
 247:src/keys.c    ****       KP_CurKeyVal = (P5IN & 0x08) >> 2;
 223                          .stabn 68,0,247,.LM16-KEYS_InitSW
 224                    .LM16:
 225 0054 5F42 3000           mov.b &0x0030, r15
 226 0058 7FF2                and.b #llo(8), r15
 227 005a 12C3                clrc
 228 005c 4F10                rrc.b r15
 229 005e 4F11                rra.b r15
 230 0060 C24F 0000           mov.b r15, &KP_CurKeyVal



Regards,
Phil Hancock
Design Engineer
Tekelek Pty Ltd
7 Comley St
Export Park
South Australia 5950
Ph 61 8 8234 3011
Fx 61 8 8234 3242




Reply via email to