Turns out, I really do need the whole 32KB PRG space to be banked out...
This is what I am using so far, and it produces a legal cart that boots up in Nestopia (fceux doesn't like it yet):
Code:
MEMORY {
ZP: start = $0000, size = $0100, type = rw, define = yes;
HEADER: start = $0000, size = $0010, file = %O ,fill = yes;
PRG: start = $8000, size = $7fc0, file = %O ,fill = yes, define = yes;
PRG01: start = $8000, size = $8000, file = %O ,fill = yes, fillval = $FF;
PRG02: start = $8000, size = $8000, file = %O ,fill = yes, fillval = $FF;
PRG03: start = $8000, size = $8000, file = %O ,fill = yes, fillval = $FF;
PRG04: start = $8000, size = $8000, file = %O ,fill = yes, fillval = $FF;
PRG05: start = $8000, size = $8000, file = %O ,fill = yes, fillval = $FF;
DMC: start = $ffc0, size = $003a, file = %O, fill = yes, define = yes;
VECTORS: start = $fffa, size = $0006, file = %O, fill = yes;
CHR00: start = $0000, size = $2000, file = %O, fill = yes;
CHR01: start = $0000, size = $2000, file = %O, fill = yes;
CHR02: start = $0000, size = $2000, file = %O, fill = yes;
CHR03: start = $0000, size = $2000, file = %O, fill = yes;
CHR04: start = $0000, size = $2000, file = %O, fill = yes;
CHR05: start = $0000, size = $2000, file = %O, fill = yes;
RAM: start = $0300, size = $0500, define = yes;
# Use this definition instead if you going to use extra 8K RAM
# RAM: start = $6000, size = $2000, define = yes;
}
SEGMENTS {
HEADER: load = HEADER, type = ro;
STARTUP: load = PRG, type = ro, define = yes;
LOWCODE: load = PRG, type = ro, optional = yes;
INIT: load = PRG, type = ro, define = yes, optional = yes;
CODE: load = PRG, type = ro, define = yes;
RODATA: load = PRG, type = ro, define = yes;
# STUB00: load = PRG, type = ro, start = $BFF0;
# STUB01: load = PRG01, type = ro, start = $BFF0;
# STUB02: load = PRG02, type = ro, start = $BFF0;
# STUB03: load = PRG03, type = ro, start = $BFF0;
# STUB04: load = PRG04, type = ro, start = $BFF0;
# STUB05: load = PRG05, type = ro, start = $BFF0;
ONCE: load = PRG, type = ro, optional = yes;
DATA: load = PRG, run = RAM, type = rw, define = yes;
VECTORS: load = VECTORS, type = ro;
SAMPLES: load = DMC, type = ro;
PRG1: load = PRG01, type = ro, align=$100;
PRG2: load = PRG02, type = ro, align=$100;
PRG3: load = PRG03, type = ro, align=$100;
PRG4: load = PRG04, type = ro, align=$100;
PRG5: load = PRG05, type = ro, align=$100;
CHR0: load = CHR00, type = ro, align=$100;
CHR1: load = CHR01, type = ro, align=$100;
CHR2: load = CHR02, type = ro, align=$100;
CHR3: load = CHR03, type = ro, align=$100;
CHR4: load = CHR04, type = ro, align=$100;
CHR5: load = CHR05, type = ro, align=$100;
BSS: load = RAM, type = bss, define = yes;
HEAP: load = RAM, type = bss, optional = yes;
ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: segment = INIT,
type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__;
CONDES: segment = RODATA,
type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__;
CONDES: type = interruptor,
segment = RODATA,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__;
}
SYMBOLS {
__STACKSIZE__: type = weak, value = $0500; # 5 pages stack
NES_MAPPER: type = weak, value = 1; # mapper number
NES_PRG_BANKS: type = weak, value = 12; # number of 16K PRG banks, change to 2 for NROM256
NES_CHR_BANKS: type = weak, value = 6; # number of 8K CHR banks
NES_MIRRORING: type = weak, value = 1; # 0 horizontal, 1 vertical, 8 four screen
}
and including the chr and prg banks via an .incbin declaration for each.
and I can switch CHR banks, this is good.
now if I can switch PRG banks, and jump back to the RESET vector, without falling off a cliff.. that'd be perfect..
I tried injecting the stub bits from snrom-template, but am wondering if I need to basically cut off the last 16 bytes of the ROM binary I am injecting, to do this? (my rom prg's are exactly 32768 bytes, and chr rom's are 8192 bytes, and contain reset vectors at the end of the 32k PRG..dunno how I am going to shove that into the end of a 16K bank...sigh)
-Thom