http://www.yardley.cc/atari/compendium/atari-compendium-chapter-4-XBIOS.htm :The XBIOS, like the BIOS may utilize registers D0-D2 and A0-A2 as scratch registers and their contents should not be depended upon at the completion of a call. In addition, the function opcode placed on the stack will be modified. The XBIOS places its return code value in d0.