I am attempting to understand how the UNIF UNL-SA-9602B mapper works by studying the code in FCEUX (sa-9602b.cpp). Here is the function that sets the PRG bank:
In the setprg8r function, what does the first parameter mean? I noticed that when it's 0, it appears to refer to cartridge PRG ROM. A value of 0x10 is typically used for WRAM.
In unif.cpp, the mapper is marked with the following flag:
The mapper appears to have 32K CHR RAM; however, no where in sa-9602b.cpp is a call to set the CHR RAM bank. I suspect that line in the code above where setprg8r takes EXPREGS[1] as an argument has something to do with it. Can anyone familiar with FCEUX's code base shed some light on this.
Code:
static void SA9602BPW(uint32 A, uint8 V) {
setprg8r(EXPREGS[1], A, V & 0x3F);
if (MMC3_cmd & 0x40)
setprg8r(0, 0x8000, ~(1));
else
setprg8r(0, 0xc000, ~(1));
setprg8r(0, 0xe000, ~(0));
}
setprg8r(EXPREGS[1], A, V & 0x3F);
if (MMC3_cmd & 0x40)
setprg8r(0, 0x8000, ~(1));
else
setprg8r(0, 0xc000, ~(1));
setprg8r(0, 0xe000, ~(0));
}
In the setprg8r function, what does the first parameter mean? I noticed that when it's 0, it appears to refer to cartridge PRG ROM. A value of 0x10 is typically used for WRAM.
In unif.cpp, the mapper is marked with the following flag:
Code:
{ "SA-9602B", SA9602B_Init, BMCFLAG_32KCHRR },
...
else if (bmap[x].flags & BMCFLAG_32KCHRR)
CHRRAMSize = 32;
...
else if (bmap[x].flags & BMCFLAG_32KCHRR)
CHRRAMSize = 32;
The mapper appears to have 32K CHR RAM; however, no where in sa-9602b.cpp is a call to set the CHR RAM bank. I suspect that line in the code above where setprg8r takes EXPREGS[1] as an argument has something to do with it. Can anyone familiar with FCEUX's code base shed some light on this.