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
89 void testRegTrack(void)
91 ASSERT(0==(char)memcmp(ta, tb, sizeof tb));
98 /* various checks for equality */
99 foo(5); ASSERT(!(t^5));
100 foo(6); ASSERT(0==(t^6));
101 foo(7); ASSERT(!(t-7));
102 foo(8); ASSERT(0==(t-8));
103 foo(9); ASSERT(0==((unsigned char)(t+(0x100-9))));
104 foo(10); ASSERT(!((unsigned char)(t+(0x100-10))));
105 foo(11); ASSERT(t>=11 && t<=11);
106 foo(12); ASSERT(t>11 && t<13);
108 foo(5); ASSERT(t==5);
109 foo(6); ASSERT(t==6);
110 foo(7); ASSERT(t==7);
111 foo(8); ASSERT(t==8);
112 foo(9); ASSERT(t==9);
113 foo(10); ASSERT(t==10);
114 foo(11); ASSERT(t==11);
115 foo(12); ASSERT(t==12);