Help with Nametable mirroring of Namco 163

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
Haruka
Posts: 37
Joined: Fri Mar 23, 2018 8:58 pm

Help with Nametable mirroring of Namco 163

Post by Haruka » Thu Jul 18, 2019 7:09 pm

Hello guys! I'm currently studying Namco 163 for a mapper hack project. But now I'm stucked on the Nametable mirroring.
Unlike VRC4/MMC3/Sunsoft5/Bandai FCG and other mappers, which write some value to some specific register to set mirroring, N163 has no such registers. From what I've learned, it seems I should map some banks directly to PPU $2000~$2FFF.
So I wrote the following code trying to set Vertical Mirroring:

Code: Select all

lda #$E0
sta $C000
sta $D000
lda #$E1
sta $C800
sta $D800
However when running on emulator (Mesen 0.9.8) it does not set to V-Mirroring but single screen B! I don't know why this happens. Did I misunderstand something? or is it because I forgot to initialize some registers?
Could anyone please give me some hints? Thanks in advance!

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

Re: Help with Nametable mirroring of Namco 163

Post by lidnariq » Thu Jul 18, 2019 7:52 pm

Mesen's implementation of Namco 163 has the run-time heuristics mentioned in the old version of our Mapper 210 documentation. Write to any register exclusive to the Namco 163 first and it should do the right thing.

Its implementation of the heuristics is fragile; it interprets my original
if the game ever writes to $C000 and this isn't a Namcot 163, this is probably a Namcot 175 with external RAM.
to mean "that if it writes to $C000 and we haven't made our mind up, it's a Namco 175", which I probably should have phrased as "if it writes &c, then it's not a Namco 340"

Haruka
Posts: 37
Joined: Fri Mar 23, 2018 8:58 pm

Re: Help with Nametable mirroring of Namco 163

Post by Haruka » Thu Jul 18, 2019 10:15 pm

Thank you very much lidnariq! I tried your solution.

First I added

Code: Select all

lda #$00
sta $4800
near RST handler, forcing the game write to internal RAM once, making emulator believe this is N163.
And then I modified

Code: Select all

...
ora #$C0
sta $E000
to

Code: Select all

...
ora #$40
sta $E000
so that E000.7 won't be set, preventing emulator from thinking the game is N340.

But it still displays abnormally.
nametable mirroring.png
As you can see, the layout of nametable is indeed Vertical Mirroring, but it displays "Horizontal"!

EDIT:
I also modified the iNES header to mapper 19, submapper 2 (which means I'm using iNES 2.0, which is supported by Mesen), still a big nope.

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

Re: Help with Nametable mirroring of Namco 163

Post by lidnariq » Thu Jul 18, 2019 11:54 pm

If I'm reading Mesen's source correctly, I think that text (but only the text) will be incorrect on MMC5 and N163 and anything else that supports things outside the set of {H,V,1a,1b,4}.

(edit: entertainingly, this means that mapper 150 games will update the text for three of the four possible values (H,V,1a), but should be stale for the final option of the four (L-shaped))

Haruka
Posts: 37
Joined: Fri Mar 23, 2018 8:58 pm

Re: Help with Nametable mirroring of Namco 163

Post by Haruka » Fri Jul 19, 2019 1:08 am

So that's the emulator's fault, not mine, right? Phew, that's a relief.
Thank you very much for your help!

Post Reply