* src/SDCCmem.c (allocDefault): removed check sym->level==0 for SPEC_ABSA,
[fw/sdcc] / support / regression / tests / absolute.c
1 /** Absolute addressing tests.
2
3     mem: code, xdata
4 */
5 #include <testfwk.h>
6
7 {mem} at(0xCAB7) char u;
8 {mem} at(0xCAB7) char x = 'x';
9 {mem} at(0xCAB9) char y = 'y';
10 {mem} at(0xCAB0) int  k = 0x1234;
11
12 char z = 'z';
13
14 void
15 testAbsolute(void)
16 {
17 #if defined(SDCC_mcs51) || defined(SDCC_ds390) || defined(SDCC_hc08)
18   static {mem} at(0xCAB6) char s = 's';
19   char {mem} *pC = (char {mem} *)(0xCAB0);
20   int  {mem} *pI = (int  {mem} *)(0xCAB0);
21
22   ASSERT(u == 'x');
23   ASSERT(pC[7] == 'x');
24   ASSERT(pC[9] == 'y');
25   ASSERT(pC[6] == 's');
26   ASSERT(pI[0] == 0x1234);
27 #endif
28 }
29
30 #if defined(SDCC_mcs51) || defined(SDCC_ds390)
31 volatile data at(0x20) unsigned char Byte0 = 0x00;
32 volatile data at(0x22) unsigned char Byte1 = 0x00;
33 volatile bit Bit0, Bit1, Bit2, Bit3, Bit4, Bit5, Bit6, Bit7, Bit8;
34 #endif
35
36 void
37 testAbsBdata(void)
38 {
39 #if defined(SDCC_mcs51) || defined(SDCC_ds390)
40   Bit0 = 1;
41   ASSERT(Byte0 == 0x00);
42   Byte0 = 0xFF;
43   Bit0 = 0;
44   ASSERT(Byte0 == 0xFF);
45 #endif
46 }