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: 362
Joined: Sat Feb 16, 2013 11:52 am

NESASM debug symbols in FCEUX?

Post by Punch » Sun Mar 23, 2014 7:58 pm

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: 21947
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: NESASM debug symbols in FCEUX?

Post by tepples » Sun Mar 23, 2014 8:06 pm

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: 362
Joined: Sat Feb 16, 2013 11:52 am

Re: NESASM debug symbols in FCEUX?

Post by Punch » Sun Mar 23, 2014 8:14 pm

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: 1063
Joined: Mon Feb 07, 2011 12:46 pm

Re: NESASM debug symbols in FCEUX?

Post by zzo38 » Mon Mar 24, 2014 1:24 am

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: 7804
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NESASM debug symbols in FCEUX?

Post by rainwarrior » Mon Mar 24, 2014 5:54 am

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 149 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: 21947
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: NESASM debug symbols in FCEUX?

Post by tepples » Mon Mar 24, 2014 6:07 am

In case it disappears from Dropbox, I've attached it.
Attachments
fceux_symbols.py.zip
(605 Bytes) Downloaded 217 times

retroOtoko
Posts: 2
Joined: Wed Aug 14, 2019 7:53 pm

Re: NESASM debug symbols in FCEUX?

Post by retroOtoko » Thu Aug 15, 2019 7:44 am

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 125 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 » Fri Aug 16, 2019 7:32 am

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