Hi,
I am using the windows mspgcc version of may 2003. I encountered a problem with
multiplying two variables:
typedef unsigned char uint8;
typedef unsigned int uint16;
typedef unsigned long uint32;
typedef unsigned long long uint64;
typedef char int8;
typedef int int16;
typedef long int32;
typedef long long int64;
int16 par1;
int16 par2;
int32 par3;
par1 = 16;
f456: b2 40 10 00 mov #16, &0x02ba ;#0x0010
f45a: ba 02
par2 = 0x600;
f45c: b2 40 00 06 mov #1536, &0x02bc ;#0x0600
f460: bc 02
par3 = (int32)par1 * par2;
f462: 3a 40 10 00 mov #16, r10 ;#0x0010
f466: 3c 40 00 06 mov #1536, r12 ;#0x0600
f46a: 0b 43 clr r11 ;
f46c: 0a 93 cmp #0, r10 ;r3 As==00
f46e: 01 34 jge $+4 ;abs 0xf472
f470: 3b 43 mov #-1, r11 ;r3 As==11
f472: 0c 43 clr r12 ;
f474: 0c 93 cmp #0, r12 ;r3
As==00
f476: 01 34 jge $+4 ;abs 0xf47a
f478: 3d 43 mov #-1, r13 ;r3 As==11
f47a: b0 12 d6 f9 call #-1578 ;#0xf9d6
f47e: 82 4e b6 02 mov r14, &0x02b6 ;
f482: 82 4f b8 02 mov r15, &0x02b8 ;
As you can see the both par1 and par2 are casted to int32. But something goes
wrong at address f472: clr r12
I lose par2 here.
Am I doing something wrong here? Or is this problem fixed in a later version?
I can not update to the latest mspgcc version because I need insight to debug
my program.
Thanks!
Sipke