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:
parent
140826d245
commit
88950914d7
|
@ -16,30 +16,41 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* 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"
|
#include "mapinc.h"
|
||||||
|
|
||||||
static uint16 cmdreg;
|
static uint16 cmdreg;
|
||||||
static uint8 invalid_data;
|
static uint8 reset;
|
||||||
static SFORMAT StateRegs[] =
|
static SFORMAT StateRegs[] =
|
||||||
{
|
{
|
||||||
{ &invalid_data, 1, "INVD" },
|
{ &reset, 1, "REST" },
|
||||||
{ &cmdreg, 2, "CREG" },
|
{ &cmdreg, 2, "CREG" },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Sync(void) {
|
static void Sync(void) {
|
||||||
setprg16r((cmdreg & 0x060) >> 5, 0x8000, (cmdreg & 0x01C) >> 2);
|
uint32 base = ((cmdreg & 0x060) | ((cmdreg & 0x100) >> 1)) >> 2;
|
||||||
setprg16r((cmdreg & 0x060) >> 5, 0xC000, (cmdreg & 0x200) ? (~0) : 0);
|
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);
|
setmirror(((cmdreg & 2) >> 1) ^ 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFR(UNL8157Read) {
|
static DECLFR(UNL8157Read) {
|
||||||
if (invalid_data && cmdreg & 0x100)
|
if ((cmdreg & 0x100) && (PRGsize[0] < (1024 * 1024))) {
|
||||||
return 0xFF;
|
A = (A & 0xFFF0) + reset;
|
||||||
else
|
}
|
||||||
return CartBR(A);
|
return CartBR(A);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(UNL8157Write) {
|
static DECLFW(UNL8157Write) {
|
||||||
|
@ -51,14 +62,14 @@ static void UNL8157Power(void) {
|
||||||
setchr8(0);
|
setchr8(0);
|
||||||
SetWriteHandler(0x8000, 0xFFFF, UNL8157Write);
|
SetWriteHandler(0x8000, 0xFFFF, UNL8157Write);
|
||||||
SetReadHandler(0x8000, 0xFFFF, UNL8157Read);
|
SetReadHandler(0x8000, 0xFFFF, UNL8157Read);
|
||||||
cmdreg = 0x200;
|
cmdreg = reset = 0;
|
||||||
invalid_data = 1;
|
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UNL8157Reset(void) {
|
static void UNL8157Reset(void) {
|
||||||
cmdreg = 0;
|
cmdreg = reset = 0;
|
||||||
invalid_data ^= 1;
|
reset++;
|
||||||
|
reset &= 0x1F;
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,45 +21,67 @@
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
|
||||||
static uint8 cmd0, cmd1;
|
static uint8 cmd0, cmd1;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &cmd0, 1, "L1" },
|
||||||
|
{ &cmd1, 1, "L2" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
static void DoSuper(void) {
|
static void Sync(void) {
|
||||||
setprg8r((cmd0 & 0xC) >> 2, 0x6000, ((cmd0 & 0x3) << 4) | 0xF);
|
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) {
|
if (cmd0 & 0x10) {
|
||||||
setprg16r((cmd0 & 0xC) >> 2, 0x8000, ((cmd0 & 0x3) << 3) | (cmd1 & 7));
|
if (PRGptr[1]) {
|
||||||
setprg16r((cmd0 & 0xC) >> 2, 0xc000, ((cmd0 & 0x3) << 3) | 7);
|
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
|
} else
|
||||||
setprg32r(4, 0x8000, 0);
|
if (PRGptr[4])
|
||||||
|
setprg32r(4, 0x8000, 0);
|
||||||
|
else
|
||||||
|
setprg32(0x8000, 0);
|
||||||
setmirror(((cmd0 & 0x20) >> 5) ^ 1);
|
setmirror(((cmd0 & 0x20) >> 5) ^ 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(SuperWrite) {
|
static DECLFW(SuperWriteLo) {
|
||||||
if (!(cmd0 & 0x10)) {
|
if (!(cmd0 & 0x10)) {
|
||||||
cmd0 = V;
|
cmd0 = V;
|
||||||
DoSuper();
|
Sync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(SuperHi) {
|
static DECLFW(SuperWriteHi) {
|
||||||
cmd1 = V;
|
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) {
|
static void SuperReset(void) {
|
||||||
SetWriteHandler(0x6000, 0x7FFF, SuperWrite);
|
|
||||||
SetWriteHandler(0x8000, 0xFFFF, SuperHi);
|
|
||||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
|
||||||
cmd0 = cmd1 = 0;
|
cmd0 = cmd1 = 0;
|
||||||
setprg32r(4, 0x8000, 0);
|
Sync();
|
||||||
setchr8(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SuperRestore(int version) {
|
static void SuperRestore(int version) {
|
||||||
DoSuper();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Supervision16_Init(CartInfo *info) {
|
void Supervision16_Init(CartInfo *info) {
|
||||||
AddExState(&cmd0, 1, 0, "L1");
|
info->Power = SuperPower;
|
||||||
AddExState(&cmd1, 1, 0, "L2");
|
info->Reset = SuperReset;
|
||||||
info->Power = SuperReset;
|
|
||||||
GameStateRestore = SuperRestore;
|
GameStateRestore = SuperRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,26 +20,28 @@
|
||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
|
||||||
static uint8 bank, base, lock, mirr;
|
static uint8 bank, base, lock, mirr, mode;
|
||||||
static SFORMAT StateRegs[] =
|
static SFORMAT StateRegs[] =
|
||||||
{
|
{
|
||||||
{ &bank, 1, "BANK" },
|
{ &bank, 1, "BANK" },
|
||||||
{ &base, 1, "BASE" },
|
{ &base, 1, "BASE" },
|
||||||
{ &lock, 1, "LOCK" },
|
{ &lock, 1, "LOCK" },
|
||||||
{ &mirr, 1, "MIRR" },
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &mode, 1, "MODE" },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Sync(void) {
|
static void Sync(void) {
|
||||||
setchr8(0);
|
setchr8(0);
|
||||||
setprg16(0x8000, base | bank);
|
setprg16(0x8000, base | bank);
|
||||||
setprg16(0xC000, base | 7);
|
setprg16(0xC000, base | (mode ? bank : 7));
|
||||||
setmirror(mirr);
|
setmirror(mirr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(BMCT262Write) {
|
static DECLFW(BMCT262Write) {
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
base = ((A & 0x60) >> 2) | ((A & 0x100) >> 3);
|
base = ((A & 0x60) >> 2) | ((A & 0x100) >> 3);
|
||||||
|
mode = A & 0x80;
|
||||||
mirr = ((A & 2) >> 1) ^ 1;
|
mirr = ((A & 2) >> 1) ^ 1;
|
||||||
lock = (A & 0x2000) >> 13;
|
lock = (A & 0x2000) >> 13;
|
||||||
}
|
}
|
||||||
|
@ -48,14 +50,14 @@ static DECLFW(BMCT262Write) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BMCT262Power(void) {
|
static void BMCT262Power(void) {
|
||||||
lock = bank = base = 0;
|
lock = bank = base = mode = 0;
|
||||||
Sync();
|
Sync();
|
||||||
SetWriteHandler(0x8000, 0xFFFF, BMCT262Write);
|
SetWriteHandler(0x8000, 0xFFFF, BMCT262Write);
|
||||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BMCT262Reset(void) {
|
static void BMCT262Reset(void) {
|
||||||
lock = bank = base = 0;
|
lock = bank = base = mode = 0;
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,7 @@ typedef struct {
|
||||||
//size
|
//size
|
||||||
static int not_power2[] =
|
static int not_power2[] =
|
||||||
{
|
{
|
||||||
198, 228
|
53, 198, 228
|
||||||
};
|
};
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -497,7 +497,7 @@ static BMAPPINGLocal bmap[] = {
|
||||||
{"SMB2j FDS Rev. A", 50, Mapper50_Init},
|
{"SMB2j FDS Rev. A", 50, Mapper50_Init},
|
||||||
{"11-in-1 BALL SERIES", 51, Mapper51_Init}, // 1993 year version
|
{"11-in-1 BALL SERIES", 51, Mapper51_Init}, // 1993 year version
|
||||||
{"MMC3 BMC PIRATE D", 52, Mapper52_Init},
|
{"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},
|
// {"", 54, Mapper54_Init},
|
||||||
// {"", 55, Mapper55_Init},
|
// {"", 55, Mapper55_Init},
|
||||||
// {"", 56, Mapper56_Init},
|
// {"", 56, Mapper56_Init},
|
||||||
|
|
Loading…
Reference in New Issue