BANKSWAP: A Banked Memory Debugging Tool for CP/M Plus Albert S. Woodhull Hampshire College Amherst, MA 01002 Copyright 1985, Albert S. Woodhull The BANKSWAP.LBR file contains, in addition to this READ.ME file, the source, BANKSWAP.ASM, and RSXMAKER.SUB, which can be used to control the process of assembly, linking, and attaching the resident system extension to an executable file. A complete description of the program was published in Dr. Dobb's Journal, Volume 10, Issue 12, December 1985, on pages 34-52. The following text is abstracted from that article: BANKSWAP is not a standalone program; it is an enhancement to SID or DDT that provides additional commands to copy blocks of memory from bank to bank. The normal functions of the debugger can be used on a copy of memory from another bank that has been brought to the TPA bank. BANKSWAP is relocatable, and is not necessarily loaded to the same location each time it is used. For ease of use BANKSWAP installs a vector to its own entry point at the RST 5 location (28H) during installation. Typing "G28" from the SID or DDT prompt brings up the BANKSWAP menu. The initialization process also displays a message to remind the user of the presence of BANKSWAP and the command to access it. The BANKSWAP menu allows choice of the direction of the move, the memory addresses for the source and destination, and the length of the block to be moved. The menu also provides for easy return to DDT or SID, and for the eventual removal of BANKSWAP. The listing contains comments that explain the operation of BANKSWAP, but I will emphasize a few points I found important in working with banked memory. Although I wrote this program for use on an Apple with the A.L.S. CP/M Card there should be no problems in making BANKSWAP work on other implementations of CP/M Plus. The most critical point is to be sure that control is not lost while bank 1 is deselected. This means ensuring that BANKSWAP itself, the stack, and all data areas used are located in common memory. It is possible for a CP/M Plus system to be constructed so interrupts and system calls can be handled while alternate banks are selected. However, for insurance I thought it best to disable interrupts and avoid calls to the standard BDOS entry point while bank 1 is deselected, since the vectors on page 0 of bank 1 are then inaccessible. There is a potential problem with the version of BANKSWAP shown in listing 1, but I leave it for someone else to fix. As noted above, BANKSWAP uses the RSX technique in order to be located at the highest available meory address. The actual amount of high memory that is common depends upon the hardware used, and I didn't figure out a way for a program to determine this. If too many RSXs are installed, the top of available memory can be below the common region. In this case BANKSWAP will probably cause a crash. On my Rev. A CP/M card the common memory limit is at 8000H, ahich leaves room for a lot of RSXs, so I have never given the problem a high priority. The BANKSWAP.LBR file is being uploaded to the CompuServe CP/M SIG on December 15, 1985. The author can be reached by EMAIL to 74156,1067 on CompuServe, or by mail to the address at the beginning of this file. He would appreciate being informed of further distribution of these files.