[cc65] Segments and banking

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2001-05-25 15:30:40


On Fri, May 25, 2001 at 09:13:33AM -0400, shubel, paul wrote:
> Question:  Can CC65 compile and link a segmented build?  For example,
> can it call modules in "banked" areas of memory to exceed the 64K boundary?

cc65 cannot call functions in other banks by itself, because the banking
mechanism is always hardware dependent. However, the linker is able to overlay
memory areas. This means that it is possible to write programs for banked
hardware with some help from the programmer.

> Is this what is meant by segments?

segments are just some hunks of code or data that have a name. The linker
combines all pieces that have the same name to one large chunk, and places it
into a memory area according to the rules in the configuration file.

This means that by placing a function f1() into a segment with the name CODE1,
and a function named f2() into a segment CODE2, it is possible to tell the
linker to relocate both segments CODE1 and CODE2 to the same address, but
write it to different files. To support banking, the programmer has to supply
a short stub in common memory for each such function that enables the correct
bank and calls the function.

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:40 CET