3.12.2 Registers usage (8051)

Unless the called function is declared as _naked, or the —callee-saves/—all-callee-saves command line option or the corresponding callee_saves pragma are used, the caller will save the registers (R0-R7) around the call, so the called function can destroy they content freely.

If the called function is not declared as _naked, the caller will swap register banks around the call, if caller and callee use different register banks (having them defined by the __using modifier).

The called function can also use DPL, DPH, B and ACC observing that they are used for parameter/return value passing.