1 /* bug-2966.c 2 An error in instruction size estimation for z80 resulted in an out-of-range relative jump. 3 */ 4 5 #include <testfwk.h> 6 7 #ifdef __SDCC 8 #pragma disable_warning 85 9 #endif 10 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 17 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 24 displayOn(void)25void displayOn (void) { 26 return; 27 } 28 SMS_waitForVBlank(void)29void SMS_waitForVBlank (void) { 30 return; 31 } 32 PSGFrame(void)33void PSGFrame (void) { 34 return; 35 } 36 PSGStop(void)37void PSGStop (void) { 38 return; 39 } 40 filter_paddle(unsigned int i)41unsigned int filter_paddle (unsigned int i) { 42 return i; 43 } 44 SMS_getKeysPressed(void)45unsigned int SMS_getKeysPressed (void) { 46 return PORT_B_KEY_2; 47 } 48 PSGPlay(void * p)49void PSGPlay (void *p) { 50 return; 51 } 52 53 void *CH0_psgc, *CH1_psgc, *CH2_psgc, *CH3_psgc, *VolumeTest_psgc; 54 55 unsigned int kp; 56 testBug(void)57void testBug (void) { 58 displayOn(); 59 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; 76 } 77 PSGStop(); 78 } 79 80