Re: [cc65] Bank Switching

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-09-21 00:27:14


On Fri, Sep 20, 2002 at 10:10:13AM -0700, Shawn Jefferson wrote:
> Ok, two problems: one the linker complains about the type = empty, saying
> that "a type is expected", changed it to rw.

"type = empty" is only allowed for segments. It is used to discard a segment
and avoid having the linker output a warning. There is no need to use it for a
memory area.

> Second, the executable does not
> work when compiled with this config file.  The only executables I've been able
> to use have been with a plain vanilla config file.

This is probably because the "BANK" memory area is empty. Are you loading the
resulting output file with the standard commands of the operating system? If
so, you have a problem. The layout of your output file looks like this:

1.      +------------+
        |   Header   |
        +------------+ <- $2000
        |    RAM1    |
        +------------+ <- $2000 + length of RAM1
        |    RAM2    |
        +------------+

Since BANK is empty (there are no segments written to this memory area), no
output is generated for this memory area. What you have to do is to use the
"fill = yes" attribute for the RAM1 and BANK segments to make sure the output
file looks like this:

2.      +------------+
        |   Header   |
        +------------+ <- $2000
        |    RAM1    |
        +- - - - - - + <- $2000 + length of RAM1
        |   Unused   |
        +------------+ <- $4000
        |    BANK    |
        |  (Unused)  |
        +------------+ <- $8000
        |    RAM2    |
        +------------+

You can then load the resulting binary. It will overwrite the memory in BANK
with useless garbage, but should work otherwise.

If you don't want to overwrite the memory in BANK, you will have to use a
custom solution that loads both RAM areas in separate steps. However, this is
not a cc65 problem but one of your environment.

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 : 2002-09-21 00:27:13 CEST