new bsnes-plus debugging features

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Benny
Posts: 4
Joined: Thu Oct 05, 2017 2:15 pm

new bsnes-plus debugging features

Post by Benny » Wed Oct 25, 2017 11:12 pm

Hi everyone,

a few days ago I finished some debugging feature plans I had for bsnes-plus in order to debug some games I work on.

As it would be nice to maybe create a pull request to maybe merge it into the original bsnes-plus version I'd like to have some people to test the new feature.

You can download and compile it from this page:
https://github.com/BenjaminSchulte/bsnes-plus

Image

New features of the debugger are:
  • The disassembler and debugger are now merged into one window.
  • The disassembler has some simple syntax highlighting
  • The disassembler supports WLA symbol files (located as .sym file in the same directory as the ROM)
  • The disassembler displays the address names instead of the addresses, if known
  • You can follow JMP and BRA addresses by clicking on them
  • You can toggle breakpoints by clicking on the address
  • You can name addresses by right clicking on the line
  • There is an index of all names (=Symbol) which can be filtered
  • You can add comments to disassembled lines
  • There is a feature to break on BRK opcodes
  • You can pass --break-immediately to the disassembler to debug from the very beginning
  • A new debug port which allows you the log static messages directly from your ROM
  • The disassembler tries to figure out the upfollowing code, even if its the first time you disassemble it
  • Displays some simple loops
  • If activated, all names and comments will be stored in a .sym file when closing the emulator for next time
However, as I only work with a few original ROMs, I didn't really test the new emulator very well, so I'd like you to test the new features and let me know:
  • Does this actually work on Mac and Windows? (I only work using Linux)
  • Did I accidentally remove an important feature?
  • Is there a must-have-feature you really, really would miss here?
  • I only tested the main CPU, the other processors should still work but have very limited features. Does this still work?
  • Are there some new bugs I missed? (If so, please let me know which game and how to reproduce)
Have a great day!

User avatar
dougeff
Posts: 2711
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: new bsnes-plus debugging features

Post by dougeff » Thu Oct 26, 2017 4:42 am

Looks great

It would be easier to test if there were a windows binary exe. I personally don't have QT installed, for one thing. So, I don't really want to try to make my own.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
HihiDanni
Posts: 186
Joined: Tue Apr 05, 2016 5:25 pm

Re: new bsnes-plus debugging features

Post by HihiDanni » Thu Oct 26, 2017 5:10 am

This looks quite comprehensive! The ability to load symbols from a file is something I'd find very useful, but I use CA65 as my assembler instead of WLA, so the symbol files probably won't be compatible.
SNES NTSC 2/1/3 1CHIP | serial number UN318588627

Revenant
Posts: 442
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: new bsnes-plus debugging features

Post by Revenant » Thu Oct 26, 2017 7:46 am

I've been following your work on this since I saw it pop up on GitHub, very nice work!

I haven't personally tried using it yet, but revamping the disassembler/tracer has been high on my to-do list for a long time. I think after the next upcoming (hopefully soon) release of bsnes-plus I'd love to consider integrating this into a future release as well.
HihiDanni wrote:This looks quite comprehensive! The ability to load symbols from a file is something I'd find very useful, but I use CA65 as my assembler instead of WLA, so the symbol files probably won't be compatible.
ca65 symbol file support was a to-do item for me as well, since it's what I've been using for my recent SNES work as well. I don't think it should be too difficult to support both.

User avatar
nicklausw
Posts: 376
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: new bsnes-plus debugging features

Post by nicklausw » Thu Oct 26, 2017 7:37 pm

HihiDanni wrote:This looks quite comprehensive! The ability to load symbols from a file is something I'd find very useful, but I use CA65 as my assembler instead of WLA, so the symbol files probably won't be compatible.
Depending on the structure of ca65's symbol files, you could do what I did and have a lua script convert to WLA format for you.

adam_smasher
Posts: 271
Joined: Sun Mar 27, 2011 10:49 am
Location: Seattle

Re: new bsnes-plus debugging features

Post by adam_smasher » Fri Oct 27, 2017 8:37 am

This looks amazing!

Reaper_Man
Posts: 45
Joined: Sat Jun 17, 2006 2:31 pm
Location: Austin, TX

Re: new bsnes-plus debugging features

Post by Reaper_Man » Wed Nov 01, 2017 1:55 am

I would try it, but I got an exception error when I tried to run mingw trying to get it to compile on win10 x64. Unfortunately it doesn't really give me much else to work with, and I should go to bed. :/

Revenant
Posts: 442
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: new bsnes-plus debugging features

Post by Revenant » Fri Nov 03, 2017 8:33 pm

http://revenant1.net/bsnes-plus-benny-win64.zip

Note: building out of the box fails on Windows because "ERROR" is already defined in wingdi.h, which conflicts with the DebugPrintCommand::Level enum. I suggest using mixed-case names for enum values instead.

Either way, this looks really great so far! I haven't tested it extensively to make sure everything behaves as it should but I'm excited about this nonetheless.

tepples
Posts: 22017
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: new bsnes-plus debugging features

Post by tepples » Fri Nov 03, 2017 8:51 pm

If wingdi.h is Windows Graphics Device Interface, then what's the header for Windows Graphics Device Interface Next Generation Subsystem?

Benny
Posts: 4
Joined: Thu Oct 05, 2017 2:15 pm

Re: new bsnes-plus debugging features

Post by Benny » Wed Nov 08, 2017 1:05 am

Thank you for the feedback (and for compiling it on Windows). :)

I was quite a little busy with my main job and other current SNES project so I didn't check here for a while. I think I'll try to fix the windows version by the end of the next week and also check out the CA65 assembler in order to also support their symbol files later.

Reaper_Man
Posts: 45
Joined: Sat Jun 17, 2006 2:31 pm
Location: Austin, TX

Re: new bsnes-plus debugging features

Post by Reaper_Man » Mon Nov 13, 2017 12:30 pm

Got to try it, and the layout is great, I just wish there was a simple dump feature so I can save say a subroutine to a file.

nitro2k01
Posts: 228
Joined: Sat Aug 28, 2010 9:01 am

Re: new bsnes-plus debugging features

Post by nitro2k01 » Tue Nov 14, 2017 2:09 am

tepples wrote:If wingdi.h is Windows Graphics Device Interface, then what's the header for Windows Graphics Device Interface Next Generation Subsystem?
Image

Benny
Posts: 4
Joined: Thu Oct 05, 2017 2:15 pm

Re: new bsnes-plus debugging features

Post by Benny » Tue Nov 14, 2017 6:44 am

Today I implemented a basic support for symbol files generated by the ca65 -Ln parameter.

Because no symbol file currently supports comments (Well, surely because it's actually no "symbol") the .sym file will be replaced by a different file format if bsnes is closed (if not deactivated in the debuggers options). Maybe someday this could go into a separate file or so.

I also added "exporting a dump" to my personal ToDo list, but I don't have that much time currently, due to two other big projects :)

Benny
Posts: 4
Joined: Thu Oct 05, 2017 2:15 pm

Re: new bsnes-plus debugging features

Post by Benny » Wed Nov 15, 2017 10:53 am

Today I implemented a simple measurement tool. I did not test it very well and already know a lot of stuff which need to be implemented, until you can really use this in your daily life.

Image

Currently you can measure values from memory or from VCounter and do calculations between each measurement.

What's still missing:
- There are no labels/numbers on the preview graph, so you don't really know what value it is.
- The configuration is not saved, so you will always have to reconfigure everything
- Graphs can not be compared
- It's not tested very well
- Did not test it on windows
- Should be configurable/triggerable using the debug-port $420E, which currently only allowed to print debug messages.
- Would be great to have breakpoints configurable if some calculations exceeded some limits
- There is no documentation :D

psycopathicteen
Posts: 2937
Joined: Wed May 19, 2010 6:12 pm

Re: new bsnes-plus debugging features

Post by psycopathicteen » Wed Nov 15, 2017 6:29 pm

Does this work with SA-1 games? I want to see if I can hack KSS and SMRPG to work without a SA-1 chip.

Post Reply