2 regtrack.c - testing register tracking
8 volatile unsigned char __xdata t
;
10 __pdata
unsigned char ta
[] = {0x00,0x01,0x01,0x02,0x01,0xfe,0x7f,0xfe,0xef};
11 __code
const unsigned char tb
[] = {0x00,0x01,0x01,0x02,0x01,0xfe,0x7f,0xfe,0xef};
14 foo (unsigned char which
)
16 unsigned char i
, k
; // should be allocated to registers
17 volatile unsigned char m
= 1;
98 k
= m
; // prepare to exit outer loop
110 ASSERT (0 == (char)memcmp (ta
, tb
, sizeof tb
));
112 foo (1); ASSERT (t
== 1);
113 foo (2); ASSERT (t
== 2);
114 foo (3); ASSERT (t
== 3);
115 foo (4); ASSERT (t
== 4);
117 /* various checks for equality */
118 foo (5); ASSERT (!(t
^ 5));
119 foo (6); ASSERT (0 == (t
^ 6));
120 foo (7); ASSERT (!(t
- 7));
121 foo (8); ASSERT (0 == (t
- 8));
122 foo (9); ASSERT (0 == ((unsigned char)(t
+ (0x100 - 9))));
123 foo (10); ASSERT (!((unsigned char)(t
+ (0x100 - 10))));
124 foo (11); ASSERT (t
>= 11 && t
<= 11);
125 foo (12); ASSERT (t
> 11 && t
< 13);
127 foo (5); ASSERT (t
== 5);
128 foo (6); ASSERT (t
== 6);
129 foo (7); ASSERT (t
== 7);
130 foo (8); ASSERT (t
== 8);
131 foo (9); ASSERT (t
== 9);
132 foo (10); ASSERT (t
== 10);
133 foo (11); ASSERT (t
== 11);
134 foo (12); ASSERT (t
== 12);