Assembler language programming conventions

The following list summarizes the assembler language programming conventions:
  • Application programs should not execute privileged instructions, nor explicitly issue the supervisor call (SVC) instruction.
  • Application programs should not make use of the restricted-use control program macros described in z/TPF System Services. Only the general use control program macros and the general purpose application macros are appropriate for application programs, because only these macros are guaranteed to be compatible with later z/TPF releases.
  • The general registers 0 through 7 are reserved for use by application programs. Their contents are saved across all control program macros. Registers 14 and 15 may also be used by application programs, but are often used by the control program to pass information between programs. The contents are not guaranteed across macro calls unless otherwise indicated.
  • General register 8 always contains the base address of the active application program. It must not be altered by application programs.
  • General register 9 always contains the address of the current active entry control block. It must not be altered by application programs.
  • General register 10 can be used as a scratch register (the contents are not guaranteed across macro calls).
  • General registers 11 and 12 are reserved for control program use. Their contents must not be modified by an application program. Register R11 contains a value of X'1000' and register R12 contains a value of X'2000'.
  • General register 13 can be used as a scratch register (the contents are not guaranteed across macro calls).
  • General registers 10 to 13 can be used by application programs that use the extended register save function either by coding the EREGSAVE parameter on the BEGIN macro or by using the DEFBC macro. By using the extended register save function, the contents of R10–R13 are saved across all general macro calls. For more information about the extended register save function, see the BEGIN and DEFBC macros in z/TPF General Services.
  • All storage is assigned by the control program. You do not, in general, code define storage (DS) commands in your own application program to describe storage block formats. Instead, your program requests storage blocks from the control program and uses the z/TPF system or user data macros to describe the formats.
  • An application macro may generate inline code or an SVC through the use of a control program macro. The SVC machine instruction is never directly used by an application.
  • In the z/TPF system, if macro expansion code that includes branch relative instructions is processed outside of the core resident program area (CRPA), unpredictable results can occur. If you need to move generated code, code the DEFBC macro with RELATIVE=NO specified around the macro call that uses branch relative instructions. You can use branch relative target check mode to identify programs that use branch relative instructions for branch targets outside of a program. See z/TPF and z/TPFDF Migration Guide: PUT 2 and Later for more information about branch relative target check mode.