1 /** Absolute addressing tests.
9 # define ADDRESS(x) (0x02 ## x)
10 #elif defined(__SDCC_pic14)
11 # define ADDRESS(x) (0x01 ## x)
12 #elif defined(__SDCC_stm8)
13 # define ADDRESS(x) (0x10 ## x)
14 #elif defined(__SDCC_f8)
15 # define ADDRESS(x) (0x30 ## x)
17 # define ADDRESS(x) (0xCA ## x)
20 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // TODO: Make test suitable for pdk
26 {mem
} volatile TestStruct
__at(ADDRESS(BC
)) TestVar
= {0,0};
27 {mem
} char __at(ADDRESS(B7
)) u
;
28 {mem
} char __at(ADDRESS(B7
)) x
= 'x';
29 {mem
} char __at(ADDRESS(B9
)) y
= 'y';
30 {mem
} int __at(ADDRESS(B0
)) k
= 0x1234;
32 char * {mem
} __at(ADDRESS(A0
)) pc
= NULL
;
34 typedef char *Pointer
;
35 {mem
} Pointer
__at(ADDRESS(A4
)) p
= NULL
;
37 typedef char Array
[2];
38 {mem
} Array
__at(ADDRESS(A8
)) a
= {0};
40 typedef void (* const Function
)(void);
41 {mem
} Function
__at(ADDRESS(AC
)) f
= NULL
;
49 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // TODO: Make test suitable for pdk
50 #if !defined(PORT_HOST)
51 static {mem
} char __at(ADDRESS(B6
)) s
= 's';
52 char {mem
} *pC
= (char {mem
} *)(ADDRESS(B0
));
53 int {mem
} *pI
= (int {mem
} *)(ADDRESS(B0
));
59 ASSERT(pI
[0] == 0x1234);
61 ASSERT((unsigned int)&pc
==ADDRESS(A0
));
62 ASSERT((unsigned int)&p
==ADDRESS(A4
));
63 ASSERT((unsigned int)&a
==ADDRESS(A8
));
64 ASSERT((unsigned int)&f
==ADDRESS(AC
));
67 ASSERT((*((TestStruct
*)&k
)).a
== 0x1234);
72 #if defined(__SDCC_mcs51) || defined(__SDCC_ds390)
73 volatile __data
unsigned char __at(0x20) Byte0
= 0x00;
74 volatile __data
unsigned char __at(0x22) Byte1
= 0x00;
75 volatile __bit Bit0
, Bit1
, Bit2
, Bit3
, Bit4
, Bit5
, Bit6
, Bit7
, Bit8
;
81 #if defined(__SDCC_mcs51) || defined(__SDCC_ds390)
83 ASSERT(Byte0
== 0x00);
86 ASSERT(Byte0
== 0xFF);