Page 1 of 1

J.Y. Company mapper variations

Posted: Tue Jan 16, 2018 12:57 pm
by NewRisingSun
I've got three J.Y. Company multicart ROM images that use some variation of mapper 90/209/211. The variation lies in what register $D003 does.

Regular mappers 90/209/211: Used by all single-game releases, as well as the 1998 Super 45-in-1 multicart (JY-120A, Mapper 90). Register $D003:

Code: Select all

 7654 3210
 ---- ----
 M.BC CPPC
 | || |||+- Select 256 KiB outer CHR-ROM bank if M==0
 | || |++-- Select 512/1024 KiB outer PRG-ROM bank
 | |+-+---- Select 512/1024 KiB outer CHR-ROM bank
 | +------- CHR Banking Mode
 |          0=Use outer 256 KiB CHR-ROM bank, masking off the regular CHR bank registers' bits ($9000-$AFFF) that select 256 KiB+ bank numbers
 |          1=Do not use outer 256 KiB CHR-ROM bank; use the regular CHR bank registers' bits ($9000-$AFFF) unmasked
 +--------- MMC2/4 Mode (effective in 4 KiB CHR banking mode, ignored otherwise)
            0=Do not automatically change CHR banks
            1=Automatically change CHR banks when encountering CHR tiles $FD and $FE (same as Nintendo MMC2/4)
Extended Mirroring is always off for Mapper 90, always on for Mapper 211, and selectable for Mapper 209 by register $D000 bit 5. Final Fight 3, Shin Samurai Spirits II and Tekken 2 all set bit 5 to select 256 KiB+ CHR-ROM banks directly, indicating that they are running on hardware that otherwise would mask off the higher-order CHR bank register bits and replace them with the outer bank.

Variation 1: Used by the 1997 Super HIK 4-in-1 multicart (JY-052), which has 512 KiB each of PRG-ROM and CHR-ROM. A single bit in register D003 selects both PRG and CHR outer banks:

Code: Select all

 7654 3210
 ---- ----
 .... ...C
         +- Select 256 KiB outer PRG-ROM bank
         +- Select 256 KiB outer CHR-ROM bank
PRG ($8000-$8FFF) and CHR ($9000-$AFFF) bank select register bits that select 256 KiB banks are masked off. Extended Mirroring is selected by register $D001 (Mirroring) bit 3.

Variation 2: Used the 1997 Super HIK 21-in-1 multicart (JY-105), which has 1 MiB each of PRG-ROM and CHR-ROM, and the 1998 Super HIK 5-in-1 multicart (JY-114), also 1 MiB each of PRG/CHR. Like regular mappers 90/209/211, except that the outer PRG-ROM bank is 256 KiB in size, and Extended Mirroring is selected differently. Register $D003:

Code: Select all

 7654 3210
 ---- ----
 .... CPPC
      |||+- Select 256 KiB outer CHR-ROM bank
      |++-- Select 256/512 KiB outer PRG-ROM bank
      +---- Select 512 KiB outer CHR-ROM bank
PRG ($8000-$8FFF) and CHR ($9000-$AFFF) bank select register bits that select 256 KiB banks are masked off. Extended Mirroring is selected by register $D001 (Mirroring) bit 3, as in Variation 1.

The 1997 Super HIK 4-in-1 multicart (Variation 1) is already in GoodNES 3.23b, tagged as Mapper 90, and to my knowledge does not run in any emulator other than Nestopia Plus which identifies it by CRC. The others were dumped by CaH4e3, who permits release of them once they're emulated. I can assign two submappers of mapper 209 (not 90 since Extended Mirroring is selectable) and write one of those dreaded test ROMs, or assign two entirely new NES 2.0 mapper numbers in the 256-511 range. Which one is preferred?

Re: J.Y. Company mapper variations

Posted: Tue Jan 16, 2018 1:27 pm
by lidnariq
I tentatively think that submappers were originally intended for "here are two boards that are mostly-but-not-completely-compatible and have been historically emulated using the same code" ...

But that's clearly not true for mapper 78, where I don't think there's a robust way to detect which board variant is desired.

I think I'd lean towards allocating a new mapper number.

Re: J.Y. Company mapper variations

Posted: Tue Jan 16, 2018 4:49 pm
by zxbdragon
NewRisingSun wrote:I've got three J.Y. Company multicart ROM images that use some variation of mapper 90/209/211. The variation lies in what register $D003 does.

Regular mappers 90/209/211: Used by all single-game releases, as well as the 1998 Super 45-in-1 multicart (JY-120A, Mapper 90). Register $D003:

Code: Select all

 7654 3210
 ---- ----
 M.BC CPPC
 | || |||+- Select 256 KiB outer CHR-ROM bank if M==0
 | || |++-- Select 512/1024 KiB outer PRG-ROM bank
 | |+-+---- Select 512/1024 KiB outer CHR-ROM bank
 | +------- CHR Banking Mode
 |          0=Use outer 256 KiB CHR-ROM bank, masking off the regular CHR bank registers' bits ($9000-$AFFF) that select 256 KiB+ bank numbers
 |          1=Do not use outer 256 KiB CHR-ROM bank; use the regular CHR bank registers' bits ($9000-$AFFF) unmasked
 +--------- MMC2/4 Mode (effective in 4 KiB CHR banking mode, ignored otherwise)
            0=Do not automatically change CHR banks
            1=Automatically change CHR banks when encountering CHR tiles $FD and $FE (same as Nintendo MMC2/4)
Extended Mirroring is always off for Mapper 90, always on for Mapper 211, and selectable for Mapper 209 by register $D000 bit 5. Final Fight 3, Shin Samurai Spirits II and Tekken 2 all set bit 5 to select 256 KiB+ CHR-ROM banks directly, indicating that they are running on hardware that otherwise would mask off the higher-order CHR bank register bits and replace them with the outer bank.

Variation 1: Used by the 1997 Super HIK 4-in-1 multicart (JY-052), which has 512 KiB each of PRG-ROM and CHR-ROM. A single bit in register D003 selects both PRG and CHR outer banks:

Code: Select all

 7654 3210
 ---- ----
 .... ...C
         +- Select 256 KiB outer PRG-ROM bank
         +- Select 256 KiB outer CHR-ROM bank
PRG ($8000-$8FFF) and CHR ($9000-$AFFF) bank select register bits that select 256 KiB banks are masked off. Extended Mirroring is selected by register $D001 (Mirroring) bit 3.

Variation 2: Used the 1997 Super HIK 21-in-1 multicart (JY-105), which has 1 MiB each of PRG-ROM and CHR-ROM, and the 1998 Super HIK 5-in-1 multicart (JY-114), also 1 MiB each of PRG/CHR. Like regular mappers 90/209/211, except that the outer PRG-ROM bank is 256 KiB in size, and Extended Mirroring is selected differently. Register $D003:

Code: Select all

 7654 3210
 ---- ----
 .... CPPC
      |||+- Select 256 KiB outer CHR-ROM bank
      |++-- Select 256/512 KiB outer PRG-ROM bank
      +---- Select 512 KiB outer CHR-ROM bank
PRG ($8000-$8FFF) and CHR ($9000-$AFFF) bank select register bits that select 256 KiB banks are masked off. Extended Mirroring is selected by register $D001 (Mirroring) bit 3, as in Variation 1.

The 1997 Super HIK 4-in-1 multicart (Variation 1) is already in GoodNES 3.23b, tagged as Mapper 90, and to my knowledge does not run in any emulator other than Nestopia Plus which identifies it by CRC. The others were dumped by CaH4e3, who permits release of them once they're emulated. I can assign two submappers of mapper 209 (not 90 since Extended Mirroring is selectable) and write one of those dreaded test ROMs, or assign two entirely new NES 2.0 mapper numbers in the 256-511 range. Which one is preferred?
JY ROM, I DUMP have more variations.

Re: J.Y. Company mapper variations

Posted: Wed Jan 17, 2018 1:14 am
by MLX
Can you be more specific, please?

Re: J.Y. Company mapper variations

Posted: Wed Jan 17, 2018 3:24 pm
by NewRisingSun
The last mapper number that krzysiobal has assigned is 280. I am therefore assigning mapper numbers 281 and 282 for these two variants. Attached find a Nintendulator emulation source.

Related question: If someone could tell me which J.Y. Company game actually uses Mapper 90/209/211's feature of putting PRG-ROM in the $6000-$7FFF range, and in which game situation, it would be much appreciated.

Re: J.Y. Company mapper variations

Posted: Wed Jan 17, 2018 4:11 pm
by zxbdragon
case 281:
name = "BMC NEWSTAR 12-IN-1/76-IN-1";

k.....

PRG-ROM: 512 kB (hovewer A19 is wired to the EPROM)
CHR-RAM: 8 kB

[mvPP .P..] 74*174: $8000-$bfff
|||| |
||++--+--- outer PRG (high to low: D0, D5, D4)
|+-------- mode (0=16kB, 1=32kB)
+--------- mirroring (0=V, 1=H)

[.... uppp] 74*161: $8000-$9fff and $c000-$dfff
||||
|+++- inner PRG
+---- mode (0=UNROM,1=NROM)
yes, it overlaps partially with previous reg, so when wring at $8000-$9fff, botch registers are updated

Power up: both registers set to 0
Reset: no change

PRG Modes:

uv $8000 $bfff
----------------
00 PPPppp PPP111
01 PPPpp0 PPP111
10 PPPppp PPPppp
11 PPPpp0 PPPpp1
------------------------------------

#include "mapinc.h"

static uint8 reg174, reg161;

//shifts bit at position `from` to position `to` in expression
#define shi(exp, from, to) ((((exp) >> (from)) & 1) << (to))

static SFORMAT StateRegs[] =
{
{ 0 }
};

static void Sync(void) {
int uv = shi(reg161, 3, 1) | shi(reg174, 6, 0);
int PPP = shi(reg174, 0, 2) | shi(reg174, 5, 1) | shi(reg174, 4, 0);
int ppp = reg161 & 0x7;

switch (uv) {
case 0: setprg16(0x8000, (PPP << 3) | ppp); setprg16(0xc000, (PPP << 3) | 7); break;
case 1: setprg16(0x8000, ((PPP << 3) | ppp) & (~1)); setprg16(0xc000, (PPP << 3) | 7); break;
case 2: setprg16(0x8000, (PPP << 3) | ppp); setprg16(0xc000, (PPP << 3) | ppp); break;
case 3: setprg32(0x8000, ((PPP << 3) | ppp) >> 1); break;
}
setmirror(((reg174 >> 7) & 1) == 0 ? MI_V : MI_H);

}

static DECLFW(M281Write) {
if ((A >= 0x8000) && (A <= 0xBFFF)) {
reg174 = V;
}
if (((A >= 0x8000) && (A <= 0x9FFF)) || ((A >= 0xC000) && (A <= 0xFFFF))) {
reg161 = V;
}
Sync();
}

static void M281Power(void) {
setchr8(0);
reg174 = reg161 = 0;
SetWriteHandler(0x8000, 0xffff, M281Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
Sync();
}

static void M281Reset(void) {
Sync();
}


static void StateRestore(int version) {
Sync();
}

void Mapper281_Init(CartInfo *info) {
info->Power = M281Power;
info->Reset = M281Reset;

GameStateRestore = StateRestore;

AddExState(&StateRegs, ~0, 0, 0);
}

Re: J.Y. Company mapper variations

Posted: Wed Jan 17, 2018 11:39 pm
by NewRisingSun
I suggest that instead of assigning mapper numbers for your new dumps secretly, you announce them in a way that people can know about them, either by making a forum post or a nesdev wiki stub. I am not changing my assignment of 281.

Re: J.Y. Company mapper variations

Posted: Thu Jan 18, 2018 5:52 am
by zxbdragon
NewRisingSun wrote:I suggest that instead of assigning mapper numbers for your new dumps secretly, you announce them in a way that people can know about them, either by making a forum post or a nesdev wiki stub. I am not changing my assignment of 281.
I am not changing. rom test,to public!

282-500,have rom.

Re: J.Y. Company mapper variations

Posted: Thu Jan 18, 2018 1:37 pm
by NewRisingSun
As I have just written, the ROM that I have assigned to Mapper 281 has been out there for a long time as part of the GoodNES 3.23b set as "1997 Super HIK 4-in-1 (JY-052) [p1][!]". So no, you are not the first one to publicly release a ROM image for this mapper.

I intend to assign "BMC NEWSTAR 12-IN-1/76-IN-1" to Mapper 293. Since Nestopia Plus identifies ROM images by CRC32 anyway, it should make no difference when using either ROM image.

Re: J.Y. Company mapper variations

Posted: Thu Jan 18, 2018 1:55 pm
by krzysiobal
As far as I remember, the 45-in-1 mapper 90 variation is not 100% compatible with what is shown in nesdev.com (I implemented it in hardware and it worked for signle mapper-90 games but not for 45-in-1). Then I had to see in FCEUX source code what's really going on (as far as I remember upper CHR-lines were used as PRG lines or something that)

Re: J.Y. Company mapper variations

Posted: Thu Jan 18, 2018 2:03 pm
by NewRisingSun
The first description of my initial post is based on the FCEUX source code and runs all single games as well as 45-in-1. I agree that it needs to be incorporated into the wiki.

The two Mapper 282 ROMs are now available at the, uh, usual place.

Re: J.Y. Company mapper variations

Posted: Mon Nov 18, 2019 6:55 am
by aquasnake

Code: Select all

					case (cpu_addr_in[14:12])
						3'b000: begin // $800x
							//if (!r1[7]) 
								r1[6:0] = cpu_data_in[6:0];
							//else r1[6:0] = {cpu_data_in[0], cpu_data_in[1], cpu_data_in[2], cpu_data_in[3], cpu_data_in[4], cpu_data_in[5], cpu_data_in[6]};
							case (cpu_addr_in[1:0])
								2'b00: prg_bank_a[5:0] = r1[5:0];
								2'b01: prg_bank_b[5:0] = r1[5:0];
								2'b10: prg_bank_c[5:0] = r1[5:0];
								2'b11: begin
									//if (r2[0]) prg_bank_d[5:0] = r1[5:0];
									prg_bank_6000[5:0] = r1[5:0];
								end
							endcase
						end

........
........
........



Re: J.Y. Company mapper variations

Posted: Mon Nov 18, 2019 7:06 am
by aquasnake

Code: Select all

D~7654 3210
  ---------
  4.Lc cPPC
  | || |||+- If L=0: Select 256 KiB outer CHR-ROM bank (CHR A18), ignored if L=1
  | || |++-- Select 512 KiB outer PRG-ROM bank (PRG A19-A20)
  | |+-+---- Select 512 KiB outer CHR-ROM bank (CHR A19-A20)
  | +------- Select outer CHR-ROM bank size
  |           0: Mask $900x/$A00x to 256 KiB, use C
  |           1: Mask $900x/$A00x to 512 KiB, ignore C
  +--------- Select MMC4-like automatic CHR-ROM bankswitching mode
              0: Disable
              1: Enable (only meaningful in 4 KiB CHR-ROM banking mode)



i'm not sure if the logic is correct:

mapped_ppu_a[20:18] = {bit[4:3], bit[5] ? chr_bank_high[0] : bit[0]}

Re: J.Y. Company mapper variations

Posted: Mon Nov 18, 2019 7:13 am
by NewRisingSun
Which of the many J.Y. mappers (many more have been discovered since the post you are responding to was written) are you asking about? And are you inquiring whether your logic is correct, or whether the logic described in the wiki articles is correct?