Re: [cc65] Bank-switched ROMs

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2000-04-04 08:46:26


On Mon, Apr 03, 2000 at 06:05:39PM -0500, David Lloyd wrote:
> I'm writing the code for some bank-switched ROMs using ca65.  The problem
> I'm running into, is that there are 8 ROM banks. Bank 0 is at $D800-DBFF,
> and the other 7 are at the address $DC00-$DFFF.  I want to write my
> software so that I can have more than one segment in the same address
> space, so that I only have to link it all once.
>
> The idea is that I have all my source files, that I can assemble and link
> into one 8K ROM image that can go directly to EPROM.

This is easy (but maybe I got something wrong:-). Here is a sample linker
configuration:

MEMORY {
    BANK0:     	start = $0D800, size = $0400, type = ro, file = %O, fill = yes, fillval = 255;
    BANK1:     	start = $0DC00, size = $0400, type = ro, file = %O, fill = yes, fillval = 255;
    BANK2:     	start = $0DC00, size = $0400, type = ro, file = %O, fill = yes, fillval = 255;
    BANK3:     	start = $0DC00, size = $0400, type = ro, file = %O, fill = yes, fillval = 255;
    BANK4:     	start = $0DC00, size = $0400, type = ro, file = %O, fill = yes, fillval = 255;
    BANK5:     	start = $0DC00, size = $0400, type = ro, file = %O, fill = yes, fillval = 255;
    BANK6:     	start = $0DC00, size = $0400, type = ro, file = %O, fill = yes, fillval = 255;
    BANK7:     	start = $0DC00, size = $0400, type = ro, file = %O, fill = yes, fillval = 255;
}

SEGMENTS {
    BOOT:	load = BANK0, type = ro;
    CODE1:	load = BANK1, type = ro;
    CODE2:	load = BANK2, type = ro;
    ...
}

The only problem is, that you have to divide your code into segments that are
small enough to fit into the banks. Having a smaller segments is better, since
you can put more than one segment in a bank, and having very small segments
allows you to move them from one bank into another if you are out of space in
one bank.

Regards


	Uz


--
Ullrich von Bassewitz                                  uz_at_musoftware.de



---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:36 CET