Try something like this:
pwm01 = 127 + (p1_sw_trig*127) - (p1_sw_top*127);
That way, if p1_sw_trig is pressed, the motor will be full forward (254). If p1_sw_top is pressed, it will go full reverse (0). If by mistake you press both buttons, nothing happens - safe!
Gotta love one liners
