Inadvertly added the and2.asm to cvs instead of and2.c
[fw/sdcc] / src / regression / and2.c
1 #define __16F873
2 #include "p16f873.h"
3
4 unsigned char success=0;
5 unsigned char failures=0;
6 unsigned char dummy=0;
7
8
9 unsigned int uint0 = 0;
10 unsigned int uint1 = 0;
11 unsigned char uchar0 = 0;
12 unsigned char uchar1 = 0;
13 unsigned long ulong0 = 0;
14
15 void done()
16 {
17
18   dummy++;
19
20 }
21
22 // uchar0 = 0x13;
23 void and_compound1(void)
24 {
25   uchar0 = (uchar0 + 1) & 0x0f;
26   if(uchar0 != 4)
27     failures++;
28 }
29
30
31 // uchar1 = 0x42;
32 void and_compound2(void)
33 {
34   uchar0 = (uchar1 + 1) & 0x0f;
35   if(uchar0 != 3)
36     failures++;
37
38   if(uchar1 != 0x42)
39     failures++;
40 }
41
42 // uchar0 = 0x13;
43 void or_compound1(void)
44 {
45   uchar0 = (uchar0 + 0xe) | 0x0f;
46   if(uchar0 != 0x2f)
47     failures++;
48 }
49
50
51 // uchar1 = 0x47;
52 void or_compound2(void)
53 {
54   uchar0 = (uchar1 + 0xf) | 0x0f;
55   if(uchar0 != 0x5f)
56     failures++;
57
58   if(uchar1 != 0x47)
59     failures++;
60 }
61
62
63
64 // uchar0 = 0x13;
65 void xor_compound1(void)
66 {
67   uchar0 = (uchar0 + 1) ^ 0x0f;
68   if(uchar0 != 0x1b)
69     failures++;
70 }
71
72
73 // uchar1 = 0x47;
74 void xor_compound2(void)
75 {
76   uchar0 = (uchar1 + 0xf) ^ 0x0f;
77   if(uchar0 != 0x59)
78     failures++;
79
80   if(uchar1 != 0x47)
81     failures++;
82 }
83
84 // uchar0 = 0x13;
85 void neg_compound1(void)
86 {
87   uchar0 = ~(uchar0 + 1);
88   if(uchar0 != 0xeb)
89     failures++;
90 }
91
92
93 void main(void)
94 {
95
96   uchar0 = 0x13;
97   and_compound1();
98
99   uchar1 = 0x42;
100   and_compound2();
101
102   uchar0 = 0x13;
103   or_compound1();
104
105   uchar1 = 0x47;
106   or_compound2();
107
108   uchar0 = 0x13;
109   xor_compound1();
110
111   uchar1 = 0x47;
112   xor_compound2();
113
114   uchar0 = 0x13;
115   neg_compound1();
116
117   success = failures;
118   done();
119 }