Warning
You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.
Table of Contents
Memory layout
This page describes the default memory layout of an XC=BASIC program along with the reserved zero page and other locations.
Default memory configuration
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.
Program layout
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.
Zero page usage
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 |
Other reserved locations
Location | Note |
---|---|
$0100-$01FF | The stack |
$02FE-$02FF | Return address of USR() |