Memory bank mapping, Memory transfers – Checkmate Technology MultiRam C The memory card User Manual

Page 78

Advertising
background image

AUXILIARY

MEMORY MANAGEMENT

8.5

An example of a routine to identify useable memory is as follows:

LDX BANK#

Bank number to start. $1B for //e compatibility

MARKALL

STX BNKSELCT

Select bank with the $C07X bank switch

STX ALTZP

Write to $C009 for aux. zero page

STX TEST1

Write the bank number to first location
in zero page of selected bank

TXA

Prepare for EOR

E0R #FF

Reverse the bank’s bits setting

STA TEST2

Write the checksum byte to second location
in zero page of selected bank

DEX

Decrease the bank counter

BPL MARKALL

Loop through to bank zero

LDX BANK1

Bank number to start, same as MARKALL start

READALL

STX BNXSELCT

Select bank with the $C07X bank switch

CPX TEST1

Compare bank number against memory

BNE MAPFAIL

Memory map marked showing bank n with no memory

TXA

Prepare for EOR

EOR #FF

Prepare the checksum for the double check

CMP TEST2

Compare the EOR’d byte for the double check

BNE MAPFAIL

Memory map marked showing bank n with no memory

BEQ MAPPASS

Memory bank exists, mark bank n into memory

READNEXT

MAPFAIL, MAPPASS return here

DEX

Decrease the bank count

BPL READALL

Loop through to bank 0

STX MAINZP

Select main memory zero page

RTS

M e m o r y B a n k M a p p i n g

You should keep a record 0f available memory for your program’s use after you
have identified the memory on the card. Either a byte map or a bit map could be
used for the memory map. You may wish to construct a map that not only shows
which 64K banks are useable, but like DOS and ProDOS sector bit maps, also keeps
track of the availability of smaller increments of memory. The auxiliary bank
memory map could then become part of a larger memory manager.

You will also need to use a byte or bytes to track the memory bank in current
use. The $CO7X strobe cannot be read to see which bank was last called.

M e m o r y T r a n s f e r s

Data can be transferred from main memory to auxiliary memory and back using
standard //c auxiliary memory transfer commands. The RAMRD and RANWRT soft
switches and the AUXMOVE routine described in Chapter 7 all function normally.
The only difference is the additional need to determine which of the MultiRam
C’s 64K banks should be used for the transfer.

Advertising