Mesen - NES Emulator

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

There's been some recent discussion about it (e.g here), but I don't think there's been any actual progress on this so far. Looking a bit just now, it seems like System.Drawing is meant to work properly on Cocoa since a commit in early august. Mono's WinForms is drawn exclusively with Mono's System.Drawing implementation, so that's probably a good step forward.
Banshaku wrote:When you pass by Fukuoka, depending on your schedule, we can go out for a coffee after work and talk nes related stuff since I'm working downtown
Sure, just keep in mind that despite writing Mesen, I actually don't really have a clue how most NES games are built :p
I'm just going there on vacation, so it shouldn't be too hard to find some free time. Et ça te donnera une excuse pour parler français aussi :p
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Mesen - NES Emulator

Post by Banshaku »

Sour wrote:[Sure, just keep in mind that despite writing Mesen, I actually don't really have a clue how most NES games are built :p
I'm just going there on vacation, so it shouldn't be too hard to find some free time. Et ça te donnera une excuse pour parler français aussi :p
Je parle en français seulement le weekend alors je risque de chercher mes nots ^^;;; As for talking about nes, doesn't have to be, would love to know what are interesting things can be done in c# these days. Last time I used it was for my map editor and it was done in C# 2.0 and I will need to update a few things to allow some extra data to be managed. The problem is... I don't remember the code! :lol:
mkwong98
Posts: 282
Joined: Mon May 30, 2011 9:01 pm

Re: Mesen - NES Emulator

Post by mkwong98 »

Sour wrote:
mkwong98 wrote:Is it possible to dump the nametables and OAM in a file using the same format as the "Copy Nametable" function when that frame has new tiles?
What do you mean by "when that frame has new tiles"? New tiles compared to what?
I mean "New" as the first frame a tile id + palette combination appears.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Mesen - NES Emulator

Post by koitsu »

Feature request: some way to get at the I2C-related internals of Bandai-based mappers/submappers which use it. Specifically mapper 159, which is the one I'm dealing with at present (aren't you glad I didn't say 157?).

Minimal: I'd find Memory Tools -> View -> EEPROM Data helpful. Don't care if it's labelled "EEPROM Data" or "PRG-NVRAM" (what the Wiki and NES 2.0 header refer to it as).

Extensive: I'd love to be able to see I2C SDA/SDL somewhere, as well as direction (bit 7 of $800D), but not sure where UI-wise this would be appropriate since it's mapper-specific. Debugger seems most relevant, I guess? I don't know.

OT: This mapper sure caught me by surprise. And while I2C is generally something I'm familiar with (I write stuff using SMBus), I sure didn't expect to see it on a Famicom cartridge. I would bet hard cash this was done to save money; the Bandai games that had this implemented were from 1990 (possibly very late 1989), which aligns almost perfectly with the IC shortage in Japan (further info). I'd bet the thought process went something like this: "we have our own mapper IC and we just need something that has a small amount of non-volatile storage, we don't need 8KB SRAM chips...", and the rest is history. Don't get me started on the endian ordeal...
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

koitsu wrote:Feature request: some way to get at the I2C-related internals of Bandai-based mappers/submappers which use it.
Unfortunately, it looks like in my never-ending quest to support more mappers, I implemented these boards without actually ever getting around to implementing the EEPROM functionality. The code for the EEPROM register has been empty since I implemented the mapper over 2 years ago (and apparently you're the only person to ever notice or care enough to remind me :p)

I'm leaving on my trip in just 2 days, so it's unlikely I can find the time to properly implement it + integrate it into the debugger before then - I'll try to take a quick look tonight to see if it's simpler than what I'm expecting, though.
Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

Re: Mesen - NES Emulator

Post by Great Hierophant »

koitsu wrote: OT: This mapper sure caught me by surprise. And while I2C is generally something I'm familiar with (I write stuff using SMBus), I sure didn't expect to see it on a Famicom cartridge. I would bet hard cash this was done to save money; the Bandai games that had this implemented were from 1990 (possibly very late 1989), which aligns almost perfectly with the IC shortage in Japan (further info). I'd bet the thought process went something like this: "we have our own mapper IC and we just need something that has a small amount of non-volatile storage, we don't need 8KB SRAM chips...", and the rest is history. Don't get me started on the endian ordeal...
I find it interesting and amusing to read articles like these. Sometimes they get technical facts very wrong. The article lays blame on an SRAM shortage due to Japanese manufacturers shifting production lines to DRAM. "The two chips are similar, but SRAMs work more quickly and are less expensive." I think it should be more expensive, not less. "A competitor, Sega of America, said it isn't feeling the effects of the shortage as greatly because it relies more heavily on different memory chips." As far as I know, Sega used 8KB and 16KB RAM in its Master System console and cartridges, similar to Nintendo. "A typical personal computer, such as a system equivalent to the IBM-AT, needs 16 [256 kilobit] DRAM chips. A more powerful computer, such as IBM's System 30 model, requires 32 such chips." I assume they are referring to the IBM PS/2 Model 30, which on that date was using an 8086 CPU, certainly not more powerful than the IBM PC AT. It also doesn't use the kind of 256x1 chips the article describes and uses SIMMs.

By the date of the article, Nintendo only published six games using SRAM : Kid Icarus, Legend of Zelda, Metroid, Pro Wrestling, R.C. Pro-Am, Rad Racer. But the article identifies "a popular version of Donkey Kong", which as we know does not use SRAM if they are referring to the NES cartridge. It appears likely that the SRAM shortage spilled over into Mask ROM production. R.C. Pro-Am was revised to use CHR-ROM instead of CHR-RAM, probably due to the SRAM shortage by the end of 1988.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Mesen - NES Emulator

Post by lidnariq »

Great Hierophant wrote:"A competitor, Sega of America, said it isn't feeling the effects of the shortage as greatly because it relies more heavily on different memory chips." As far as I know, Sega used 8KB and 16KB RAM in its Master System console and cartridges, similar to Nintendo.
The Master System used "XRAM" which was actually a DRAM with a controller to sequence access and refresh. We'd call it a "PSRAM" now.

Obviously that doesn't help for carts that used battery-backed save, but my understanding is that some number of SMS carts used Microwire EEPROMs for save games.
koitsu wrote:I'd bet the thought process went something like this: "we have our own mapper IC and we just need something that has a small amount of non-volatile storage, we don't need 8KB SRAM chips...", and the rest is history.
And yet the VRC2, with its microwire interface, hit the market in 1987 ... but no games were ever released that used it.

Well, not until that pirate port of one of the Bandai games.
Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

Re: Mesen - NES Emulator

Post by Great Hierophant »

lidnariq wrote:"A competitor, Sega of America, said it isn't feeling the effects of the shortage as greatly because it relies more heavily on different memory chips." As far as I know, Sega used 8KB and 16KB RAM in its Master System console and cartridges, similar to Nintendo.
The Master System used "XRAM" which was actually a DRAM with a controller to sequence access and refresh. We'd call it a "PSRAM" now.

Obviously that doesn't help for carts that used battery-backed save, but my understanding is that some number of SMS carts used Microwire EEPROMs for save games.[/quote]

I didn't know about that kind of RAM, now I do.

I believe all Sega Master System games with non-volatile memory used battery backup, but there are a few Game Gear games which use EEPROM.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Mesen - NES Emulator

Post by koitsu »

Sour wrote:Unfortunately, it looks like in my never-ending quest to support more mappers, I implemented these boards without actually ever getting around to implementing the EEPROM functionality. The code for the EEPROM register has been empty since I implemented the mapper over 2 years ago (and apparently you're the only person to ever notice or care enough to remind me :p)
That's interesting, because Magical Taruruuto-kun - Fantastic World!! depends heavily on behaviour of $800D (reminder; and this is an EEPROM game, not PRG-RAM) and there seems to be some generic support for $6000-7FFF (since the game cares about bit 4 of $7F00 quite a bit, though the value it gets back tends to be $67). So I guess there's just enough emulation to get the game functional? If that's the case, then maybe I'm worrying about nothing.

I should add the Wiki has two pages on this mapper. There's the above as well as https://wiki.nesdev.com/w/index.php/INES_Mapper_159 , so I end up having to look at both to try and wrap my brain around things. Game in question is mapper 16 / sub 0 per NES header (not NES 2.0), but the Mesen/Nestopia DB forces mapper 159 / sub 0.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Mesen - NES Emulator

Post by NewRisingSun »

What exactly is unclear in the wiki pages on the Bandai FCG boards?
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Mesen - NES Emulator

Post by lidnariq »

It would have been clearer to have left the Bandai FCG Board article as the master reference, added the clarifying differences to that page, and leaving the four mapper pages as stubs that just summarized the difference. Now the individual pages don't call out the similarities and differences in a useful way and are forced to say the same thing over and over, and the Bandai FCG Board article is the only thing that explains the differences in a useful way but is mostly orphaned.

Now we've got a Single Version of the Truth problem.
Last edited by lidnariq on Tue Sep 25, 2018 11:25 am, edited 1 time in total.
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

koitsu wrote:and there seems to be some generic support for $6000-7FFF (since the game cares about bit 4 of $7F00 quite a bit, though the value it gets back tends to be $67). So I guess there's just enough emulation to get the game functional?
All bits currently return open bus in that range, except bit 4, which always returns 0, and bit 3, which will return the data from the barcode reader (when using mapper 157, otherwise it will return open bus).
I guess that's enough for the game to work? (I imagine it sees the EEPROM's content as being all 0s)
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Mesen - NES Emulator

Post by NewRisingSun »

I did ask for feedback on the changes I made then and, as so often here, received none, only to have to read complaints later.

I have modified the pages to have mapper 16 provide an overview, and the others listing only the differences to mapper 16.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Mesen - NES Emulator

Post by koitsu »

NewRisingSun wrote:I did ask for feedback on the changes I made then and, as so often here, received none, only to have to read complaints later.

I have modified the pages to have mapper 16 provide an overview, and the others listing only the differences to mapper 16.
Greatly appreciated! So far this looks like a big improvement. So I just want to thank you again for consolidating things in this manner. :-)
mkwong98
Posts: 282
Joined: Mon May 30, 2011 9:01 pm

Re: Mesen - NES Emulator

Post by mkwong98 »

The header of Dragon Ball Z: Kyoushuu! Saiya-jin often has the wrong serial EEPROM size (256 instead of 128), so the save feature of that game won't work on most emulators.
Post Reply