开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: NESTED SUBROUTINES


 

Richard,

Thank you for the info.? I need to figure out how to implement your
suggestion.? I found in the documentation on SAVE an option
?????????? SAVE? (14,12),,xxxxxxx
where xxxx is a ds 18f area to save the regs.? I am trying to figure
out if the change will work on DOS/VS rel 34.

Cheers
/tom c


On Wed, Oct 12, 2022 at 9:59 AM Richard Cornwell <rich@...> wrote:
Hi Tom,

? ?Typically 360/370 subroutine calls are done with a what is called a
?save area. This is 18 words allocated within the subroutine. On entry
?the registers are saved into the previous routines save area. Then the
?base register is set up and the save pointer is pointed to the current
?save area. On exit the registers are restore, this will include the
?previous save area.

?This means that if you call a subroutine again it will wipe out the
?previous calls information. To do this properly you will either need to
?allocate a bunch of memory to save all the registers in and advance the
?save pointer for each call. The other option is to allocate and free
?save areas at each call.

?Basically you will need to implement some sort of stack to handle
?function calls if you want true recursive calls.

Rich








Join [email protected] to automatically receive all group messages.