Function: Gets a snapshot of available RAM from Wheels' expansion RAM.
Pass: Nothing.
Uses: r2, r3, r4, r6, r9L.
ramExpSize ($88c3).
bit masking tables at $522d-34.
expansion RAM's BAM homespace at $5025-44.
expansion RAM's BAM workspace at $5045-64.
RAM BAM checksum at $5024.
temporary space at $52c7.
GetRAMBam.
RamBlkAlloc.
Return:
r2L=# of consecutive free 64Kb banks. If r2L contains a zero value, then there are no
banks in Wheels' expansion RAM available.
r3L=# of starting bank pointing to the largest free area.
r4H=# of free 64Kb banks.
Destroyed: .A, .X, .Y.
Synopsis: Gives you a snapshot of available RAM that a program can use in accessing Wheels' expansion RAM. Basically what it does is that it loads r2L with the value (minus one) located at ramExpSize and loads r3L with $00 and then calls the RamBlkAlloc routine.
The RamBlkAlloc routine will allocate the largest available contiguous memory area and pass its parameters upon return. Upon returning from the RamBlkAlloc routine, it then calls the GetRAMBam routine to undo any changes that RamBlkAlloc routine may have made. Next, it recomputes the RAM BAM's checksum value and stores it back onto $5024. The resulting parameters are then returned back to the calling program.