t (1/8x+p)=m

Make x the subject

I will assume you meant:

t( (1/8)x + p) = m

one way:
tx/8 + tp = m
times 8
tx + 8tp = 8m
tx = 8m-8tp
x = (8m-8tp)/t

other way:

(1/8)x + p = m/t
times 8
x + 8p = 8m/t
x = 8m/t - 8p

which is the same as the first solution