8.4 | AUXILIARY MEMORY MANAGEMENT |
| Initializing The Card |
When the Apple is first booted from a cold start, auxiliary bank 0 (zero) is selected. This is the //c’s own
A program, however, should not assume bank 0 (zero) will he immediately available to it. A program may have been run previously that left another bank selected. Make it a practice to select bank 0 (zero) when first addressing the card and when exiting your program. This will ensure error free operation for your program and programs run after it.
Identifying MultiRam C MemoryAfter selecting auxiliary bank 0 (zero), your program should next determine how such memory is available on the card for use by your program.
Memory banks can be identified by writing a particular bit pattern into a specific location or locations in a memory bank. Next read the memory location that the pattern was written into and compare what is found there against the original pattern. A 64K auxiliary memory bank exists if there is a match.
Many different techniques can be used to perform the write/read/Compare operation. A preferred method is to use a descending loop that selects the highest memory bank available on the card, writes the expected auxiliary bank number and a checksum value into two bytes of that bank, decrements the bank counter and then repeats the process ending with bank 0 (zero). This would be followed by a descending loop that reads the bytes from the two bytes of each bank and compares them against the expected value.
A descending identification loop is preferable as it consistently identifies useable 64K banks from the highest possible bank number to the lowest.
Using a descending loop starting with $18 rather than $8 would ensure the software developed for MultiRam C would also work with MultiRam //e and MultiRam ROB memory cards. These cards can be combined in the //e to give op to 1.5 megabytes of memory. The ending 64K bank of their 1.5 megabyte combination is defined as siB. In the I/c. selecting