7.4 | PROGRAMING AUXILIARY MEMORY |
AUXMOVE AND XFER
No
AUXMOVE is used to move blocks of data between main and auxiliary memory. Three pairs of bytes are used to pass addresses to AUXMOVE. Al is used for the starting address of the source block (AlL at $3C for
Data addresses must be put into byte pairs in Page 0, and the carry bit set to select a move from Main to Auxiliary (SEC) or Auxiliary to Main memory (CLC). This must be done before calling the AUXMOVE routine. AUXMOVE cannot be used to copy data in the memory space switched by ALTZP (Page 0, stack,
When AUXMOVE is called by a JSR, the block of data specified by the A registers is copied in the direction specified by the carry bit. When complete, the x and y registers and accumulator are back as they were when the subroutine was called.
XFER is used to transfer program control between programs in main and auxiliary memory. To use the subroutine XFER to transfer control to and from segments in auxiliary memory, you must first set up three parameters: 1) the address of the routine being transferred to; 2) the
The low byte of the program starting address is placed at $3ED, the high byte at $3EE (low byte first). The carry bit is set (SEC) to transfer from main to auxiliary, or cleared (CLC) to go from auxiliary to main memory. Set the overflow bit to use Page 0 and stack in auxiliary memory, or clear (CLV) the overflow bit to use Page 0 and stack in main memory.
Be sure to save the current stack pointer in current memory space before using XFER and restore it afterwards.
Control is passed to the XFER routine by a jump instruction rather than a subroutine call. The accumulator and transfer address are saved on the current stack, the soft switches set for the parameters selected, and the jump to the new program is executed.