RE: [cc65] Bankswitching with ld65

From: Mark Keates <mark1mkeates.f9.co.uk>
Date: 2007-06-15 12:01:26
Sometimes I find it useful to give the memory section
the address of the offset it would have in the ROM itself.
Then its address (e.g. 24 bits) can be used in code to calc
the required 'bank' value you set the appropriate memory
register too in order to switch in the bank, e.g. for
making a table of jmp-addresses.

In the Segments section you then can use 'run=' to specific
the memory area that the linker will generate the runtime
addresses for labels within that bank.

MEMORY {
  ...
  ROM_AREA: start = $A000, size = $2000, type = rw;
  ROM0: start = $0000, size = $2000, type = ro, fill = yes, fillval = $FF,
file = %O;
  ROM1: start = $2000, size = $2000, type = ro, fill = yes, fillval = $FF,
file = %O;
  ...
}

SEGMENTS {
  ...
  BANK0: load = ROM0, run = ROM_AREA, type = wprot, define = yes;
  BANK1: load = ROM1, run = ROM_AREA, type = wprot, define = yes;
  ...
}

> MH> How would I set this up in the linker config file?
>
> You use multiple memory sections:
>
> MEMORY {
>   BANK1: start = $8000, size = $4000;
>   BANK2: start = $8000, size = $4000;
> }
>
> then place your segments into whichever bank you want them.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Jun 15 12:02:04 2007

This archive was generated by hypermail 2.1.8 : 2007-06-15 12:02:07 CEST