# Linker config file for targeting the Atari 2600.
# From http://wiki.cc65.org/doku.php?id=cc65:atari_2600
# Modified for TigerVision (3E) mapper

MEMORY {
       RAM:   start = $80,   size=$70, type = rw, define = yes;
       TIA:   start = $00,   size=$40, type = rw, define = yes;
       RIOT:  start = $280,  size=$20, type = rw, define = yes;
       ROM0:  start = $1000, size=$800, type=ro, file=%O, define=yes, fill=yes, bank=0;
       ROM1:  start = $3000, size=$800, type=ro, file=%O, define=yes, fill=yes, bank=1;
       ROM2:  start = $5000, size=$800, type=ro, file=%O, define=yes, fill=yes, bank=2;
       ROM3:  start = $7000, size=$800, type=ro, file=%O, define=yes, fill=yes, bank=3;
       ROM4:  start = $9000, size=$800, type=ro, file=%O, define=yes, fill=yes, bank=4;
       ROM5:  start = $b000, size=$800, type=ro, file=%O, define=yes, fill=yes, bank=5;
       ROM6:  start = $d000, size=$800, type=ro, file=%O, define=yes, fill=yes, bank=6;
       ROM7:  start = $f000, size=$800, type=ro, file=%O, define=yes, fill=yes, bank=7;
       RAM0:  start = $f000, size=$400, type=rw, define=yes;
       PERM:  start = $f800, size=$800, type=ro, file=%O, define=yes, fill=yes;
}

SEGMENTS {
       ROM0:     load=ROM0, type=ro, align=$100, optional=yes;
       ROM1:     load=ROM1, type=ro, align=$100, optional=yes;
       ROM2:     load=ROM2, type=ro, align=$100, optional=yes;
       ROM3:     load=ROM3, type=ro, align=$100, optional=yes;
       ROM4:     load=ROM4, type=ro, align=$100, optional=yes;
       ROM5:     load=ROM5, type=ro, align=$100, optional=yes;
       ROM6:     load=ROM6, type=ro, align=$100, optional=yes;
       ROM7:     load=ROM7, type=ro, align=$100, optional=yes;

       RODATA:   load=PERM, type=ro, align=$100;
       STARTUP:  load=PERM, type=ro, optional=yes;
       CODE:     load=PERM, type=ro, define=yes;
       DATA:     load=ROM0, run=RAM, type=rw, define=yes;
       BSS:      load=RAM, type=bss, define=yes;
       VECTORS:  load=PERM, type=ro, start=$FFFA;
       XDATA:    load=ROM0, run=RAM0, type=rw, define=yes, optional=yes;

       ZEROPAGE: load=RAM, type=zp;
       TIA:      load=TIA, type=rw, define = yes, optional = yes;
       RIOT:     load=RIOT, type=rw, define = yes, optional = yes;
}
