There's a couple ways to do it, you have to figure out which is most intuitive.
One example:
Code:
DRIVE_L = (int) STICK_Y + ((int) STICK_X - 127);
DRIVE_R = (int) STICK_Y - ((int) STICK_X - 127);
DRIVE_L = (DRIVE_L<0)?(0):((DRIVE_L>254)?(254):(DRIVE_L));
DRIVE_R = (DRIVE_R<0)?(0):((DRIVE_R>254)?(254):(DRIVE_R));