2 regtrack.c - testing register tracking
14 volatile unsigned char __xdata t;
16 __pdata unsigned char ta[]={0x00,0x01,0x01,0x02,0x01,0xfe,0x7f,0xfe,0xef};
17 __code const unsigned char tb[]={0x00,0x01,0x01,0x02,0x01,0xfe,0x7f,0xfe,0xef};
20 foo(unsigned char which)
22 unsigned char i,k; // should be allocated to registers
23 volatile unsigned char m = 1;
85 k = m; // prepare to exit outer loop
97 ASSERT(0==(char)memcmp(ta, tb, sizeof tb));
100 foo(2); ASSERT(t==2);
101 foo(3); ASSERT(t==3);
102 foo(4); ASSERT(t==4);
104 /* various checks for equality */
105 foo(5); ASSERT(!(t^5));
106 foo(6); ASSERT(0==(t^6));
107 foo(7); ASSERT(!(t-7));
108 foo(8); ASSERT(0==(t-8));
109 foo(9); ASSERT(0==((unsigned char)(t+(0x100-9))));
110 foo(10); ASSERT(!((unsigned char)(t+(0x100-10))));
111 foo(11); ASSERT(t>=11 && t<=11);
112 foo(12); ASSERT(t>11 && t<13);
114 foo(5); ASSERT(t==5);
115 foo(6); ASSERT(t==6);
116 foo(7); ASSERT(t==7);
117 foo(8); ASSERT(t==8);
118 foo(9); ASSERT(t==9);
119 foo(10); ASSERT(t==10);
120 foo(11); ASSERT(t==11);
121 foo(12); ASSERT(t==12);