This page describes the default memory layout of an XC=BASIC program along with the reserved zero page and other locations.
On startup, the XC=BASIC runtime library sets up the following memory configuration:
Area | Usage |
---|---|
$0000-$9FFF | RAM |
$A000-$BFFF | RAM |
$C000-$CFFF | RAM |
$D000-$DFFF | I/O AREA |
$E000-$FFFF | KERNAL ROM |
Note that BASIC ROM is banked out in order to have a large consecutive RAM area for the XC=BASIC program. The above configuration does not change during the lifetime of the program, except for one case: if you use floats, the BASIC ROM is temporary banked in during the floating point calculations. This doesn't effect the code or data that you keep between $A000 and $BFFF.
This is the typical layout of an XC=BASIC program :
Area | Content |
---|---|
$0801-$080C | BASIC loader |
$080D-$0B7B | Runtime library* |
$0B7C-$???? | Code |
$????-$???? | Data |
$????-$???? | Variables |
*As of current version. This may change any time
After successful compilation, the exact addresses of the above areas will be displayed on the screen.
The variable area is not included in the assembled binary, but you should note the end of it and make sure you don't overwrite its contents.
The following zero page locations are reserved by XC=BASIC:
Location | Note |
---|---|
$02-$10 | Reserved if using FAST variables |
$3F-$46 | Reserved |
$61-$6E | Reserved if using FLOATS |
$FB-$FE | Reserved |
Location | Note |
---|---|
$0100-$01FF | The stack |
$02FE-$02FF | Return address of USR() |