MEMORY {
    # iNES header
    HEADER: file = %O, start = $0000, size = $0010, fill = yes;

    # First 15 switchable banks at $8000.
    PRG0_00: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $00;
    PRG0_01: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $01;
    PRG0_02: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $02;
    PRG0_03: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $03;
    PRG0_04: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $04;
    PRG0_05: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $05;
    PRG0_06: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $06;
    PRG0_07: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $07;
    PRG0_08: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $08;
    PRG0_09: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $09;
    PRG0_0A: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $0A;
    PRG0_0B: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $0B;
    PRG0_0C: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $0C;
    PRG0_0D: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $0D;
    PRG0_0E: start = $8000, size =  $2000, file = %O, fill = yes, fillval = $0E;

    # Last 15 switchable banks at $A000.
    PRG1_00: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $10;
    PRG1_01: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $11;
    PRG1_02: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $12;
    PRG1_03: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $13;
    PRG1_04: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $14;
    PRG1_05: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $15;
    PRG1_06: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $16;
    PRG1_07: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $17;
    PRG1_08: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $18;
    PRG1_09: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $19;
    PRG1_0A: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $1A;
    PRG1_0B: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $1B;
    PRG1_0C: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $1C;
    PRG1_0D: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $1D;
    PRG1_0E: start = $A000, size =  $2000, file = %O, fill = yes, fillval = $1E;

    # Last two fixed banks + vectors.
    FIXED: start = $C000, size = $2000, fill = yes, fillval = $FA, define = yes;
    TAIL:  start = $E000, size = $1FFA, fill = yes, fillval = $FB, define = yes;
    ROMV:  start = $FFFA, size = $0006, fill = yes, fillval = $FC, define = yes;

    # CHR ROM. Groupped all together as we don't need as much flexibility
    # really, but `incbin` statements will suffice.
    CHARS: start = $0000, size = $20000, file = %O, fill = no;
}

SEGMENTS {
    HEADER: load = HEADER, type = ro;

    # 15 first switchable banks.
    PRG0_00: load = PRG0_00, type = ro;
    PRG0_01: load = PRG0_01, type = ro;
    PRG0_02: load = PRG0_02, type = ro;
    PRG0_03: load = PRG0_03, type = ro;
    PRG0_04: load = PRG0_04, type = ro;
    PRG0_05: load = PRG0_05, type = ro;
    PRG0_06: load = PRG0_06, type = ro;
    PRG0_07: load = PRG0_07, type = ro;
    PRG0_08: load = PRG0_08, type = ro;
    PRG0_09: load = PRG0_09, type = ro;
    PRG0_0A: load = PRG0_0A, type = ro;
    PRG0_0B: load = PRG0_0B, type = ro;
    PRG0_0C: load = PRG0_0C, type = ro;
    PRG0_0D: load = PRG0_0D, type = ro;
    PRG0_0E: load = PRG0_0E, type = ro;

    # 15 last switchable banks.
    PRG1_00: load = PRG1_00, type = ro;
    PRG1_01: load = PRG1_01, type = ro;
    PRG1_02: load = PRG1_02, type = ro;
    PRG1_03: load = PRG1_03, type = ro;
    PRG1_04: load = PRG1_04, type = ro;
    PRG1_05: load = PRG1_05, type = ro;
    PRG1_06: load = PRG1_06, type = ro;
    PRG1_07: load = PRG1_07, type = ro;
    PRG1_08: load = PRG1_08, type = ro;
    PRG1_09: load = PRG1_09, type = ro;
    PRG1_0A: load = PRG1_0A, type = ro;
    PRG1_0B: load = PRG1_0B, type = ro;
    PRG1_0C: load = PRG1_0C, type = ro;
    PRG1_0D: load = PRG1_0D, type = ro;
    PRG1_0E: load = PRG1_0E, type = ro;

    # Last two fixed banks + vectors.
    FIXED:   load = FIXED, type = ro;
    TAIL:    load = TAIL, type = ro;
    VECTORS: load = ROMV, type = ro;

    # CHR-ROM is groupped all together.
    CHARS: load = CHARS, type = ro;
}
