pass sp by func instead of loading from ram