Preserving Registers 

One of the crucial issues in developing a stable and robust assembly language program is conflict of using register between calling program and the called procedure. Because registers are processor's resources shared together by calling program and the called procedure, then it makes sense that many times called procedure may modify the content of some registers that are still being used by the calling program.

The customary solution is to preserve registers before the procedure performs its main job and to restore the register values after its completion.

There are two ways to preserve registers:

The procedure tackles everything. In the beginning, the procedure preserves registers and at the end before the procedure returns, it recovers all original registers values.
The calling program presupposes that the procedures do not preserve the registers. The calling program takes all responsibilities to preserve and to restore the registers.

However, employing the register preservation carelessly causes performance degradation considerably. It could be time-consuming and it increases the amount of code. Thus, it is the programmer's responsibility to find the best trade-off.