I wonder if you can tell me what is the S register in your code.
Is it the SP register ?
Why is the indexed is $102 ?
What is page 1 ?
Also when you wrote
the caller pushes one byte on the stack for the result
you mean that is one C routine parameter ?
And "the caller pops the result form the stack" do you mean that the results always return in the stack, and not in register A ?
Retrieving data ...