Namcot 163/MMC5/Konami VRC6 Audio Level test program

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by NewRisingSun »

rainwarrior wrote:So instead you expect from him
I have long given up on expecting anything. Nowadays I just hope for the best.
rainwarrior wrote:I had interpreted the spec given on the wiki as this field normally specifying external RAM only
That is contradicted by the statement further that the Taito X1-017's 5120 bytes should be rounded up.
rainwarrior wrote:NewRisingSun appears to expect B because of the header used in the test program, except it contradicts the statement above (neither are battery backed, so internal RAM should be unspecified?).
You missed the most important part of the specification: "If a cartridge has both dedicated RAM and RAM in the mapper". According to the spec (or at least how I understand it):

- Internal RAM, no WRAM, no battery -> denote internal RAM as PRG-RAM (most N163 games)
- Internal RAM, WRAM, no battery -> does not apply to any game. Spec would say denote only WRAM as PRG-RAM, and expect the emulator to add internal RAM by itself.
- Internal RAM, no WRAM, battery -> denote internal RAM as PRG-NVRAM (Mindseeker)
- Internal RAM, WRAM, battery -> Megami Tensei II, King of Kings. Spec would say denote only WRAM as PRG-NVRAM, and expect the emulator to add internal RAM by itself. Given that I verified that no such game uses internal RAM for save data (Megami Tensei II and King of Kings use it for expansion audio), I would say denote internal RAM as PRG-RAM and WRAM as PRG-NVRAM, which at least would be permissible under the spec as well, even though pedants would insist that the internal RAM technically is battery-backed as well.

The discussion that led to tepples asking kevtris-sama about this is here. Feel free to ask him, but I see no need for a further clarification. I do agree though that the wiki should explicitly denote that unless there is both WRAM and internal RAM, PRG-RAM should denote internal RAM.

Also, Dokuganryuu Masamune has no WRAM. Nescartdb is wrong on this; the additional glob performs some kind of internal RAM protect, if I remember correctly (lidnariq has investigated this, I think).
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by rainwarrior »

NewRisingSun wrote:
rainwarrior wrote:NewRisingSun appears to expect B because of the header used in the test program, except it contradicts the statement above (neither are battery backed, so internal RAM should be unspecified?).
No, you have missed the most important part of the specification: "If a cartridge has both dedicated RAM and RAM in the mapper".
This statement you are quoting from me is about when there is no WRAM, and that wiki quote has no suggested specification for "no WRAM and no battery backing", it only specifies if both are present. This is part of what I'm trying to clarify.
NewRisingSun wrote:- Internal RAM, no WRAM, no battery -> denote internal RAM as PRG-RAM (most N163 games)
So I did interpret your intention correctly for this.
NewRisingSun wrote:If you don't denote internal WRAM, then both the Taito X-something and MMC6 would have no WRAM whatsoever according to the NES 2.0 header.
Maybe, but MMC6 at least has its internal RAM at the same memory location as traditonal WRAM, so I don't think it's entirely inconsistent here. I'm not very familiar with Taito X-somthing, but there don't appear to be any mapper 80 games with WRAM anyway so there isn't really a conflict opportunity for it like there is with e.g. flash homebrew mappers. Judging by this, mapper 80 doesn't appear to be a NES 2.0 candidate anyway, battery backing can only imply its internal RAM is saved because that's its only existing case.

...at any rate, though, this is kind of an aside. Mappers are by their nature inconsistent, I don't think we can make one rule to fit them all, and probably there's always one that will be stupidly special, but at least we can try to document a practical specification in the end. Right now I'm just trying to assess what can work, and to a certain extent what's already working (e.g. romsets and/or implementations already in the wild).

Like from what I outlined, it seems like submapper 1 can imply that 0 in one or the other ram field can imply a 128b entry in some cases. That doesn't seem to cause any practical conflict with the spec you want to use, at least... though to be honest I think it would be easier if there was just 1 way to do it and I'm not quite sure what is so deficient about using submapper 1.
NewRisingSun wrote:Given that I verified that no such game uses internal RAM for save data...
I'm confused by this statement. There are a bunch of N163 games with a visible battery and no external WRAM.

King of Kings I can certainly believe is just accidentally battery backing the N163. ...or I'd believe if you told me that you found it didn't battery back the N163 at all and Bootgod's database has it wrong for that game. I'd find the other ones harder to believe though, why would there be a battery if there's no save?
NewRisingSun wrote:The discussion that led to tepples asking kevtris-sama about this is here.
Thanks. I missed that thread and did not find it while searching earlier.
NewRisingSun wrote:Also, Dokuganryuu Masamune has no WRAM; nescartdb is wrong on this; the additional glob performs some kind of internal RAM protect, if I remember correctly (lidnariq has investigated this, I think).
Okay, I'll make a note of this in my post. Does that require its own submapper as well then?
Last edited by rainwarrior on Tue Aug 07, 2018 10:08 am, edited 1 time in total.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by NewRisingSun »

rainwarrior wrote: I'm confused by this statement. There are a bunch of N163 games with a visible battery and no external WRAM.
No such game. "Such" in a paragraph about N163 plus WRAM plus battery. Yeesh.
rainwarrior wrote:Judging by this, mapper 80 doesn't appear to be a NES 2.0 candidate anyway, battery backing can only imply its internal RAM is saved because that's its only existing case.
Now I am confused about what you mean.
Last edited by NewRisingSun on Tue Aug 07, 2018 10:10 am, edited 1 time in total.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by lidnariq »

Great Hierophant wrote:However, the Analogue Nt Mini requires Mindsweeper to have Submapper 1 enabled for it to work properly in its jailbreak firmware. I doubt kevtris would be able to explain off-hand why this game and not any of the other Namco games requires this submapper to work correctly on his FPGA console.
Furthermore, if if the specific thing emulated is "battery-backed internal RAM" then submapper 1 should also be necessary for all games marked as "internal battRAM" here.
rainwarrior wrote:Judging by this, mapper 80 doesn't appear to be a NES 2.0 candidate anyway, battery backing can only imply its internal RAM is saved because that's its only existing case.
In fact, mappers 80, 82, and 207 were all only ever used with a battery and no external RAM.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by rainwarrior »

NewRisingSun wrote:
rainwarrior wrote: I'm confused by this statement. There are a bunch of N163 games with a visible battery and no external WRAM.
No such game. "Such" in a paragraph about N163 plus WRAM plus battery. Yeesh.
I was confused because you included MT2 and King of Kings together, which are not both in this category by the bootgod database. Maybe you know different. I don't know. That's why I'm asking.

Look, I'm just trying to understand what you mean, which was unclear to me, so I'm asking a question. This is not an attack, this is an attempt to understand what you're trying to express.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by NewRisingSun »

rainwarrior wrote:I was confused because you included MT2 and King of Kings together.
Why would I not include them together? Both have 8 KiB of WRAM, both have a battery, both have the N163 chip, and both use its 128 bytes for expansion audio.

Either way, it's becoming clear that the NES 2.0 PRG-RAM spec is not clear at all. I thought I understood it, but given that both rainwarrior and Sour understood it differently, then it can't be considered clear.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by rainwarrior »

NewRisingSun wrote:
rainwarrior wrote:Judging by this, mapper 80 doesn't appear to be a NES 2.0 candidate anyway, battery backing can only imply its internal RAM is saved because that's its only existing case.
Now I am confused about what you mean.
Ah, sorry with the rapid replies and edits I missed this.

If a game doesn't need disambiguation past iNES 1 spec, the iNES 2 fields are kind of irrelevant. There is no compatibility or accuracy need to put an iNES 2 header on it, so you don't really have any mandate to specify the internal RAM size anyway.

Like there's some argument that maybe battery backed RAM size should match the size of the file you need to save the state in, but that ship seems to have sailed already because of the power-of-two sizings.
lidnariq wrote:Furthermore, if if the specific thing emulated is "battery-backed internal RAM" then submapper 1 should also be necessary for all games marked as "internal battRAM" here.
Yes that's the same 6 that I had on my list above based on Bootgod. King of Kings is the possible outlier (almost certainly doesn't need battery N163 though).


From the rapid editing, I'm not sure at what stage my revised version of this appeared vs when you were reading, but just to clarify what I'm after:
rainwarrior wrote:
NewRisingSun wrote:If you don't denote internal WRAM, then both the Taito X-something and MMC6 would have no WRAM whatsoever according to the NES 2.0 header.
( stuff about MMC6 and mapper 80 )

...at any rate, though, this is kind of an aside. Mappers are by their nature inconsistent, I don't think we can make one rule to fit them all, and probably there's always one that will be stupidly special, but at least we can try to document a practical specification in the end. Right now I'm just trying to assess what can work, and to a certain extent what's already working (e.g. romsets and/or implementations already in the wild).

Like from what I outlined, it seems like submapper 1 can imply that 0 in one or the other ram field can imply a 128b entry in some cases. That doesn't seem to cause any practical conflict with the spec you want to use, at least... though to be honest I think it would be easier if there was just 1 way to do it and I'm not quite sure what is so deficient about using submapper 1.
To which end I was trying to say that I'm mostly trying to gather information here so I can see what's possible at this point. Maybe you've already gone through some reasoning or conclusion that submapper 1 is a garbage idea or internal RAM has to be specified etc. I don't know, but that's not something I can follow and reference until it's actually laid out. In a similar vein, I had assumed submapper 1 was useless from the tone of the discussion, but the more I looked at it there seemed to be a big lack of information around it, so I'm trying to open this up as a possibility too.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by NewRisingSun »

All right. Let's try this again. There are three kind of N163 save data situations:
Situation 1. N163, no WRAM, no battery. Most games. Can be expressed in iNES (1.0) by simply not setting the battery bit.
Situation 2. N163, no WRAM, battery. This means the game saves its data inside the N163 chip. Cannot be expressed in iNES (1.0), as most NES emulators will assume that the battery refers to the $6000-$7FFF area. (fwNES from 1998 being a notable exception).
Situation 3. N163, WRAM, battery. This means that the game saves its data using WRAM, and uses the N163 chip RAM for audio or not at all. Easily expressed in iNES (1.0), as it works like any other mapper's save function.
There is no N163 game that uses WRAM but has no battery.

The only iNES 1.0 problem in need of a solution therefore is situation 2. I assume that kevtris proposed to use submapper 1 for this. One could indeed do that.

But: NES 2.0 not only has submappers, but also PRG-RAM and PRG-NVRAM fields, and emulators interpret them whether we want it or not.
We must therefore define correct PRG-RAM and PRG-NVRAM values for all three scenarios, unless we say that situations 1 and 3 may not have a NES 2.0 header at all, which would be absurd.
The problem is that once we specify PRG-RAM and PRG-NVRAM fields for all three situations, however we do it, submapper 1 necessarily will become redundant.

What are the correct PRG-RAM and PRG-NVRAM fields for each of these three situations? My understanding based on the above description was:
Situation 1. BATT=0, PRG-RAM =128, PRG-NVRAM =0.
Situation 2. BATT=1, PRG-RAM =0, PRG-NVRAM =128.
Situation 3. BATT=1, PRG-RAM =128, PRG-NVRAM =8192.
This is based on the assumption that the 128 bytes of internal chip RAM count as PRG-RAM because they can be used for any purpose by disabling sound output. The spec and previous discussions implicitly assume this (and that may be the problem).

Now, lidnariq stated in the thread I linked to that the PCB is such that one cannot connect the battery to the 8 KiB WRAM chip without also connecting it to the N163, so 3 would have to be specified as:
Situation BATT=1, PRG-RAM =0, PRG-NVRAM =8320

And since 8320 cannot be specified because it must be a power of two, and because we did not want to round up to 16384, the sentence "If a cartridge has both a dedicated RAM and RAM in the mapper (such as that of Namco 163), and both or neither are battery-backed, include only the size of the dedicated RAM in the header." was added to the wiki, so Situation 3 is now specified as:
BATT =1, PRG-RAM =0, PRG-NVRAM =8192 if one insists that the N163 is technically battery backed, OR
BATT =1, PRG-RAM =128, PRG-NVRAM =8192 if one is willing to ignore that.
This is the current spec, as I understand it, which is quite hard to explain.

Now, one could be of the opinion that because the N163's chip RAM is not directly mapped into CPU address space at all, it is a special case and should not be included in the PRG-RAM/PRG-NVRAM fields at all. This would be okay since mapper 19 already tells us that there are 128 bytes of chip-internal RAM that are only accessible via $4800/$F800. The three situations would then be described as:
Situation 1. BATT =0, PRG-RAM =0, PRG-NVRAM =0.
Situation 2. BATT =1, PRG-RAM =0, PRG-NVRAM =0.
Situation 3. BATT =1, PRG-RAM =0, PRG-NVRAM =8192.
Which would be very consistent, and which I would like very much, but is contrary to the current spec and contrary to all previous discussion on the subject. And again, the PRG-NVRAM field would already disambiguate between situations 2 and 3, making submapper 1 redundant. I think some people did not like the sight of a header saying "a battery with 0 bytes of PRG-NVRAM", and stock Nintendulator indeed complains about that.
Last edited by NewRisingSun on Tue Aug 07, 2018 11:20 am, edited 1 time in total.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by rainwarrior »

I got a much better idea after reading that old thread. I had misidentified Hydlide 3 in my list by mistake, and lidnariq claryfing that WRAM and N163 are always battery backed together or neither was a big lightbulb.

As for iNES 1, in that case WRAM is always assumed and battery should presumably just save the N163 as well. Is there any compatibility issue there? (Does Mindseeker or some other game rely on open bus at $6000?)

Assuming our goal here for iNES 2 is accuracy and not merely compatibility, it seems that N163 RAM should always be saved if battery backed. Doesn't matter that it's not used, for accuracy's sake it belongs. There should be no such thing as an 8192 byte save for N163 in terms of accuracy, but an emulator could detect 128 byte or 8192 byte files if they exist and interpret them in a compatible way to fill the RAM.

So... the only remaining issue is just whether it's got 8k of WRAM or open bus at $6000.
NewRisingSun wrote:Situation 1. BATT =0, PRG-RAM =0, PRG-NVRAM =0.
Situation 2. BATT =1, PRG-RAM =0, PRG-NVRAM =0.
Situation 3. BATT =1, PRG-RAM =0, PRG-NVRAM =8192.
I think this last suggestion works very well for this, and removes ambiguity. "BATT=1, PRG-RAM=128" in the other suggestions is an inaccurate fiction because it can't not be battery backed, right? That last suggestion also removes all need for specifying this with a submapper, which is good too. Makes the audio mix submappers easier to implement, and is pretty cleanly open for 129 or other variant compatible subspecies if they ever appear.

(As for what's on the wiki, derived by telephone tag with Kevtris and tepples, I don't think it's actionable, and I'd suspect probably doesn't even effect his Analogue NT thing anyway. I'd vote we replace it with this ^ instead.)


So, deprecated submapper 1... looking at it again maybe it doesn't have the meaning I thought. Maybe this means "WRAM not present" (redundant) or maybe it means something about the battery needing to be saved, in which case it's like submapper 0 but with a redundant "battery save the N163" hint, not compatible with the audio mixing effort but we don't need to care about that -- it will be a compatibility mapper, not an accuracy one.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by NewRisingSun »

I am still not sure how to word my last suggestion in the form of a general rule. I was proposing to add to the NES 2.0 wiki page "The PRG-RAM and PRG-NVRAM fields apply to memory, both ASIC-internal and ASIC-external, that can be mapped into CPU address space. It therefore excludes the Namco 163's chip-internal RAM." But that would be incorrect as well, because the PRG-NVRAM field was explicitly designed to also handle serial EPROM, and that one cannot be directly mapped into CPU address space either. Dang.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by rainwarrior »

I don't think we need to tear our hair out trying to make every rule universal. Maybe there will be some special cases we can't iron out. A rule of thumb that works most of the time is still practical.

The specifics for what to do about N163 should really be on the N163 page, IMO. I sort of back-linked it from there earlier while trying to get a handle on the information, but really I think any mapper with internal RAM or something similar is a special thing that needs to be explicitly detailed on its mapper page. We can allude to them on the NES 2.0 page, but probably better to state a rule of thumb there and then make a list of links to the mappers it effects.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by NewRisingSun »

So the NES 2.0 wiki page would simply state: "The PRG-RAM and PRG-NVRAM fields, as a general rule, describe the amounts of non-battery-backed and battery-backed RAM, both ASIC-internal and ASIC-external, that are mapped into CPU address space. Special rules apply for mappers with RAM that is not mapped into CPU address space ([[Namco 163]]) and for mappers with serial EPROM ([[INES Mapper 016]], [[INES Mapper 157]], [[INES Mapper 159]]). For these mappers, it may be permissible to have the battery bit set, yet PRG-NVRAM having a value of zero."

The Namco 163 page would state: "The NES 2.0 PRG-RAM and PRG-NVRAM fields have non-zeros value only if there are 8 KiB of additional WRAM on the PCB. They do not include the 128 bytes of chip-internal RAM. This means that for games like Mindseeker, which save data to battery-backed chip-internal RAM, the NES header's battery bit will be set, yet PRG-NVRAM will have a value of zero."

I have to think about what the Mapper 16/157/159 pages should say about that.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by rainwarrior »

Doing some digging, but I didn't find any open bus access in Mindseeker.

I did notice that FCEUX had a header hack for the 5 games that had battery but no WRAM to force the header on. Masamune conspicuously absent, but I assume this is due to the persistent idea that it had WRAM.
https://github.com/TASVideos/fceux/blob ... s.cpp#L278


So... my guess is that Kevtris had it on his radar for iNES 2 because of being on CRC detection lists, but mistakenly not due to a need in the iNES 1 spec, just bad headers from people clearing the battery flag if no WRAM.

As such, I think submapper 1 most probably means specifically: no WRAM, battery backed. (Whether the emulator should enforce or override conflicting settings elsewhere in the header, probably up to them. I don't think this needs to be defined rigorously for a deprecated submapper.)
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by NewRisingSun »

The Mapper 16 page would state: "Some games have 256 bytes of serial EPROM; they must have the NES 2.0 PRG-NVRAM field set to 256 and the battery bit set. Games without serial EPROM must have the NES 2.0 PRG-NVRAM field set to 0 and the battery bit not set. Games with 128 bytes of serial EPROM must use Mapper 159."

The Mapper 159 page would state: "This mapper is only used for games with 128 bytes of serial EPROM. Although redundant, for consistency with Mapper 16, they must have the NES 2.0 PRG-NVRAM field set to 128 and the battery bit set."

The Mapper 157 page would state: "The Datach unit has 256 bytes of serial EPROM which is shared among all Datach games. The battery and PRG-NVRAM fields of the NES 2.0 header do not refer to the Datach unit, but only to the game cartridge itself. Only Battle Rush: Build Up Robot Tournament has an additional 128 bytes of serial EPROM in the game cartridge itself. This means that all other Datach Games must have the battery bit clear and PRG-NVRAM set to 0. The emulator, when seeing mapper 157, will maintain a common 256-byte save file for all Datach games. For Battle Rush: Build Up Robot Tournament, the battery bit must be set, and PRG-NVRAM must be set to 128. This causes the emulator to emulate the second game-specific EPROM in addition to the common Datach unit EPROM." Right now, Mapper 157 is another ambiguous case, and this proposal would rectify that.

Opinions on these PRG-RAM/NVRAM ideas (and the revised Namco 163 one)?
Last edited by NewRisingSun on Tue Aug 07, 2018 10:07 pm, edited 1 time in total.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Namcot 163/MMC5/Konami VRC6 Audio Level test program

Post by rainwarrior »

I haven't changed any of the information here yet, but I've regrouped it so that all the weird notes are now just a list of special cases.
http://wiki.nesdev.com/w/index.php/NES_ ... AM_size.29

I'll wait on more consensus before changing anything to do with the N163 thing but maybe at least this structure it'll be easier to get to needed info.


Edit, actually looking at the wording that's there...
if a cartridge has both a dedicated RAM and RAM in the mapper (such as that of Namco 163), and both or neither are battery-backed, include only the size of the dedicated RAM in the header. The emulator must add mapper RAM to this size.
That "both or neither" case is useless, since those are the only two possible cases if both chips are present. (That was a big part of what confused me; I thought there were other combinations, and Bootgod's inconsistent database seemed to confirm this.)

Since it only specifies the "both chips" case, what to do without WRAM was left unspecified. (This is the reason I think both Sour and I were surprised to find 128 in your test header.)

I am just going to tentatively replace it with that last proposal, which doesn't actually disagree with the letter of what it said before, since the no-WRAM case wasn't even specified:
Namco 163 has 128 bytes of internal RAM which may be battery backed. The internal RAM is always implied and not included in this field, but the presence or absence of 8k PRG-RAM is specified here.
Post Reply