Table of Contents        Previous topic       Next topic       

C COMPILER->Code Bank Switching->Code Bank Switching Method

The compiler supports code bank switching enabling functions to be located in switchable memory banks.  This enables programs greater than 64k in size to be created.  Up to 256 separate code banks are supported and they may be selectable by writing to a port, an sfr or a memory mapped xdata address.

There are two operations required to enable code bank switching:

The compiler will generate the necessary code to automatically switch code banks whenever a banked function is called and the linker will automatically locate each function in the specified bank.

Unless the output file format is IEEE695, the linker will generate separate files for each bank of code.  These will be named <output filename>.bankn where <output filename> is the name of the unbanked program file and n is the bank number.   The exception to this is bank zero which will be combined with the unbanked program file, enabling you to program the unbanked code and the bank zero code into a single rom chip.  (If you do not want this, then simply avoid using bank 0).

An IEEE695 format output file will combine all banked and unbanked code into a single file.