struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2966.c
blob10945acbb3599c1d7601580fb2c7efa275e43079
1 /* bug-2966.c
2 An error in instruction size estimation for z80 resulted in an out-of-range relative jump.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma disable_warning 85
9 #endif
11 #define PORT_A_KEY_UP 0x0001
12 #define PORT_A_KEY_DOWN 0x0002
13 #define PORT_A_KEY_LEFT 0x0004
14 #define PORT_A_KEY_RIGHT 0x0008
15 #define PORT_A_KEY_1 0x0010
16 #define PORT_A_KEY_2 0x0020
18 #define PORT_B_KEY_UP 0x0040
19 #define PORT_B_KEY_DOWN 0x0080
20 #define PORT_B_KEY_LEFT 0x0100
21 #define PORT_B_KEY_RIGHT 0x0200
22 #define PORT_B_KEY_1 0x0400
23 #define PORT_B_KEY_2 0x0800
25 void displayOn (void) {
26 return;
29 void SMS_waitForVBlank (void) {
30 return;
33 void PSGFrame (void) {
34 return;
37 void PSGStop (void) {
38 return;
41 unsigned int filter_paddle (unsigned int i) {
42 return i;
45 unsigned int SMS_getKeysPressed (void) {
46 return PORT_B_KEY_2;
49 void PSGPlay (void *p) {
50 return;
53 void *CH0_psgc, *CH1_psgc, *CH2_psgc, *CH3_psgc, *VolumeTest_psgc;
55 unsigned int kp;
57 void testBug (void) {
58 displayOn();
60 for(;;) {
61 SMS_waitForVBlank();
62 PSGFrame();
63 kp=filter_paddle(SMS_getKeysPressed());
64 if (kp & (PORT_A_KEY_UP|PORT_B_KEY_UP))
65 PSGPlay(CH0_psgc);
66 if (kp & (PORT_A_KEY_RIGHT|PORT_B_KEY_RIGHT))
67 PSGPlay(CH1_psgc);
68 if (kp & (PORT_A_KEY_DOWN|PORT_B_KEY_DOWN))
69 PSGPlay(CH2_psgc);
70 if (kp & (PORT_A_KEY_LEFT|PORT_B_KEY_LEFT))
71 PSGPlay(CH3_psgc);
72 if (kp & (PORT_A_KEY_1|PORT_B_KEY_1))
73 PSGPlay(VolumeTest_psgc);
74 if (kp & (PORT_A_KEY_2|PORT_B_KEY_2))
75 break;
77 PSGStop();