68hc11 Cross-Compiler Test 1
- this page compares code generated by a Whitesmith's C cross compiler (target: 68hc11) with an unnamed competing product
- I purchased the Whitesmith's product from Intermetrics who sold the product line to Cosmic Software (crazy name but really neat products)
- Note: I used the Whitesmith's C cross compiler here
'C' Source Code
/*
* title : neil_1.c
* purpose: 68hc11 binary generation demo
* host : Windows
*/
#define uchr unsigned char
uchr one, two, three, three_a;
void main(void)
{ one = 1; /* init globals (using same data) */
two = 1;
three = 1;
three_a = 1;
}
Output Code Listing From the COSMIC Software Compiler
Notes:
- code size: 14-0+1=15 bytes
- data is loaded into the b register one time only (line 7)
1 ; C Compiler for MC68HC11 [COSMIC Software]
2 ; Version V4.0g - 16 Apr 1997
4 ; 9 void main(void)
4 ; 10 { one = 1; /* init globals (with same data) */
5 0000 _main:
7 0000 c601 ldab #1
8 0002 f70003 stab _one
9 ; 11 two = 1;
10 0005 f70002 stab _two
11 ; 12 three = 1;
12 0008 f70001 stab _three
13 ; 13 three_a = 1;
14 000b f70000 stab _three_a
15 ; 14 }
16 000e 39 rts
17 xdef _main
18 switch .bss
19 0000 _three_a:
20 0000 00 ds.b 1
21 xdef _three_a
22 0001 _three:
23 0001 00 ds.b 1
24 xdef _three
25 0002 _two:
26 0002 00 ds.b 1
27 xdef _two
28 0003 _one:
29 0003 00 ds.b 1
30 xdef _one
31 end
Code Listing From a Competing Compiler
Notes:
- Code Size: 20-0+1 = 21 bytes
- five different products from other companies produced almost the same output
- the compiler's optimizer switch was enabled
- notice that the b register is repeatedly loaded with the same value (lines 22 25 28 31)
1 $ lbra,hc11
2 defseg c_text,class=CODE
3 defseg c_const,class=CODE
4 defseg c_strings,class=CODE
5 defseg c_data,class=CODE
6 defseg c_bss,class=DATA
7 defseg c_rdata,class=CODE
8 defseg c_rbss,class=PAGE0
9 defseg c_temp,class=PAGE0,overlaid
10 defseg c_vectors,start=$FFC0,overlaid
11 seg c_temp
0000& (0004) 12 ctemp rmb 4
13 seg c_rbss
14 seg c_text
15 global _main
16 signat _main,24
17 global _one
18 global _two
19 global _three
20 global _three_a
21 _main
0000& C6 01 22 ldab #1
0002& F7 0000& 23 stab _one
24 ;neil_1.c: 11: two = 1;
0005& C6 01 25 ldab #1
0007& F7 0003& 26 stab _two
27 ;neil_1.c: 12: three = 1;
000A& C6 01 28 ldab #1
000C& F7 0001& 29 stab _three
30 ;neil_1.c: 13: three_a = 1;
000F& C6 01 31 ldab #1
0011& F7 0002& 32 stab _three_a
33 ;neil_1.c: 14: }
0014& 39 34 rts
35 seg c_bss
36 _one
0000& (0001) 37 rmb 1
38 _three
0001& (0001) 39 rmb 1
40 _three_a
0002& (0001) 41 rmb 1
42 _two
0003& (0001) 43 rmb 1
44
45 end
Back to
Home
Neil Rieck
Waterloo, Ontario, Canada.