A bank is memory from 0x4000 to 0x7FFF. A bank is 16Kb-long, so there are 4 distinct banks to make the extra 64Kb of memory.
I had to define the following in my custom code..
Code: Select all
#define crBANKSetC0( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C0 \n out (c),a" );
#define crBANKSetC4( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C4 \n out (c),a" );
#define crBANKSetC5( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C5 \n out (c),a" );
#define crBANKSetC6( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C6 \n out (c),a" );
#define crBANKSetC7( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C7 \n out (c),a" );
When I just call crBANKSetC4, memory from 0x4000 to 0x3FFF becomes the one in extra-bank called C4. And so on for the three other banks. After using it, I use to get back to default one through a crBANKSetC0 call.
That's why it has been so hard when using large files generated by z88dk. Even when compiled to a low-adress origin, let's say 0x400, my final binary was so large it was using 0x4000 and more as memory. When I switched to a bank different from C0, kaboom, it made the app crash.
Hope this can helps.