NESASM debug symbols in FCEUX?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
User avatar
Punch
Posts: 363
Joined: Sat Feb 16, 2013 11:52 am

NESASM debug symbols in FCEUX?

Post by Punch »

So, at each compiling the NESASM 3 generates a file with the extension .fns, with the ROM addresses to the program labels. It is formatted like this:

Code: Select all

; main.asm
ResolveMetaAddresses             = $E174
Level_Draw_Loop                  = $E115
MetaTiles_Objects                = $807B
DecodeLevelObj                   = $E124
(...)
How can I use it in FCEUX instead of having to type the addresses manually at the debugger? It is tedious.
This is a block of text that can be added to posts you make. There is a 255 character limit.
tepples
Posts: 22370
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: NESASM debug symbols in FCEUX?

Post by tepples »

What you need to do is translate that to a .nes.0.nl file. Do you know any PC scripting languages like Perl or Python?
User avatar
Punch
Posts: 363
Joined: Sat Feb 16, 2013 11:52 am

Re: NESASM debug symbols in FCEUX?

Post by Punch »

tepples wrote:What you need to do is translate that to a .nes.0.nl file. Do you know any PC scripting languages like Perl or Python?
Nope. Only C. It seems easy enough, but I wouldn't refuse a script that is already done :lol:

Thanks for the heads up.
This is a block of text that can be added to posts you make. There is a 255 character limit.
zzo38
Posts: 1082
Joined: Mon Feb 07, 2011 12:46 pm

Re: NESASM debug symbols in FCEUX?

Post by zzo38 »

It looks like it could be done easily enough in AWK or sed just as well (I could do, but do not want to do so at this time).

Of course, you could do it in C, too; you don't need to use AWK, sed, Perl, or Python, to do this.
[url=gopher://zzo38computer.org/].[/url]
User avatar
rainwarrior
Posts: 8173
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NESASM debug symbols in FCEUX?

Post by rainwarrior »

If it's helpful, I've attached a little python program I use to create FCEUX debug files for my ca65 programs. It should be easy to modify to work with NESASM label files.

Documentation if you need it: http://www.fceux.com/web/help/fceux.htm ... ormat.html


Edit: Python scripts were later disallowed on this forum. Uploading a ZIP with what I think was the original script.
Attachments
fceux_symbols.py.zip
(605 Bytes) Downloaded 239 times

[The extension py has been deactivated and can no longer be displayed.]

Last edited by rainwarrior on Tue Jun 12, 2018 12:46 pm, edited 2 times in total.
tepples
Posts: 22370
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: NESASM debug symbols in FCEUX?

Post by tepples »

In case it disappears from Dropbox, I've attached it.
Attachments
fceux_symbols.py.zip
(605 Bytes) Downloaded 299 times
retroOtoko
Posts: 2
Joined: Wed Aug 14, 2019 7:53 pm

Re: NESASM debug symbols in FCEUX?

Post by retroOtoko »

Hello friends,

I just found myself in a situation where I thought it would be nice to be able to import NESASM's FNS files into FCEUX, so I took rainwarrior's script and made the necessary adjustments. Please excuse my horrendous formatting and whatnot - just wanted to get it working, and this is also my first time with Python.

It runs as a simple Python script with 1 argument - the FNS file for input. If it finds that file it will then ask you to input the beginning and ending hex addresses of each consecutive bank, then allocate symbols per bank accordingly.

Also given the convention to define variables in RAM using .rs, it looks in that same directory for a file called "Variables.txt" to create the nl file for RAM. "Variables.txt" would just have a bunch of variables declared as such:
;Assumes this comes somewhere after .rsset $0000
var1 .rs 1
var2 .rs 1
var3 .rs 1
;etc etc etc

Cheers,

M
Attachments
fceux_symbols.py.zip
(2.23 KiB) Downloaded 204 times
User avatar
Zutano
Posts: 38
Joined: Tue Apr 04, 2017 1:22 pm
Location: Ohio, USA
Contact:

Re: NESASM debug symbols in FCEUX?

Post by Zutano »

Late to the party here, but this is the script I use to convert my projects (before I started using asm6f). Not sure if it works with multiple banks, I've only ever used it for NROM projects.

Code: Select all

#!/usr/bin/env python3

import sys, re

with open(sys.argv[1], 'r') as fnsfile:
	for line in fnsfile:
		if ';' not in line:
			parts = re.split(r'\s*=\s*', line.strip())
			print('%s#%s#' % (parts[1], parts[0]))
Just paste it in a file like "fns2nl.py" and run it from your favorite command shell like "python3 fns2nl.py inputfile.fns > outputfile.0.nl"
http://zutanogames.com/ <-- my dev blog
Post Reply