# kim1.cfg   (4k)
#
# for unexpanded KIM-1
#
# ld65 --config kim1.cfg -o <prog>.bin <prog>.o

FEATURES {
    STARTADDRESS: default = $0200;
    CONDES: segment = STARTUP,
            type    = constructor,
            label   = __CONSTRUCTOR_TABLE__,
            count   = __CONSTRUCTOR_COUNT__;
    CONDES: segment = STARTUP,
            type    = destructor,
            label   = __DESTRUCTOR_TABLE__,
            count   = __DESTRUCTOR_COUNT__;
}

SYMBOLS {
    __STACKSIZE__:    type = weak, value = $0080;   # 128 byte program stack
    __STARTADDRESS__: type = export, value = %S;
}

MEMORY {
    ZP:       file = %O, define = yes, start = $0000, size = $00EE;
    CPUSTACK: file = "", define = yes, start = $0100, size = $0100;
    RAM:      file = %O, define = yes, start = %S, size = $1000 - %S - __STACKSIZE__;
    MAINROM:  file = "", define = yes, start = $E000, size = $1000;
    TOP:      file = "", define = yes, start = $F000, size = $1000;
}

SEGMENTS {
    ZEROPAGE: load = ZP,  type = zp,  define = yes;
    STARTUP:  load = RAM, type = ro,  define = yes;
    CODE:     load = RAM, type = ro,  define = yes;
    RODATA:   load = RAM, type = ro,  define = yes;
    ONCE:     load = RAM, type = ro,  define = yes;
    DATA:     load = RAM, type = rw,  define = yes;
    BSS:      load = RAM, type = bss, define = yes;
}