Mesen - Debugger Feedback?
Moderator: Moderators
Re: Mesen - Debugger Feedback?
Thanks again for all the feedback/bug reports!
Link to latest build: download
Picture with most of the new changes visible: screenshot
I did the following fixes/changes since the last build:
-Added "break on reset/power" & "break when debugger is opened" options
-Added a "Disable Default Labels" option in File->Workspace
-Added options for 8x8 and 16x16 grids in NT viewer (both can be shown at once, or independently)
-Added "Sprite index" to sprite viewer, prevented users from changing the checkbox states, and fixed the draw order for the preview
-Added an option to display op codes in lower case
-Added validations on BP conditions - it will now display a warning icon when the syntax is incorrect, and prevent the user from adding the breakpoint.
-Added a "Toggle breakpoint" option in the right-click menu for the code window
-Added a "Address Range" option for breakpoints
-Changed the display options for PRG addresses & byte code in the code window. It is now possible to display the byte code on the left side of the code (in a slightly different colored margin)
-Added a "Goto" button/dropdown in the main window to give easy access to NMI/IRQ/Reset subs
-Fixed UI labels/layout and instruction names (CPA->CMP, and some discrepancies with unofficial opcodes)
-Fixed debugger window popping up over other windows when clicking on the main emulation window
-Fixed the incorrect breakpoints after 1-byte instructions - this was due to the dummy read these instructions perform on the next instruction's first byte.
Not done yet:
Profiler: Good idea, and should be easy to implement, I'll probably get this done in the next few days
Disassembling everything: Might take a bit of time to get done, but should be easy enough.
Shortcuts and the like: I'll give it some more thought before I change anything here.
@rainwarrior:
There is no "hard reset" button - typically I just do File->Recent Files->First in list to hard reset. I wanted to add one, but as stupid as it may sound, I had no clue how to translate the Soft/Hard reset distinction to French & Japanese, so I ended up not adding it.
@koitsu:
DBG files are the files generated by CC65 when compiling a project - they contain symbols and references to the original code, etc.
The NES registers turning into names is part of the default labels added to the workspace when you start debugging - you can remove them like any other label or customize them however you like, nothing is forced. (And I just added an option to not add these labels by default)
I mostly added them for myself since I do not know most of the registers by heart and it helps me figure out what code does faster.
Mesen's UI is built in C#/Winforms, so typically, displaying non-ascii stuff is typically not a problem (currently works fine when adding japanese characters to comments).
Reading text files in UTF8/Shift-JIS/etc is also usually pretty straightforward, the .NET framework does most of the heavy lifting.
I'll take a look at FCEUX's documentation and see what it supports when I get the chance.
@thefox
Thanks for testing!
That amount of errors is pretty impressive! If you had labels in the debugger, then my guess is that it was unable to load the source files.
This would probably be due to the path in the "name" tag for the "file" directives.
Currently the regex I'm using only allows the following characters in paths:
0-9, a-z, A-Z ( ) _ . - : / \
Any chance the paths you have in your DBG file (should be at the very top) contain something outside of these?
Link to latest build: download
Picture with most of the new changes visible: screenshot
I did the following fixes/changes since the last build:
-Added "break on reset/power" & "break when debugger is opened" options
-Added a "Disable Default Labels" option in File->Workspace
-Added options for 8x8 and 16x16 grids in NT viewer (both can be shown at once, or independently)
-Added "Sprite index" to sprite viewer, prevented users from changing the checkbox states, and fixed the draw order for the preview
-Added an option to display op codes in lower case
-Added validations on BP conditions - it will now display a warning icon when the syntax is incorrect, and prevent the user from adding the breakpoint.
-Added a "Toggle breakpoint" option in the right-click menu for the code window
-Added a "Address Range" option for breakpoints
-Changed the display options for PRG addresses & byte code in the code window. It is now possible to display the byte code on the left side of the code (in a slightly different colored margin)
-Added a "Goto" button/dropdown in the main window to give easy access to NMI/IRQ/Reset subs
-Fixed UI labels/layout and instruction names (CPA->CMP, and some discrepancies with unofficial opcodes)
-Fixed debugger window popping up over other windows when clicking on the main emulation window
-Fixed the incorrect breakpoints after 1-byte instructions - this was due to the dummy read these instructions perform on the next instruction's first byte.
Not done yet:
Profiler: Good idea, and should be easy to implement, I'll probably get this done in the next few days
Disassembling everything: Might take a bit of time to get done, but should be easy enough.
Shortcuts and the like: I'll give it some more thought before I change anything here.
@rainwarrior:
There is no "hard reset" button - typically I just do File->Recent Files->First in list to hard reset. I wanted to add one, but as stupid as it may sound, I had no clue how to translate the Soft/Hard reset distinction to French & Japanese, so I ended up not adding it.
@koitsu:
DBG files are the files generated by CC65 when compiling a project - they contain symbols and references to the original code, etc.
The NES registers turning into names is part of the default labels added to the workspace when you start debugging - you can remove them like any other label or customize them however you like, nothing is forced. (And I just added an option to not add these labels by default)
I mostly added them for myself since I do not know most of the registers by heart and it helps me figure out what code does faster.
Mesen's UI is built in C#/Winforms, so typically, displaying non-ascii stuff is typically not a problem (currently works fine when adding japanese characters to comments).
Reading text files in UTF8/Shift-JIS/etc is also usually pretty straightforward, the .NET framework does most of the heavy lifting.
I'll take a look at FCEUX's documentation and see what it supports when I get the chance.
@thefox
Thanks for testing!
That amount of errors is pretty impressive! If you had labels in the debugger, then my guess is that it was unable to load the source files.
This would probably be due to the path in the "name" tag for the "file" directives.
Currently the regex I'm using only allows the following characters in paths:
0-9, a-z, A-Z ( ) _ . - : / \
Any chance the paths you have in your DBG file (should be at the very top) contain something outside of these?
Re: Mesen - Debugger Feedback?
Do these languages have a convenient word for a "power cycle"?Sour wrote:as stupid as it may sound, I had no clue how to translate the Soft/Hard reset distinction to French & Japanese, so I ended up not adding it.
Space (U+0020), for one, because space in the username, username in the user's profile path, and no write privileges outside the user's profile without elevating. Or a Windows 7 installation that was upgraded from Windows XP, where all profiles were inside "Documents and Settings" instead of the "Users" used for new installations.This would probably be due to the path in the "name" tag for the "file" directives.
Currently the regex I'm using only allows the following characters in paths:
0-9, a-z, A-Z ( ) _ . - : / \
Any chance the paths you have in your DBG file (should be at the very top) contain something outside of these?
Re: Mesen - Debugger Feedback?
I've seen these referred to as "warm boot" (soft reset) and "cold boot" (hard reset/power cycle); not sure how well those will translate to French and Japanese, however.Sour wrote:I wanted to add one, but as stupid as it may sound, I had no clue how to translate the Soft/Hard reset distinction to French & Japanese, so I ended up not adding it.
(If I get some free time soon, I'll check the debugger out; I do appreciate the work you've put into it, so thanks for doing so.)
- rainwarrior
- Posts: 8734
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Mesen - Debugger Feedback?
Wow, that was a quick turnaround on changes!
I don't know what to translate them into, but for the NES I consider POWER and RESET to be standard input buttons (alongside A, B, START, SELECT) so whether or not you want to provide a translated description, I think showing those two words is appropriate.
The NES had two buttons labelled "POWER" and "RESET" which perform the two functions I was talking about. The Japanese Famicom also used these same terms in English to label them, and I believe the various European NES systems still used the English terms on these buttons as well?Sour wrote:There is no "hard reset" button - typically I just do File->Recent Files->First in list to hard reset. I wanted to add one, but as stupid as it may sound, I had no clue how to translate the Soft/Hard reset distinction to French & Japanese, so I ended up not adding it.
I don't know what to translate them into, but for the NES I consider POWER and RESET to be standard input buttons (alongside A, B, START, SELECT) so whether or not you want to provide a translated description, I think showing those two words is appropriate.
- FrankenGraphics
- Formerly WheelInventor
- Posts: 2064
- Joined: Thu Apr 14, 2016 2:55 am
- Location: Gothenburg, Sweden
- Contact:
Re: Mesen - Debugger Feedback?
Unfortunately, my laptop has a max resolution of 1366x768, which makes the GUI look like this.
I'm also pretty sure that 'power' and 'reset' are safe labels, at least in here in Europe.
One thing that can be frustrating is when Microsoft (for example) think they have to invent new words in swedish (and probably any other language) for just about everything, so you can't find what you're looking after, any time you're using a localized installation, at least not without having to play a game of deduction, term for term. I strongly recommend against localizing expressions and labels.
I'm also pretty sure that 'power' and 'reset' are safe labels, at least in here in Europe.
One thing that can be frustrating is when Microsoft (for example) think they have to invent new words in swedish (and probably any other language) for just about everything, so you can't find what you're looking after, any time you're using a localized installation, at least not without having to play a game of deduction, term for term. I strongly recommend against localizing expressions and labels.
Re: Mesen - Debugger Feedback?
That's the nice part of the UI being in C#/Winforms - it is far easier and faster to add/modify these sorts of things compared to just about any other way of building Windows applications.rainwarrior wrote:Wow, that was a quick turnaround on changes!
I guess I'll just add a "Power" option in the menu and have that work as a hard reset.
@tepples I actually have spaces in the regex too, but that got lost in translation when I pasted the regex into my message and reformatted it!
@freem No problem, let me know what you think if you do try it out!
@WheelInventor
You should be able to get a reasonable setup if you:
-Hide the label/function lists (from the Options menu)
-Hide the cpu/ppu memory mapping (also in the Options menu)
-Reduce the font size (Ctrl+Minus) of the code window
Not ideal, but unfortunately there is only so much information that can be shown in 1366x768 before you fill up the screen :(
- FrankenGraphics
- Formerly WheelInventor
- Posts: 2064
- Joined: Thu Apr 14, 2016 2:55 am
- Location: Gothenburg, Sweden
- Contact:
Re: Mesen - Debugger Feedback?
Sour, thanks for taking the time to point to these things.
I was wondering if there could be collapse buttons/boxes on the cell lines (collapse one cell to expand the other cells in that column or row), but that's really just a nice thing, if even possible.
I was wondering if there could be collapse buttons/boxes on the cell lines (collapse one cell to expand the other cells in that column or row), but that's really just a nice thing, if even possible.
Re: Mesen - Debugger Feedback?
I had a HUGE THOROUGH POST written up to cover several things, links and all, and OH HEY YEAH WHOOPS YOU CLICKED THE [X] IN THE TAB, ENJOY. So now I'm SUPER pissed off. I am quickly reminded why I loathe tabs so much. So yup, now everyone gets Angry Koitsu Post.
You need to offer two modes: "Power Cycle" (alternates include "Power On/Off" or "Power Toggle" (latter sounds corny)), and "Reset" (alternates include "Soft Reset"; don't bother with "Hard Reset": AFAIK, in NestopiaUE, what that actually means is "Power Cycle" -- it just saves the person having to manually pick Power off, then Power on). You may want to offer separate "Power On" and "Power Off" options (and grey out the one which isn't relevant to the current system state), but it's your choice.
Power Cycle = equivalent to physically pressing NES/Famicom POWER button/switch, letting the system sit for about 5 seconds, then powering it back on. This affects ZP/RAM contents, PPU state, and CPU state. Pre-initialised ZP/RAM contents I will cover at the end of this post. PPU state is documented here: http://wiki.nesdev.com/w/index.php/PPU_power_up_state while CPU state is documented here: http://wiki.nesdev.com/w/index.php/CPU_power_up_state -- then JMP to RESET vector, etc..
Reset = equivalent to pressing NES/Famicom RESET button. ZP/RAM contents are untouched, but PPU and CPU state will be (but it varies -- keep reading). JMP to RESET vector, etc. -- you know.
Regarding both PPU and CPU states on power on and reset: READ THE PAGES THOROUGHLY! ALL THE BULLET POINTS! Otherwise you will miss quirks such as: "The Reset button on the Control Deck resets the PPU only on the front-loading NES (NES-001). On top-loaders (Famicom, NES-101), the Reset button resets only the CPU."
Now for the ZP/RAM situation... actually, I don't need to talk about it, because we've already had it! The option to select which pre-init model is super useful. I would also recommend you add a "User-defined value" pulldown option and let the person enter a value in hex (this is helpful for debugging and general use). But references for all of that because certainly someone will come across this again somewhere on the Internet:
https://forums.nesdev.com/viewtopic.php ... 99#p177999 -- read from this post onward (READ, NOT SKIM :-) )
That's all! Okay, now I feel less pissed off. :-)
You need to offer two modes: "Power Cycle" (alternates include "Power On/Off" or "Power Toggle" (latter sounds corny)), and "Reset" (alternates include "Soft Reset"; don't bother with "Hard Reset": AFAIK, in NestopiaUE, what that actually means is "Power Cycle" -- it just saves the person having to manually pick Power off, then Power on). You may want to offer separate "Power On" and "Power Off" options (and grey out the one which isn't relevant to the current system state), but it's your choice.
Power Cycle = equivalent to physically pressing NES/Famicom POWER button/switch, letting the system sit for about 5 seconds, then powering it back on. This affects ZP/RAM contents, PPU state, and CPU state. Pre-initialised ZP/RAM contents I will cover at the end of this post. PPU state is documented here: http://wiki.nesdev.com/w/index.php/PPU_power_up_state while CPU state is documented here: http://wiki.nesdev.com/w/index.php/CPU_power_up_state -- then JMP to RESET vector, etc..
Reset = equivalent to pressing NES/Famicom RESET button. ZP/RAM contents are untouched, but PPU and CPU state will be (but it varies -- keep reading). JMP to RESET vector, etc. -- you know.
Regarding both PPU and CPU states on power on and reset: READ THE PAGES THOROUGHLY! ALL THE BULLET POINTS! Otherwise you will miss quirks such as: "The Reset button on the Control Deck resets the PPU only on the front-loading NES (NES-001). On top-loaders (Famicom, NES-101), the Reset button resets only the CPU."
Now for the ZP/RAM situation... actually, I don't need to talk about it, because we've already had it! The option to select which pre-init model is super useful. I would also recommend you add a "User-defined value" pulldown option and let the person enter a value in hex (this is helpful for debugging and general use). But references for all of that because certainly someone will come across this again somewhere on the Internet:
https://forums.nesdev.com/viewtopic.php ... 99#p177999 -- read from this post onward (READ, NOT SKIM :-) )
That's all! Okay, now I feel less pissed off. :-)
Re: Mesen - Debugger Feedback?
Sometimes Ctrl+Shift+T recovers up to the last click of Preview. But now you understand one reason why I often compose long posts in a text editor. (The other is that I'm often offline on my laptop while writing, and then I post it once I get to a WLAN.)koitsu wrote:I had a HUGE THOROUGH POST written up to cover several things, links and all, and OH HEY YEAH WHOOPS YOU CLICKED THE [X] IN THE TAB, ENJOY.
And you can make the power cycle visually distinct by incorporating the same effect you'd get when power cycling an NES connected through RF: about 10 frames of monochrome snow and loud white noise, then about a second of slow panning across a random panel from Pepper&Carrot (simulating the cartoon that was showing on channel 3), then the game comes back with RAM cleared. List this as a bullet point: "We even emulate the RF switch!"Power Cycle = equivalent to physically pressing NES/Famicom POWER button/switch, letting the system sit for about 5 seconds, then powering it back on. This affects ZP/RAM contents, PPU state, and CPU state.
Re: Mesen - Debugger Feedback?
I updated the download link with a new build: download
Screenshot of changes: screenshot
-Added option to disassemble everything as code (and also an option to disassemble everything EXCEPT data). Disassembled code that is not verified as code (based on the CDL file) is shown with a light red background.
-Replaced the "Apply changes" button with an "Undo" button - Changes made to the state are applied automatically when the execution is resumed.
-Replaced the "Stop" button with "Power Cycle" instead, which does what it says!
-The bottom panel (watch/breakpoints/call stack) and the right panel (function/label lists) are now both resizable and collapsible panels. Double-clicking on the splitter will collapse the panel and uncheck the corresponding option from the Options menu. (this means the bottom panel can now be hidden)
@rainwarrior
Haven't had the chance to work on a profiler yet, but will probably get that done next.
Are the options to disassemble everything/everything except data what you would except them to do? Is the background color annoying or do you think it's fine that way?
@WheelInventor
I'm not 100% sure what I implemented is what you meant, but hopefully the collapsible panels help with your screen resolution.
@koitsu
I took a look, and there are some things that aren't implemented in Mesen (e.g PPU ignoring register writes at the start)
No major discrepancies though, most of the behavior is correct (assuming a front-loading NES) - I'll try to validate and fix the remaining stuff when I get the chance.
Screenshot of changes: screenshot
-Added option to disassemble everything as code (and also an option to disassemble everything EXCEPT data). Disassembled code that is not verified as code (based on the CDL file) is shown with a light red background.
-Replaced the "Apply changes" button with an "Undo" button - Changes made to the state are applied automatically when the execution is resumed.
-Replaced the "Stop" button with "Power Cycle" instead, which does what it says!
-The bottom panel (watch/breakpoints/call stack) and the right panel (function/label lists) are now both resizable and collapsible panels. Double-clicking on the splitter will collapse the panel and uncheck the corresponding option from the Options menu. (this means the bottom panel can now be hidden)
@rainwarrior
Haven't had the chance to work on a profiler yet, but will probably get that done next.
Are the options to disassemble everything/everything except data what you would except them to do? Is the background color annoying or do you think it's fine that way?
@WheelInventor
I'm not 100% sure what I implemented is what you meant, but hopefully the collapsible panels help with your screen resolution.
@koitsu
I took a look, and there are some things that aren't implemented in Mesen (e.g PPU ignoring register writes at the start)
No major discrepancies though, most of the behavior is correct (assuming a front-loading NES) - I'll try to validate and fix the remaining stuff when I get the chance.
- FrankenGraphics
- Formerly WheelInventor
- Posts: 2064
- Joined: Thu Apr 14, 2016 2:55 am
- Location: Gothenburg, Sweden
- Contact:
Re: Mesen - Debugger Feedback?
Not exactly, but not to worry: those handles work perfectly for me and my low-res situation. Thanks!I'm not 100% sure what I implemented is what you meant, but hopefully the collapsible panels help with your screen resolution.
Here's another suggestion:
Make an item for the new undo function in the dropdown menu and hotkey it to ctrl+z.
Since there's no "edit" menu, i guess it could go under "debug". But you might want to add other items under "edit" eventually.
Re: Mesen - Debugger Feedback?
Haven't made a new build yet, but here's what the profiler looks like (using thwaite with symbols imported):
Re: Mesen - Debugger Feedback?
Awesome work! Two items for me:
1. Would it be possible to set a relative path for loading files? My use case is I have the following dir structure:
src/
obj/
assets/
The .nes file and all other build output goes into obj (including the .dbg file). When I load the .dbg file with the debugger:
My current workaround is to just copy over the src dir into the obj dir; although, I still get a few problem paths:
2. Would it be possible to set a custom transform for label names? This is something I have been meaning to implement with FCEUX. My use case is:
I use modules in CA65 like so:
and want to transform labels like this "__physiscs_init" into "physiscs::init" for viewing in the debugger.
1. Would it be possible to set a relative path for loading files? My use case is I have the following dir structure:
src/
obj/
assets/
The .nes file and all other build output goes into obj (including the .dbg file). When I load the .dbg file with the debugger:
My current workaround is to just copy over the src dir into the obj dir; although, I still get a few problem paths:
2. Would it be possible to set a custom transform for label names? This is something I have been meaning to implement with FCEUX. My use case is:
I use modules in CA65 like so:
Code: Select all
; physics.h
.ifndef _PHYSICS_
_PHYSICS_ = 1
.import _physics_init
.proc physics
init = __physics_init
.endproc
.endif
; physics.s
.export __physics_init
.proc __physics_init
...
rts
.endproc
; in some other .s file
.include "physics.h"
jsr physics::init
Re: Mesen - Debugger Feedback?
Unrelated note: .scope is probably a better choice here than .proc. .proc creates an unnecessary label physics.dullahan wrote:Code: Select all
; physics.h .ifndef _PHYSICS_ _PHYSICS_ = 1 .import _physics_init .proc physics init = __physics_init .endproc .endif
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: Mesen - Debugger Feedback?
but as stupid as it may sound, I had no clue how to translate the Soft/Hard reset distinction to French & Japanese, so I ended up not adding it.
ホットリセット (hot reset) and コールドリセット (cold reset) are in Jisho; given that it has a dedicated source for computer terminology I'm inclined to trust these.I've seen these referred to as "warm boot" (soft reset) and "cold boot" (hard reset/power cycle); not sure how well those will translate to French and Japanese, however.
Best I could find for French is also in the hot/cold metaphor, but wasn't in official dictionaries I could find: reset à chaud, reset à froid. This has a number of translations, including just loanwording "soft reset" or putting the adjective after "reset soft". «[Re]démarrage à chaud/froid» also seem to be an option.
Interglot (though I've never used it before, so don't know its reputation) goes for réinitialisation matérielle with the alternative being réinitialisation logicielle.
Of course, we might ask some of our actual resident French speakers…