Compact piston motor with gearbox