Builder module entry and subroutine entry and exit

Module entry

Consider a module entry to be a router that does some housekeeping and then branches to the appropriate subroutine:
  • Enter the builder at offset X'18'.
  • The first X'17' bytes are taken up by the standard DFHVM macro expansion.
  • Save DFHTBS’s registers (DFHTBS calls each builder).
  • Save the first two entries in the parameter list:
    1. The address of LIFO storage
    2. The index number of the subroutine to call.
  • Increase the value of register 1 by 8 to get past the first two entries.
  • Branch to the appropriate subroutine of the builder using the index number passed.
  • Return from the builder subroutine.
  • Restore registers.
  • Return to DFHTBS.

Subroutine entry

  • Register 1 points to the parameter list.
  • Store Register 14 (return address) at Register 2 + X'nn' (varies by entry point).
  • Store the parameter list into Register 2 + X'nn' (varies by entry point).
  • The length of the parameter list varies.

Subroutine exit (return to module entry)

  • Exit from the subroutine only through an “official” exit point.
  • The exit point is usually the end of the subroutine.
  • The end of the subroutine is indicated with “*end; /*BUILD */”.
  • In some cases, the end of the subroutine branches back to the exit point somewhere within the subroutine.
  • Return (BR R14) from within the subroutine.
  • Reload Register 14 from Register 2 + X'nn' and return to caller.