Correct Maths Stack usage (CHRIX/RESRI)
Posted: Mon Feb 12, 2018 6:52 pm
Hi everyone
I am perplexed regarding a small point around correct use of the Maths stack. I am well acquainted with Mr. Dunbar's authoritative exposition on the subject (found on Dilwyn's site) - my favorite go-to reference on this knarly topic...
Then I read both the SMSQ Reference Guide, as well as numerous mentions littered throughout the SMSQ source code.
My question is this: Before calling the CHRIX/RESRI vector to check that/reserve sufficient space is available, is it necessary to pre-load A1 with the current value of BVRIP(a6)?
We know that we need to re-load A1 with BVRIP(a6) _after_ calling CHRIX/RESRI and before adjusting (sub) A1 with the required space ready for returning a value to SBasic (equal to what was asked for in the CHRIX/RESRI call.) and then saving the adjusted A1 back to BVRIP(a6).
That's all OK, but do we _really_ need to load A1 _before_ the vector call as well?
Mr. Dunbar doesn't mention such a requirement, yet QA.RESRI specifically states that A1 should point to the current Maths stack as a parameter on _entry_.
I did attempt to search the SMSQ source code to find the actual QA.RESI routine, but failed dismally.
Thoughts, my friends?
I am perplexed regarding a small point around correct use of the Maths stack. I am well acquainted with Mr. Dunbar's authoritative exposition on the subject (found on Dilwyn's site) - my favorite go-to reference on this knarly topic...
Then I read both the SMSQ Reference Guide, as well as numerous mentions littered throughout the SMSQ source code.
My question is this: Before calling the CHRIX/RESRI vector to check that/reserve sufficient space is available, is it necessary to pre-load A1 with the current value of BVRIP(a6)?
We know that we need to re-load A1 with BVRIP(a6) _after_ calling CHRIX/RESRI and before adjusting (sub) A1 with the required space ready for returning a value to SBasic (equal to what was asked for in the CHRIX/RESRI call.) and then saving the adjusted A1 back to BVRIP(a6).
That's all OK, but do we _really_ need to load A1 _before_ the vector call as well?
Mr. Dunbar doesn't mention such a requirement, yet QA.RESRI specifically states that A1 should point to the current Maths stack as a parameter on _entry_.
I did attempt to search the SMSQ source code to find the actual QA.RESI routine, but failed dismally.
Thoughts, my friends?