mapper 53 - supported ines format of SUPERVISION UNIF board

UNIF 8157 - fix according to hw
UNIF T-262 - fix according to hw
This commit is contained in:
CaH4e3 2013-03-26 07:49:34 +00:00
parent 140826d245
commit 88950914d7
4 changed files with 71 additions and 36 deletions

View File

@ -16,30 +16,41 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* GG1 boards, similar to T-262, with no Data latch
*
*/
#include "mapinc.h"
static uint16 cmdreg;
static uint8 invalid_data;
static uint8 reset;
static SFORMAT StateRegs[] =
{
{ &invalid_data, 1, "INVD" },
{ &reset, 1, "REST" },
{ &cmdreg, 2, "CREG" },
{ 0 }
};
static void Sync(void) {
setprg16r((cmdreg & 0x060) >> 5, 0x8000, (cmdreg & 0x01C) >> 2);
setprg16r((cmdreg & 0x060) >> 5, 0xC000, (cmdreg & 0x200) ? (~0) : 0);
uint32 base = ((cmdreg & 0x060) | ((cmdreg & 0x100) >> 1)) >> 2;
uint32 bank = (cmdreg & 0x01C) >> 2;
uint32 lbank = (cmdreg & 0x200) ? 7 : ((cmdreg & 0x80) ? bank : 0);
if (PRGptr[1]) {
setprg16r(base >> 3, 0x8000, bank); // for versions with split ROMs
setprg16r(base >> 3, 0xC000, lbank);
} else {
setprg16(0x8000, base | bank);
setprg16(0xC000, base | lbank);
}
setmirror(((cmdreg & 2) >> 1) ^ 1);
}
static DECLFR(UNL8157Read) {
if (invalid_data && cmdreg & 0x100)
return 0xFF;
else
return CartBR(A);
if ((cmdreg & 0x100) && (PRGsize[0] < (1024 * 1024))) {
A = (A & 0xFFF0) + reset;
}
return CartBR(A);
}
static DECLFW(UNL8157Write) {
@ -51,14 +62,14 @@ static void UNL8157Power(void) {
setchr8(0);
SetWriteHandler(0x8000, 0xFFFF, UNL8157Write);
SetReadHandler(0x8000, 0xFFFF, UNL8157Read);
cmdreg = 0x200;
invalid_data = 1;
cmdreg = reset = 0;
Sync();
}
static void UNL8157Reset(void) {
cmdreg = 0;
invalid_data ^= 1;
cmdreg = reset = 0;
reset++;
reset &= 0x1F;
Sync();
}

View File

@ -21,45 +21,67 @@
#include "mapinc.h"
static uint8 cmd0, cmd1;
static SFORMAT StateRegs[] =
{
{ &cmd0, 1, "L1" },
{ &cmd1, 1, "L2" },
{ 0 }
};
static void DoSuper(void) {
setprg8r((cmd0 & 0xC) >> 2, 0x6000, ((cmd0 & 0x3) << 4) | 0xF);
static void Sync(void) {
setchr8(0);
if (PRGptr[1])
setprg8r((cmd0 & 0xC) >> 2, 0x6000, ((cmd0 & 0x3) << 4) | 0xF);
else
setprg8(0x6000, (((cmd0 & 0xF) << 4) | 0xF) + 4);
if (cmd0 & 0x10) {
setprg16r((cmd0 & 0xC) >> 2, 0x8000, ((cmd0 & 0x3) << 3) | (cmd1 & 7));
setprg16r((cmd0 & 0xC) >> 2, 0xc000, ((cmd0 & 0x3) << 3) | 7);
if (PRGptr[1]) {
setprg16r((cmd0 & 0xC) >> 2, 0x8000, ((cmd0 & 0x3) << 3) | (cmd1 & 7));
setprg16r((cmd0 & 0xC) >> 2, 0xc000, ((cmd0 & 0x3) << 3) | 7);
} else {
setprg16(0x8000, (((cmd0 & 0xF) << 3) | (cmd1 & 7)) + 2);
setprg16(0xc000, (((cmd0 & 0xF) << 3) | 7) + 2);
}
} else
setprg32r(4, 0x8000, 0);
if (PRGptr[4])
setprg32r(4, 0x8000, 0);
else
setprg32(0x8000, 0);
setmirror(((cmd0 & 0x20) >> 5) ^ 1);
}
static DECLFW(SuperWrite) {
static DECLFW(SuperWriteLo) {
if (!(cmd0 & 0x10)) {
cmd0 = V;
DoSuper();
Sync();
}
}
static DECLFW(SuperHi) {
static DECLFW(SuperWriteHi) {
cmd1 = V;
DoSuper();
Sync();
}
static void SuperPower(void) {
SetWriteHandler(0x6000, 0x7FFF, SuperWriteLo);
SetWriteHandler(0x8000, 0xFFFF, SuperWriteHi);
SetReadHandler(0x6000, 0xFFFF, CartBR);
cmd0 = cmd1 = 0;
Sync();
}
static void SuperReset(void) {
SetWriteHandler(0x6000, 0x7FFF, SuperWrite);
SetWriteHandler(0x8000, 0xFFFF, SuperHi);
SetReadHandler(0x6000, 0xFFFF, CartBR);
cmd0 = cmd1 = 0;
setprg32r(4, 0x8000, 0);
setchr8(0);
Sync();
}
static void SuperRestore(int version) {
DoSuper();
Sync();
}
void Supervision16_Init(CartInfo *info) {
AddExState(&cmd0, 1, 0, "L1");
AddExState(&cmd1, 1, 0, "L2");
info->Power = SuperReset;
info->Power = SuperPower;
info->Reset = SuperReset;
GameStateRestore = SuperRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -20,26 +20,28 @@
#include "mapinc.h"
static uint8 bank, base, lock, mirr;
static uint8 bank, base, lock, mirr, mode;
static SFORMAT StateRegs[] =
{
{ &bank, 1, "BANK" },
{ &base, 1, "BASE" },
{ &lock, 1, "LOCK" },
{ &mirr, 1, "MIRR" },
{ &mode, 1, "MODE" },
{ 0 }
};
static void Sync(void) {
setchr8(0);
setprg16(0x8000, base | bank);
setprg16(0xC000, base | 7);
setprg16(0xC000, base | (mode ? bank : 7));
setmirror(mirr);
}
static DECLFW(BMCT262Write) {
if (!lock) {
base = ((A & 0x60) >> 2) | ((A & 0x100) >> 3);
mode = A & 0x80;
mirr = ((A & 2) >> 1) ^ 1;
lock = (A & 0x2000) >> 13;
}
@ -48,14 +50,14 @@ static DECLFW(BMCT262Write) {
}
static void BMCT262Power(void) {
lock = bank = base = 0;
lock = bank = base = mode = 0;
Sync();
SetWriteHandler(0x8000, 0xFFFF, BMCT262Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void BMCT262Reset(void) {
lock = bank = base = 0;
lock = bank = base = mode = 0;
Sync();
}

View File

@ -435,7 +435,7 @@ typedef struct {
//size
static int not_power2[] =
{
198, 228
53, 198, 228
};
typedef struct {
char *name;
@ -497,7 +497,7 @@ static BMAPPINGLocal bmap[] = {
{"SMB2j FDS Rev. A", 50, Mapper50_Init},
{"11-in-1 BALL SERIES", 51, Mapper51_Init}, // 1993 year version
{"MMC3 BMC PIRATE D", 52, Mapper52_Init},
// {"", 53, Mapper53_Init}, // iNES version of complex UNIF board, can't emulate properly as iNES
{"SUPERVISION 16-in-1", 53, Supervision16_Init},
// {"", 54, Mapper54_Init},
// {"", 55, Mapper55_Init},
// {"", 56, Mapper56_Init},