All,
I am witting some code for an 8051 and seeing that is looks to be
missing an optimisation anyway I have distilled th ecode to this fragment:
void display_update( unsigned char tens, unsigned char ones );
void my_func( unsigned char my_value )
{
unsigned char d1;
unsigned char d2;
d1 = my_value % 10;
d2 = my_value / 10;
/* Do stuff with d1 & d1 */
display_update( d2, d1 );
}
The list file shows me this:
110 ; test51.c:10: d1 = my_value % 10;
0002 75 F0 0A 111 mov b,#0x0A
0005 EA 112 mov a,r2
0006 84 113 div ab
0007 85 F0*00 114 mov _display_update_PARM_2,b
115 ; test51.c:11: d2 = my_value / 10;
000A 75 F0 0A 116 mov b,#0x0A
000D EA 117 mov a,r2
000E 84 118 div ab
000F F5 82 119 mov dpl,a
120 ; test51.c:14: display_update( d2, d1 );
I have tried swapping the modulo and div operation around but it doe snot seem
to have any effect.
So my question is am I missing a command line switch when I compile the file?
I use the following to compile this file:
sdcc -c -mmcs51 --model-small test51.c
Regards,
Rod Boyce
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user