On 3/19/2007 11:00:43 AM, Daniel Bliss wrote:
>Hello,
I'm trying to work out
>the best way to pass
>parameters to a called
>subroutine. Mostly I'm
>calling named subs within the
>same file, as in
>Call(":sub1"). Within 'sub1',
>I push the contents of user
>registers onto respective
>stacks, Num_Push(0,95) &
>Reg_Push(0,95); then
>re-initialize the numeric
>registers to 0. At the end of
>the sub, I pop the stack.
As Ted & Christian have stated, this is the only option.
You might want to consider why you are pushing/popping registers.
While this is how traditional languages handle registers, it is better to think of these as global variables.
If you plan the program, it is usually possible to allocate a range of registers to the main program & each procedure.
In most cases there are more than enough registers.
I only push/pop when I am writing procedures which involve recursive calls.
|
|