It is currently Tue Oct 17, 2017 8:18 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Loading CA65's DBG files
PostPosted: Thu Nov 24, 2016 10:22 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 285
I'm finishing up implementing symbols/labels + comments in Mesen's debugger and am currently working on importing labels/comments from the DBG files generated by CC65/CA65.

This is what it looks like at the moment:
Image

I'm currently testing with the example project posted by rainwarrior here (thanks for that, been incredibly helpful so far!). The screenshot above is the result of importing that project's DBG file into Mesen.

However, if at all possible I'd like to test the import's code with other projects (e.g: projects coded in C or ASM, more complex ones that use bank switching, or extra work ram, etc.).
Does anyone have any NES+DBG+Source packages that they'd be willing to share with me, or know where I could find them?
I guess what I'm looking for would be CA65/CC65 open source projects I can easily compile into a NES+DBG. Though it'd be nice to get the DBG/NES files prebuilt as I have little idea what I'm doing when it comes to compiling CC65/CA65 projects. :)

Thanks!


Top
 Profile  
 
PostPosted: Fri Nov 25, 2016 4:16 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 553
Russian Roulette is open source and C:
http://www.romhacking.net/homebrew/88

Lots of CHR bank switching, and it uses save RAM.


Top
 Profile  
 
PostPosted: Fri Nov 25, 2016 6:30 am 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19086
Location: NE Indiana, USA (NTSC)
Sour wrote:
I guess what I'm looking for would be CA65/CC65 open source projects I can easily compile into a NES+DBG. Though it'd be nice to get the DBG/NES files prebuilt as I have little idea what I'm doing when it comes to compiling CC65/CA65 projects. :)

My NES projects on GitHub and my cousin's are open source, but they don't have DBG files. (Yet.)

I'm not a regular user of Mesen because of its stated dependency on Windows and my lack of time to see if I can get it up in Mono. So I was planning to look at what else DBG files can do, and I thought first I'd need to know how to parse them. I looked for format documentation but instead noticed the warning in the description of the --dbgfile option:
Quote:
Please note that debug information generation is currently being developed, so the format of the file and its contents are subject to change without further notice.

So is the only documentation "read dbgfile.c and dbgsyms.c, and read them again every time you update ld65 using Git"?


Top
 Profile  
 
PostPosted: Fri Nov 25, 2016 6:35 am 
Online
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2961
Location: Tampere, Finland
tepples wrote:
So I was planning to look at what DBG files can do, and I thought first I'd need to know how to parse them. I looked for format documentation but instead noticed the warning in the description of the --dbgfile option:
Quote:
Please note that debug information generation is currently being developed, so the format of the file and its contents are subject to change without further notice.

So is the only documentation "read dbgfile.c and dbgsyms.c, and read them again every time you update ld65 using Git"?

You can parse the debug files with the dbginfo library provided with cc65: https://github.com/cc65/cc65/tree/master/src/dbginfo

The format itself hasn't changed for many years now, but it's somewhat complicated so it's a good idea to use the library.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Fri Nov 25, 2016 7:33 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 285
Thanks for the help!

After a fair bit of trial and error, I managed to compile thwaite, nova the squirrel and russian roulette and generate working DBG files for them.

It helped me fix some bugs, and the feature is working relatively well for now. (Although it doesn't support work/save ram yet)
Some limitations remain because the labels in Mesen aren't "scoped", so memory addresses that are shared as temporary variables in the code can't be assigned a different label based on where they are used, etc.

For C projects, I set it to display the C code as a comment, it's not perfect, but it's mostly readable.
Image

The import is a GUI-side feature in C#, so I didn't use CC65's code. I was lazy and just solved all of the parsing with regexes - it's certainly not the fastest way to parse it, but the code is a lot easier to understand (in my opinion)

@tepples
Mesen doesn't run under Mono (nor WINE) at the moment (both due to my use of DirectX11)
I had a SDL build that worked under Mono & Ubuntu about half a year ago, but never finished it.
I could probably redo the work in a day or two, so I will most likely get that done in the near-ish future.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group