Next Previous Contents

3. Memory layout

cc65 generated programs for the Commodore 510 run in bank 0, the memory bank reserved for BASIC programs. Since there are no ROMs in this memory bank, kernal subroutines are either emulated or called by bank switching, which has the disadvantage of being slow compared to a direct call.

The default memory configuration for the CBM 510 allocates all memory between $0002 and $FFF0 in bank 0 for the compiled program. Some space in low memory is lost, because a separate hardware stack is set up in page 1, and the kernal replacement functions need some more memory locations. A few more pages are lost in high memory, because the runtime sets up a copy of the character ROM, a text screen and a CBM compatible jump table at $FF81. The main startup code is located at $0400, so about 54K of the complete bank are actually usable for applications.

Special locations:


The C runtime stack is located at $FF81 and growing downwards.


The C heap is located at the end of the program and grows towards the C runtime stack.

Next Previous Contents