tepples wrote:Yeah, and it needs a somewhat beefier PC than the one I use daily. I need to remind myself to make a -Ln to .nl converter and include it in the templates for people stuck on machines that can't quite handle NESICIDE.
Here's a simple one for python:
Code: Select all
def lab_to_nl(label_file, nl_file, range_min, range_max):
labels = open(label_file, "r").readlines()
sout = ""
for line in labels:
words = line.split()
if (words[0] == "al"):
adr = int(words[1], 16)
sym = words[2]
if (adr >= range_min and adr <= range_max):
sout += ("$%04X#%s#\n" % (adr, sym))
open(nl_file, "w").write(sout)
Usage is something like this for a simple NROM project:
Code: Select all
lab_to_nl("labels.txt", "mything.nes.ram.nl", 0x0000, 0x07FF)
lab_to_nl("labels.txt", "mything.nes.0.nl", 0x8000, 0xBFFF)
lab_to_nl("labels.txt", "mything.nes.1.nl", 0xC000, 0xFFFF)
Note the number before .nl in the filename denotes the 16k iNES bank number (hexadecimal).
For bankswitching it gets more complicated; you need to link each bank separately so the label file doesn't end up containing overlapping symbols. If you're using a mapper with 8k bank switching, overlap may be unavoidable if you happen to use two 8k banks from the same 16k iNES bank at the same memory address.
Remember to add the
-g flag to your
ca65 step, and
-Ln labels.txt to your
ld65.