struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug1535242.c
blob08f5751bf15aa046915b296d027907a3dcc269a0
1 /* saving "bits" test for mcs51/stack-auto.
2 */
3 #include <testfwk.h>
5 #if defined(__SDCC_mcs51)
6 #include <8052.h>
7 #include <stdbool.h>
9 bool
10 manipulate_bits (bool x) __using (2)
12 return x;
15 bool
16 complement (bool x)
18 return !x;
20 #endif
22 void
23 testSaveBits (void)
25 #if defined(__SDCC_mcs51)
26 //enable the interrupt and set it
27 ET2 = 1;
28 EA = 1;
29 TF2 = 1;
31 //this will pass b0 cleared, test whether it will arrive cleared
32 if (complement(false))
34 EA = 0;
35 ASSERT (1);
37 else
39 EA = 0;
40 ASSERT (0);
42 #else
43 ASSERT (1);
44 #endif
47 #if defined(__SDCC_mcs51)
48 void
49 T2_isr (void) __interrupt (5) __using (2)
51 //do not clear flag ET2 so it keeps interrupting !
53 //this will set b0
54 manipulate_bits (true);
56 #endif