#
# FastBasic - Fast basic interpreter for the Atari 8-bit computers
# Copyright (C) 2017-2019 Daniel Serpell
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program.  If not, see <http://www.gnu.org/licenses/>
#

# Linker configuration file
# -------------------------

FEATURES {
    # This defines the start of RAM used for the program
    STARTADDRESS: default = $2000;
}
SYMBOLS {
    __STARTADDRESS__: type = export, value = %S;
}

MEMORY {
    ZP:      file = "", define = yes, start = $0094, size = $0040;
# Used by the IDE to write the header into compiled programs
    PREMAIN: file = %O, define = yes, start = %S-4,  size = 4;
# "main program" load chunk
    MAIN:    file = %O, define = yes, start = %S,    size = $BC20 - %S;
# code in zero page!
    INTERP:  file = %O, define = yes, start = $0082, size = $0012;
}

#FILES {
#    %O: format = atari;
#}

#FORMATS {
#    atari: runad = start;
#}

SEGMENTS {
    ZEROPAGE: load = ZP,      type = zp,  optional = yes;
    PREHEAD:  load = PREMAIN, type = rw,  optional = yes, define = yes;
    JUMPTAB:  load = MAIN,    type = ro,                  define = yes, align = $100;
    RUNTIME:  load = MAIN,    type = rw,                  define = yes;
    RT_DATA:  load = MAIN,    type = rw,                  define = yes;
    BYTECODE: load = MAIN,    type = rw,                  define = yes;
    CODE:     load = MAIN,    type = rw,                  define = yes;
    ALIGNDATA:load = MAIN,    type = ro,  optional = yes, define = yes, align = $100;
    DATA:     load = MAIN,    type = rw   optional = yes, define = yes;
    BSS:      load = MAIN,    type = bss, optional = yes, define = yes;
    INTERP:   load = INTERP,  type = rw;
}
