Thank You for Your answer, but:

Operations order?

The job of this little programme is to multiply an unsigned char "wert" with
an unsigned number 180 to an unsigned int.

With a further pair of brackets it is the same problem:
----------------------------------------------------------------------------
---------------------------------
unsigned int multiplikation (unsigned char wert)
{
   return (unsigned int)(((unsigned int)wert)*((unsigned int)180));
   0:   02 12           push    r2              ;
   2:   32 c2           dint                    
   4:   03 43           nop                     
   6:   c2 4f 30 01     mov.b   r15,    &0x0130 ;
   a:   c2 43 31 01     mov.b   #0,     &0x0131 ;r3 As==00
   e:   b2 40 b4 ff     mov     #-76,   &0x0138 ;#0xffb4     >>word
addressing to 0x0138/0x0139; why 0xff in the high byte?<<
  12:   38 01 
  14:   c2 43 39 01     mov.b   #0,     &0x0139 ;r3 As==00   >>no effect,
because HW Multipier is startet one instruction before<<
  18:   1f 42 3a 01     mov     &0x013a,r15     ;0x013a
  1c:   32 41           pop     r2              ;
}
  1e:   30 41           ret                     
----------------------------------------------------------------------------
---------------------------------

mov     #-76,   &0x0138 ;#0xffb4 --> why not:        mov.b #180, &0x0138

Marcus

> this is a feature actually:)
> you forgot about operations order.
> ~d
> 
> 
> On Wednesday 20 October 2004 12:48, Else Marcus wrote:
> > Hello!
> >
> > 
> > ...
> > 
> >
> > Used options for mspgcc: -x c -c -g -O2 -Wall -mmcu=msp430x147
> >
> > Release: mspgcc-20040723.exe
> >
> > Is the different behavior between examples 1.1 and 1.2 and 
> between 2.1 and
> > 2.2 a bug or a feature?
> > Or is it my mistake?
> >
> > Marcus Else
> >
> 

Reply via email to