/* Initialize this at the top of the user_routines.c file */ signed char in; const rom signed char JOYSTICK_RAMP[127] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 19, 19, 20, 21, 21, 23, 24, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 47, 48, 49, 50, 52, 53, 54, 55, 56, 58, 60, 61, 62, 64, 65, 67, 68, 70, 71, 73, 74, 76, 77, 79, 80, 82, 84, 85, 87, 89, 90, 92, 94, 96, 97, 99, 101, 103, 105, 107, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126 }; -------------------------------------------------------------------------------- /* Place this function in user_routines.c */ /******************************************************************************* * FUNCTION NAME: ramp * PURPOSE: This code ramps the joystick values to an x^2 curve, smoothing * the acceleration. * * CALLED FROM: this file * ARGUMENTS: in * RETURNS: smoothed value *******************************************************************************/ signed char ramp(unsigned char in) { if (input <= 127) /* Tests if the trigger button on { Port 1 has just been pressed */ return ((unsigned char) (127 - JOYSTICK_RAMP[127 - in])); /* Return smooth } value */ else { return ((unsigned char) (128 + JOYSTICK_RAMP[in - 127])); /* Return smooth } value */ } -------------------------------------------------------------------------------- /* Place this code in front of the drive code in Default_Routine() in user_routines.c*/ ramp(p1_x); /* Smooth joystick values */ ramp(p1_y);