New, homebrew mapper

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

na_th_an
Posts: 543
Joined: Mon May 27, 2013 9:40 am

New, homebrew mapper

Post by na_th_an » Sat Jun 03, 2017 1:47 am

Some time ago, Doragasu created a nice TK-ROM based board with a CPLD implementing the MMC3 ASIC & glue logic plus flash ROM and RAM.

As you can really code any mapper in the CPLD, he has adapted the implementation to create an oversize GN-ROM kind of mapper with configurable H/V mirroring and optional battery backed 8K WRAM. He has left the MMC3's scanline counter in, as well.

We will be using this board for some releases next year.

I have some requests for information:

- How can we get assigned an iNES mapper number? Is there any procedure? Who's in charge of assigning iNES mapper numbers?
- How can we get emulator support? I've checked fceux source code and with some work I might be able to implement something working but I was wondering whether developers just wait for the fceux team to implement the proposed mappers or the fceux team expects developers to submit code to support the new mappers. I don't think it's difficult as the new mapper is just a mashup of features of existing mappers.
- Do you have any suggestions?

Here's the mapper specification, from the VHDL file:

Code: Select all

-- Allows using up to 128 megabits (64 CHR + 64 PRG), mapping banks
-- with 32 KiB granularity for PRG-ROM and 8 KiB granularity for CHR-ROM.
-- 
-- Registers:
-- $8000: CHR bank (low byte)
-- $8001: CHR bank (high byte)
-- $9000: PRG bank
-- $9001: Mirroring and RAM enable:
--  * BIT0, mirroring: 0 vertical, 1 horizontall.
--  * BIT6, RAM write enable: 0 allow writes, 1 prohibit writes.
--  * BIT7, RAM enable: 0: RAM disabled, 1: RAM enabled.
Besides, the scanline counter works as described in http://wiki.nesdev.com/w/index.php/MMC3 . I think it behaves like MMC3C but I have to confirm this.

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

Re: New, homebrew mapper

Post by Sour » Sat Jun 03, 2017 4:59 am

na_th_an wrote:- How can we get assigned an iNES mapper number? Is there any procedure? Who's in charge of assigning iNES mapper numbers?
As far as I've seen in other threads, the mapper's "author" tends to choose a number for it. Quote from Wiki: "The suggested method to assign a mapper number is not to assign one unless you have at least either A. a hardware implementation or B. an emulator implementation and a sketch of hardware. (You should probably also have written at least part of the game too)"
The mappers marked as "Mappers that are not documented on this wiki" in this grid are usually safe to use. These match the mappers that I haven't been able to find any information on, so neither FCEUX nor Nestopia should be implementing them. (best way to confirm is to check the source code for a few emulators though).
na_th_an wrote:- How can we get emulator support?
As far as Mesen goes, once you have a mapper number, specs and at least 1 rom I can test it on, it would probably only take a few minutes to implement (given what you've posted so far), and I could probably make a release containing it within a few days or weeks (depending on how long ago the last release I made was)

na_th_an
Posts: 543
Joined: Mon May 27, 2013 9:40 am

Re: New, homebrew mapper

Post by na_th_an » Sat Jun 03, 2017 6:56 am

I have a Mapper 113 custom multicart we released a bit ago as a joke I could adapt easily. We will test it on HW first, then I will make it available. It doesn't use the scanline counter, but it is MMC3C's. Given time, I could write a more exhaustive tester.

Thanks for the pointers.

I like the number 404 for some reason ;)

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

Re: New, homebrew mapper

Post by lidnariq » Sat Jun 03, 2017 8:55 am

na_th_an wrote:- Do you have any suggestions?
If you want to keep an eye for making this as easily implemented as possible in discrete logic, and/or minimizing the number of pins needed on the programmable logic, move the registers to $8000, $A000, $C000, $E000.

Otherwise, sounds good to me.

User avatar
Quietust
Posts: 1492
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: New, homebrew mapper

Post by Quietust » Sat Jun 03, 2017 9:07 am

lidnariq wrote:
na_th_an wrote:- Do you have any suggestions?
If you want to keep an eye for making this as easily implemented as possible in discrete logic, and/or minimizing the number of pins needed on the programmable logic, move the registers to $8000, $A000, $C000, $E000.

Otherwise, sounds good to me.
Alternatively, you could latch both the data and address lines and have a single register control everything (like numerous multicart mappers do), though that would obviously preclude having a scanline counter.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.

na_th_an
Posts: 543
Joined: Mon May 27, 2013 9:40 am

Re: New, homebrew mapper

Post by na_th_an » Sat Jun 03, 2017 10:16 am

The hardware already exists and the boards are already manufactured. It was a CPLD-driven TKROM clone, all Doragasu had to do was to rewrite the VHDL. We are repurposing unused/remaining boards.

We already have a sort of discrete logic alternative which implements a Mapper 113 board and uses EPROM. You can read about it here: viewtopic.php?p=168166#p168166

doragasu
Posts: 26
Joined: Tue Oct 20, 2015 2:25 am

Re: New, homebrew mapper

Post by doragasu » Sat Jun 03, 2017 2:45 pm

Thanks for the suggestions! As na_th_an wrote, the hardware already exists. It uses a CPLD and I already implemented and MMC3 clone. But we are coding another mapper because for some games they want to develop, it is more convenient to change complete 32KiB/8KiB PRG/CHR blocks. Here is the cart and programmer I developed:

Image

Register addresses were lazily chosen: they use the same addresses than the MMC3 ones I previously implemented.

User avatar
rainwarrior
Posts: 7680
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: New, homebrew mapper

Post by rainwarrior » Sat Jun 03, 2017 5:30 pm

na_th_an wrote:- How can we get assigned an iNES mapper number? Is there any procedure? Who's in charge of assigning iNES mapper numbers?
- How can we get emulator support? I've checked fceux source code and with some work I might be able to implement something working but I was wondering whether developers just wait for the fceux team to implement the proposed mappers or the fceux team expects developers to submit code to support the new mappers. I don't think it's difficult as the new mapper is just a mashup of features of existing mappers.
Well step 1 is releasing a ROM that people want to emulate. Ideally you would create a test ROM that validates the mapper implementation as well.

There isn't really much of an FCEUX "team"; we're not that organized. It's a small handful of people that occasionally add features they are interested in. Zeromus implemented the Action 53 mapper to run that ROM. CaitSith2 implemented the RetroUSB "UNROM 512" mapper, I think because he was interested in emulating Battle Kid, and then later assigned and implemented the "INL-NSF" mapper because he wanted to emulate the 2A03 Puritans album. I implemented the "Cheapocabra" mapper because I wanted to emulate The Incident, though I'm not sure who assigned mapper 111 to it, probably Memblers.

If you want to see support in an emulator, just get somebody interested in it. The best way to do that is to release something good.

If you're trying to choose a mapper number, if you're content with iNES 2 then that's pretty wide open. If you want to choose an iNES 1 mapper, though, just be careful, check popular emulators to make sure they're not using it and ask around before you assume it's available, don't just go by the wiki.

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

Re: New, homebrew mapper

Post by lidnariq » Sat Jun 03, 2017 9:35 pm

doragasu wrote:Register addresses were lazily chosen: they use the same addresses than the MMC3 ones I previously implemented.
... Should na_th_an's summary instead have indicated registers at A000 / A001 instead of 9000 / 9001 ? 'cuz I realized after I added my comment that I had forgotten the MMC3 IRQ controls, and if so then that's basically the "right" choice.

na_th_an
Posts: 543
Joined: Mon May 27, 2013 9:40 am

Re: New, homebrew mapper

Post by na_th_an » Sun Jun 04, 2017 12:53 pm

rainwarrior wrote:
na_th_an wrote:- How can we get assigned an iNES mapper number? Is there any procedure? Who's in charge of assigning iNES mapper numbers?
- How can we get emulator support? I've checked fceux source code and with some work I might be able to implement something working but I was wondering whether developers just wait for the fceux team to implement the proposed mappers or the fceux team expects developers to submit code to support the new mappers. I don't think it's difficult as the new mapper is just a mashup of features of existing mappers.
Well step 1 is releasing a ROM that people want to emulate. Ideally you would create a test ROM that validates the mapper implementation as well.

There isn't really much of an FCEUX "team"; we're not that organized. It's a small handful of people that occasionally add features they are interested in. Zeromus implemented the Action 53 mapper to run that ROM. CaitSith2 implemented the RetroUSB "UNROM 512" mapper, I think because he was interested in emulating Battle Kid, and then later assigned and implemented the "INL-NSF" mapper because he wanted to emulate the 2A03 Puritans album. I implemented the "Cheapocabra" mapper because I wanted to emulate The Incident, though I'm not sure who assigned mapper 111 to it, probably Memblers.

If you want to see support in an emulator, just get somebody interested in it. The best way to do that is to release something good.

If you're trying to choose a mapper number, if you're content with iNES 2 then that's pretty wide open. If you want to choose an iNES 1 mapper, though, just be careful, check popular emulators to make sure they're not using it and ask around before you assume it's available, don't just go by the wiki.
I was asking because I need emulator support so I can actually code something interesting :) I can easily convert existing GNROM-like stuff I have to test almost every feature.

I think I will give it a shot and try it myself, then. Is there any doc/guide/etc? Or just a matter of reverse engineer the project? ;)

User avatar
rainwarrior
Posts: 7680
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: New, homebrew mapper

Post by rainwarrior » Sun Jun 04, 2017 5:30 pm

na_th_an wrote:Is there any doc/guide/etc? Or just a matter of reverse engineer the project? ;)
If you want to add a mapper to FCEUX, all the mapper implementations are under boards/ and then you just need to add an entry for it in ines.cpp/h.

Example change to add a mapper: As far as building it, just download the source package or SVN repo and it should build with Visual Studio Express just fine.

na_th_an
Posts: 543
Joined: Mon May 27, 2013 9:40 am

Re: New, homebrew mapper

Post by na_th_an » Mon Jun 05, 2017 12:15 am

Thank you, that pointer is exactly what I needed :)

na_th_an
Posts: 543
Joined: Mon May 27, 2013 9:40 am

Re: New, homebrew mapper

Post by na_th_an » Wed Jun 07, 2017 1:54 pm

Update.

To be able to write drivers for my favourite emulators that support our new mapper implementation, I first needed a test ROM. But I could not validate such rom without a supporting emulator.

So I modified the good ol' Nester, which is quite a simple emulator, and added support for mappers 66, 113 (to warm up and get the hang of it) and this new 404 (bar the scanline counter, that will come later). Modifying Nester is quite easy and it is small so it compiles fast. If was fun digging from my old pile of CDROMs from my college years to install MSVC 6.0. So I got the emulation working, validated the test ROM, and now that I know I have a working ROM I can begin writing mapper support for Fceux and Nestopia (to begin with).

By the way, we are sticking with mapper number #404, which therefore needs ROMs with NES 2.0 headers. To honour the number, we've called the board implementation "NFROM - Not Found ROM" ;)

I will keep you posted.

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

Re: New, homebrew mapper

Post by lidnariq » Wed Jun 07, 2017 2:30 pm

Specifically in FCEUX's case, you probably could just verbatim borrow the MMC3 IRQ- SetWriteHandler(0xC000, 0xFFFF, MMC3_IRQWrite); and not have to reimplement that at all.

na_th_an
Posts: 543
Joined: Mon May 27, 2013 9:40 am

Re: New, homebrew mapper

Post by na_th_an » Thu Jun 08, 2017 12:04 am

That's great. The banking side of things is also quite easy.

Post Reply