Mesen - NES Emulator

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
Controllerhead
Posts: 148
Joined: Tue Nov 13, 2018 4:58 am
Location: $4016
Contact:

Re: Mesen - NES Emulator

Post by Controllerhead » Sun Aug 23, 2020 8:07 pm

yaros wrote:
Sun Aug 23, 2020 8:01 pm
Hey Sour, or maybe someone else know. I got back to using Mesen recently. If I remember correctly, when I used Mesen Ctrl+T power cycle used to reload ROM (or maybe I used another hotkey...), but now it doesn't. I have to manually go to File->Reload ROM in main menu. Is there something I'm missing or is my memory faulty?
Looking for this? It's mapable

Image
Image

yaros
Posts: 14
Joined: Mon Jul 27, 2020 1:14 pm

Re: Mesen - NES Emulator

Post by yaros » Sun Aug 23, 2020 8:18 pm

Controllerhead wrote:
Sun Aug 23, 2020 8:07 pm
Looking for this? It's mapable
No. I remember that power cyling in debugger (see attached) used to also reload the rom. If I build new version, and code changes, I want new rom to be loaded into the emulator. Both power cycle from debugger or emulator screens leave old rom in memory.
Attachments
Untitled.png
Untitled.png (8.91 KiB) Viewed 1178 times

User avatar
Controllerhead
Posts: 148
Joined: Tue Nov 13, 2018 4:58 am
Location: $4016
Contact:

Re: Mesen - NES Emulator

Post by Controllerhead » Sun Aug 23, 2020 8:46 pm

yaros wrote:
Sun Aug 23, 2020 8:18 pm
I want new rom to be loaded into the emulator.
Ah, i see your point. I don't know what the old functionality was like, but if you click on the game screen and map this, the ROM will reload. There doesn't seem to be a way to map that directly in the debugger though... hmm...

Image

Personally i have a keyboard shortcut in Notepad++ that triggers a .bat file that runs ASM6F, detects errorlevel, if compile is successful, it starts Mesen and just reloads everything.

Image

I don't know if something like this would fit your needs?
Image

yaros
Posts: 14
Joined: Mon Jul 27, 2020 1:14 pm

Re: Mesen - NES Emulator

Post by yaros » Sun Aug 23, 2020 8:55 pm

Controllerhead wrote:
Sun Aug 23, 2020 8:46 pm
Ah, i see your point. I don't know what the old functionality was like, but if you click on the game screen and map this, the ROM will reload. There doesn't seem to be a way to map that directly in the debugger though... hmm...
That's what I did. Still annoying to switch back to the main window sometimes. Thanks for trying :)

edit: Actually, I can confirm. This is a regression. In 0.9.8 Ctrl+T does reload rom.

Fiskbit
Posts: 153
Joined: Sat Nov 18, 2017 9:15 pm

Re: Mesen - NES Emulator

Post by Fiskbit » Sun Aug 23, 2020 10:30 pm

This was an intentional change. Users did not expect power cycle to also reload the ROM and there were complaints about it. While this is clearly not an improvement for everyone, I think the new behavior is better on the whole.

User avatar
Controllerhead
Posts: 148
Joined: Tue Nov 13, 2018 4:58 am
Location: $4016
Contact:

Re: Mesen - NES Emulator

Post by Controllerhead » Sun Aug 23, 2020 11:26 pm

Fiskbit wrote:
Sun Aug 23, 2020 10:30 pm
This was an intentional change. Users did not expect power cycle to also reload the ROM and there were complaints about it. While this is clearly not an improvement for everyone, I think the new behavior is better on the whole.
Hmm, there are mappable hotkeys for both behaviors in the main game screen. I am surprised this isn't a mappable option in the debugger hotkey window. Though, playing with it a bit and reloading a ROM with the debugger open, it doesn't seem to "like" this behavior (i'm willing to bet some edge cases break things) ...so maybe it was disabled on purpose?
Image

yaros
Posts: 14
Joined: Mon Jul 27, 2020 1:14 pm

Re: Mesen - NES Emulator

Post by yaros » Tue Aug 25, 2020 9:17 am

Fiskbit wrote:
Sun Aug 23, 2020 10:30 pm
This was an intentional change. Users did not expect power cycle to also reload the ROM and there were complaints about it. While this is clearly not an improvement for everyone, I think the new behavior is better on the whole.
I guess I'll have to stay on older version for now, until Sour comes back to the development. I understand it could be confusing for some, but I think that should be the setting (and I don't care about default behaviour :)). It break my development workflow, by requiring me fiddling with windows of Mesen.

Fiskbit
Posts: 153
Joined: Sat Nov 18, 2017 9:15 pm

Re: Mesen - NES Emulator

Post by Fiskbit » Tue Aug 25, 2020 10:51 am

Use the version you're happiest with, but just be aware that there have been about 255 commits since version 0.9.8 with all sorts of bug fixes, accuracy improvements, and new features, so you're really losing a lot for this compared to the current appveyor release.

User avatar
tokumaru
Posts: 11858
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Mesen - NES Emulator

Post by tokumaru » Tue Aug 25, 2020 7:17 pm

For people who are developing games, it makes a lot of sense to have a power cycle reload the ROM, since the ROM is modified each time it's assembled/compiled.

What kind of trouble were people having from the ROM being reloaded that caused them to complain? I really can't think of anything...

Fiskbit
Posts: 153
Joined: Sat Nov 18, 2017 9:15 pm

Re: Mesen - NES Emulator

Post by Fiskbit » Tue Aug 25, 2020 8:02 pm

There are logical and practical reasons you wouldn't want this. Power cycle is analogous to pressing the power button off and on on a real console, while reloading the ROM is like swapping carts; it's not easy to guess that these operations would be tied together. Power cycling on both hardware and Mesen can randomize the CPU/PPU alignment, the mapper state, and the RAM state, and gives you different starting CPU and PPU state, all things you might want to do with the same ROM while making changes to the file and saving along the way. In Mesen, reloading the ROM also blows away in-progress changes you might be working on, such as changes to the ROM in the memory tools, because it all has to be reloaded into a clean state, and so there were complaints about this resulting in lost work.

User avatar
tokumaru
Posts: 11858
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Mesen - NES Emulator

Post by tokumaru » Wed Aug 26, 2020 8:05 am

I see. Let me take the opportunity to ask a Mesen question that I can't seem to figure out.

I've always used FCEUX for quick debugging sessions because it's so light and straightforward, but lately I've been trying to switch to Mesen. Since Mesen does so much more, and is very configurable, its interface is not always intuitive.

I'm currently having some trouble with the disassembly. First I wasn't sure how to display most of the memory ranges, but apparently there are menu options to select what's visible in the disassembly. After enabling the display of the part I wanted to check, I had a really hard time trying to align the disassembly to a specific address. No matter what I tried, I couldn't get the disassembly to line up with the instructions I was trying to debug, so it was all showing up as garbage.

Does anyone know if there's a way to force the disassembly to assign to specific addresses?

Fiskbit
Posts: 153
Joined: Sat Nov 18, 2017 9:15 pm

Re: Mesen - NES Emulator

Post by Fiskbit » Wed Aug 26, 2020 8:45 am

The debugger is intended to be used in conjunction with Mesen's code/data logger (which runs automatically) so that it correctly disassembles things, which is usually really good, but not so good when trying to look at code that's not yet been executed or when modifying the ROM (so the log becomes inaccurate). You can't change the alignment if you're using the option to disassemble unidentified code/data regions, but you can mark the region you're looking at as verified code so that Mesen will disassemble it. This can be done with the "Mark selection as..." option in the right click menu either in the memory tools or the debugger's disassembly view, though the latter has the shortcoming that it can't be done on a byte-by-byte granularity. When you mark something as verified code, the debugger will automatically disassemble the following unidentified code/data up to the next RTS, JSR, or JMP, showing these assumed instructions in green. You can revert something to unidentified code/data through the same marking mechanism, and can reset the whole code/data log if it becomes too inaccurate with 'Tools -> Code/Data Logger -> Reset log' in the disassembler.

yaros
Posts: 14
Joined: Mon Jul 27, 2020 1:14 pm

Re: Mesen - NES Emulator

Post by yaros » Wed Aug 26, 2020 6:56 pm

Fiskbit wrote:
Tue Aug 25, 2020 10:51 am
Use the version you're happiest with, but just be aware that there have been about 255 commits since version 0.9.8 with all sorts of bug fixes, accuracy improvements, and new features, so you're really losing a lot for this compared to the current appveyor release.
I know, unfortunately I'd have to trade it off for my sanity, when I pull my hair debugging 3 build old code.
tokumaru wrote:
Tue Aug 25, 2020 7:17 pm
What kind of trouble were people having from the ROM being reloaded that caused them to complain? I really can't think of anything...
I saw one complaint [0] of the person romhacking the game, changing the code, not saving the session. Then doing power reset, reloading ROM and loosing their work. Not saying their complaint is not valid, but also they kind of did it to themselves.

[0] - https://github.com/SourMesen/Mesen/issues/696

User avatar
Controllerhead
Posts: 148
Joined: Tue Nov 13, 2018 4:58 am
Location: $4016
Contact:

Re: Mesen - NES Emulator

Post by Controllerhead » Wed Sep 02, 2020 9:38 pm

I am manually manipulating the stack pointer with 3 INX's instead of using RTI to return from NMI. It fits my code structure well. The debugger is not happy about this. My call stack is shot. Oh well... It's not wrong though.

Perhaps manually manipulating the stack pointer should adjust the call stack? I don't know. That may cause other issues?

So, um, the debugger does not appreciate changing the stack pointer manually and never returning from subroutines and interrupts. That is all. No big deal. Just thought it should be noted. Carry on.

Image
Image

lidnariq
Posts: 9659
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Mesen - NES Emulator

Post by lidnariq » Wed Sep 02, 2020 10:13 pm

It might deal better with three PLA ? And it's only barely slower, 12cy instead of 10.

Post Reply