3 storage: __xdata, __code,
7 #define TC(x) (0x10+(x))
8 #define TI(x) (0x1020+(x) + 0x100*(x))
9 #define TL(x) (0x10203040+(x))
11 const {storage
} unsigned char array_const_char
[4] = {TC(0), TC(1), TC(2), TC(3)};
12 const {storage
} unsigned int array_const_int
[4] = {TI(0), TI(1), TI(2), TI(3)};
13 const {storage
} unsigned long array_const_long
[4] = {TL(0), TL(1), TL(2), TL(3)};
15 unsigned char array_char
[4] = {TC(0), TC(1), TC(2), TC(3)};
16 unsigned int array_int
[4] = {TI(0), TI(1), TI(2), TI(3)};
17 unsigned long array_long
[4] = {TL(0), TL(1), TL(2), TL(3)};
19 volatile unsigned {type
} idx
;
20 volatile unsigned {type
} idx2
;
25 #ifndef __SDCC_pdk14 // Not enough RAM for all the temporaries.
28 ASSERT(array_const_char
[idx
] == TC(2));
29 ASSERT(array_const_int
[idx
] == TI(2));
30 ASSERT(array_const_long
[idx
] == TL(2));
32 ASSERT(idx
[array_const_char
] == TC(2));
33 ASSERT(idx
[array_const_int
] == TI(2));
34 ASSERT(idx
[array_const_long
] == TL(2));
36 ASSERT(array_const_char
[2] == TC(2));
37 ASSERT(array_const_int
[2] == TI(2));
38 ASSERT(array_const_long
[2] == TL(2));
40 ASSERT(array_char
[idx
] == TC(2));
41 ASSERT(array_int
[idx
] == TI(2));
42 ASSERT(array_long
[idx
] == TL(2));
44 ASSERT(array_char
[2] == TC(2));
45 ASSERT(array_int
[2] == TI(2));
46 ASSERT(array_long
[2] == TL(2));
51 array_char
[idx2
] = array_const_char
[idx
] | 0x80;
52 array_int
[idx2
] = array_const_int
[idx
] | 0x8080;
53 array_long
[idx2
] = array_const_long
[idx
] | 0x80808080;
55 ASSERT(array_char
[idx2
] == (TC(3) | 0x80));
56 ASSERT(array_int
[idx2
] == (TI(3) | 0x8080));
57 ASSERT(array_long
[idx2
] == (TL(3) | 0x80808080));