cave/d_mazinger: add highscore (barbudreadmon), some updates
This commit is contained in:
parent
cf6d780a31
commit
d164941db5
|
@ -1,5 +1,6 @@
|
||||||
// mazinger
|
// mazinger
|
||||||
#include "cave.h"
|
#include "cave.h"
|
||||||
|
#include "watchdog.h"
|
||||||
#include "msm6295.h"
|
#include "msm6295.h"
|
||||||
#include "burn_ym2203.h"
|
#include "burn_ym2203.h"
|
||||||
#include "bitswap.h"
|
#include "bitswap.h"
|
||||||
|
@ -77,7 +78,7 @@ static void UpdateIRQStatus()
|
||||||
SekSetIRQLine(1, nIRQPending ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
|
SekSetIRQLine(1, nIRQPending ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 __fastcall mazingerReadByte(UINT32 sekAddress)
|
static UINT8 __fastcall mazingerReadByte(UINT32 sekAddress)
|
||||||
{
|
{
|
||||||
switch (sekAddress) {
|
switch (sekAddress) {
|
||||||
case 0x800002:
|
case 0x800002:
|
||||||
|
@ -92,7 +93,7 @@ UINT8 __fastcall mazingerReadByte(UINT32 sekAddress)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall mazingerWriteByte(UINT32 sekAddress, UINT8 byteValue)
|
static void __fastcall mazingerWriteByte(UINT32 sekAddress, UINT8 byteValue)
|
||||||
{
|
{
|
||||||
switch (sekAddress) {
|
switch (sekAddress) {
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ void __fastcall mazingerWriteByte(UINT32 sekAddress, UINT8 byteValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT16 __fastcall mazingerReadWord(UINT32 sekAddress)
|
static UINT16 __fastcall mazingerReadWord(UINT32 sekAddress)
|
||||||
{
|
{
|
||||||
switch (sekAddress) {
|
switch (sekAddress) {
|
||||||
case 0x300000:
|
case 0x300000:
|
||||||
|
@ -127,7 +128,7 @@ UINT16 __fastcall mazingerReadWord(UINT32 sekAddress)
|
||||||
UpdateIRQStatus();
|
UpdateIRQStatus();
|
||||||
return nRet;
|
return nRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x30006E:
|
case 0x30006E:
|
||||||
if (SoundLatchReplyIndex > SoundLatchReplyMax) {
|
if (SoundLatchReplyIndex > SoundLatchReplyMax) {
|
||||||
SoundLatchReplyIndex = 0;
|
SoundLatchReplyIndex = 0;
|
||||||
|
@ -135,12 +136,12 @@ UINT16 __fastcall mazingerReadWord(UINT32 sekAddress)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return SoundLatchReply[SoundLatchReplyIndex++];
|
return SoundLatchReply[SoundLatchReplyIndex++];
|
||||||
|
|
||||||
case 0x800000:
|
case 0x800000:
|
||||||
return DrvInput[0] ^ 0xFFFF;
|
return DrvInput[0] ^ 0xFFFF;
|
||||||
case 0x800002:
|
case 0x800002:
|
||||||
return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11);
|
return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11);
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress);
|
bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress);
|
||||||
}
|
}
|
||||||
|
@ -148,12 +149,12 @@ UINT16 __fastcall mazingerReadWord(UINT32 sekAddress)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall mazingerWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
static void __fastcall mazingerWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
||||||
{
|
{
|
||||||
if (sekAddress >= 0x30000a && sekAddress <= 0x300066) return;
|
if (sekAddress >= 0x30000a && sekAddress <= 0x300066) return;
|
||||||
if (sekAddress >= 0x30006a && sekAddress <= 0x30006c) return;
|
if (sekAddress >= 0x30006a && sekAddress <= 0x30006c) return;
|
||||||
if (sekAddress >= 0x300004 && sekAddress <= 0x300006) return;
|
if (sekAddress >= 0x300004 && sekAddress <= 0x300006) return;
|
||||||
|
|
||||||
switch (sekAddress) {
|
switch (sekAddress) {
|
||||||
case 0x300000:
|
case 0x300000:
|
||||||
nCaveXOffset = wordValue;
|
nCaveXOffset = wordValue;
|
||||||
|
@ -161,13 +162,13 @@ void __fastcall mazingerWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
||||||
case 0x300002:
|
case 0x300002:
|
||||||
nCaveYOffset = wordValue;
|
nCaveYOffset = wordValue;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 0x300008:
|
case 0x300008:
|
||||||
// CaveSpriteBuffer();
|
// CaveSpriteBuffer();
|
||||||
nCaveSpriteBank = wordValue;
|
nCaveSpriteBank = wordValue;
|
||||||
return;
|
return;
|
||||||
case 0x300068:
|
case 0x300068:
|
||||||
// Watchdog reset(?)
|
BurnWatchdogWrite();
|
||||||
return;
|
return;
|
||||||
case 0x30006e:
|
case 0x30006e:
|
||||||
SoundLatch = wordValue;
|
SoundLatch = wordValue;
|
||||||
|
@ -176,7 +177,7 @@ void __fastcall mazingerWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
||||||
ZetNmi();
|
ZetNmi();
|
||||||
nCyclesDone[1] += ZetRun(0x0400);
|
nCyclesDone[1] += ZetRun(0x0400);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 0x600000:
|
case 0x600000:
|
||||||
CaveTileReg[1][0] = wordValue;
|
CaveTileReg[1][0] = wordValue;
|
||||||
break;
|
break;
|
||||||
|
@ -186,7 +187,7 @@ void __fastcall mazingerWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
||||||
case 0x600004:
|
case 0x600004:
|
||||||
CaveTileReg[1][2] = wordValue;
|
CaveTileReg[1][2] = wordValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x700000:
|
case 0x700000:
|
||||||
CaveTileReg[0][0] = wordValue;
|
CaveTileReg[0][0] = wordValue;
|
||||||
break;
|
break;
|
||||||
|
@ -196,12 +197,12 @@ void __fastcall mazingerWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
||||||
case 0x700004:
|
case 0x700004:
|
||||||
CaveTileReg[0][2] = wordValue;
|
CaveTileReg[0][2] = wordValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x900000:
|
case 0x900000:
|
||||||
wordValue >>= 8;
|
wordValue >>= 8;
|
||||||
EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08);
|
EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress);
|
bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress);
|
||||||
|
|
||||||
|
@ -209,17 +210,17 @@ void __fastcall mazingerWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall mazingerWriteBytePalette(UINT32 sekAddress, UINT8 byteValue)
|
static void __fastcall mazingerWriteBytePalette(UINT32 sekAddress, UINT8 byteValue)
|
||||||
{
|
{
|
||||||
CavePalWriteByte(sekAddress & 0xffff, byteValue);
|
CavePalWriteByte(sekAddress & 0xffff, byteValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall mazingerWriteWordPalette(UINT32 sekAddress, UINT16 wordValue)
|
static void __fastcall mazingerWriteWordPalette(UINT32 sekAddress, UINT16 wordValue)
|
||||||
{
|
{
|
||||||
CavePalWriteWord(sekAddress & 0xffff, wordValue);
|
CavePalWriteWord(sekAddress & 0xffff, wordValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 __fastcall mazingerZIn(UINT16 nAddress)
|
static UINT8 __fastcall mazingerZIn(UINT16 nAddress)
|
||||||
{
|
{
|
||||||
nAddress &= 0xFF;
|
nAddress &= 0xFF;
|
||||||
|
|
||||||
|
@ -228,11 +229,11 @@ UINT8 __fastcall mazingerZIn(UINT16 nAddress)
|
||||||
SoundLatchStatus |= 0x04;
|
SoundLatchStatus |= 0x04;
|
||||||
return SoundLatch & 0xFF;
|
return SoundLatch & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x52: {
|
case 0x52: {
|
||||||
return BurnYM2203Read(0, 0);
|
return BurnYM2203Read(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress);
|
bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress);
|
||||||
}
|
}
|
||||||
|
@ -241,19 +242,18 @@ UINT8 __fastcall mazingerZIn(UINT16 nAddress)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall mazingerZOut(UINT16 nAddress, UINT8 nValue)
|
static void __fastcall mazingerZOut(UINT16 nAddress, UINT8 nValue)
|
||||||
{
|
{
|
||||||
nAddress &= 0xFF;
|
nAddress &= 0xFF;
|
||||||
|
|
||||||
switch (nAddress) {
|
switch (nAddress) {
|
||||||
case 0x00: {
|
case 0x00: {
|
||||||
DrvZ80Bank = nValue & 0x07;
|
DrvZ80Bank = nValue & 0x07;
|
||||||
|
|
||||||
ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000));
|
ZetMapMemory(RomZ80 + (DrvZ80Bank * 0x4000), 0x4000, 0x7FFF, MAP_ROM);
|
||||||
ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x10:
|
case 0x10:
|
||||||
if (SoundLatchReplyIndex > SoundLatchReplyMax) {
|
if (SoundLatchReplyIndex > SoundLatchReplyMax) {
|
||||||
SoundLatchReplyMax = -1;
|
SoundLatchReplyMax = -1;
|
||||||
|
@ -262,38 +262,38 @@ void __fastcall mazingerZOut(UINT16 nAddress, UINT8 nValue)
|
||||||
SoundLatchReplyMax++;
|
SoundLatchReplyMax++;
|
||||||
SoundLatchReply[SoundLatchReplyMax] = nValue;
|
SoundLatchReply[SoundLatchReplyMax] = nValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x50: {
|
case 0x50: {
|
||||||
BurnYM2203Write(0, 0, nValue);
|
BurnYM2203Write(0, 0, nValue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x51: {
|
case 0x51: {
|
||||||
BurnYM2203Write(0, 1, nValue);
|
BurnYM2203Write(0, 1, nValue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x70: {
|
case 0x70: {
|
||||||
MSM6295Write(0, nValue);
|
MSM6295Write(0, nValue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x74: {
|
case 0x74: {
|
||||||
DrvOkiBank1 = (nValue >> 0) & 0x03;
|
DrvOkiBank1 = (nValue >> 0) & 0x03;
|
||||||
DrvOkiBank2 = (nValue >> 4) & 0x03;
|
DrvOkiBank2 = (nValue >> 4) & 0x03;
|
||||||
|
|
||||||
memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000);
|
memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000);
|
||||||
memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000);
|
memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue);
|
bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 __fastcall mazingerZRead(UINT16 a)
|
static UINT8 __fastcall mazingerZRead(UINT16 a)
|
||||||
{
|
{
|
||||||
switch (a) {
|
switch (a) {
|
||||||
default: {
|
default: {
|
||||||
|
@ -304,7 +304,7 @@ UINT8 __fastcall mazingerZRead(UINT16 a)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall mazingerZWrite(UINT16 a, UINT8 d)
|
static void __fastcall mazingerZWrite(UINT16 a, UINT8 d)
|
||||||
{
|
{
|
||||||
switch (a) {
|
switch (a) {
|
||||||
default: {
|
default: {
|
||||||
|
@ -325,9 +325,9 @@ static INT32 DrvExit()
|
||||||
|
|
||||||
SekExit(); // Deallocate 68000s
|
SekExit(); // Deallocate 68000s
|
||||||
ZetExit();
|
ZetExit();
|
||||||
|
|
||||||
BurnYM2203Exit();
|
BurnYM2203Exit();
|
||||||
|
|
||||||
SoundLatch = 0;
|
SoundLatch = 0;
|
||||||
DrvZ80Bank = 0;
|
DrvZ80Bank = 0;
|
||||||
DrvOkiBank1 = 0;
|
DrvOkiBank1 = 0;
|
||||||
|
@ -338,41 +338,47 @@ static INT32 DrvExit()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT32 DrvDoReset()
|
static INT32 DrvDoReset(INT32 clear_mem)
|
||||||
{
|
{
|
||||||
|
if (clear_mem) {
|
||||||
|
memset (RamStart, 0, RamEnd - RamStart);
|
||||||
|
}
|
||||||
|
|
||||||
SekOpen(0);
|
SekOpen(0);
|
||||||
SekReset();
|
SekReset();
|
||||||
SekRun(10000); // Need to run for a bit and reset to make it start - Watchdog would force reset?
|
|
||||||
SekReset();
|
|
||||||
SekClose();
|
SekClose();
|
||||||
|
|
||||||
ZetOpen(0);
|
ZetOpen(0);
|
||||||
ZetReset();
|
ZetReset();
|
||||||
ZetClose();
|
|
||||||
|
|
||||||
BurnYM2203Reset();
|
BurnYM2203Reset();
|
||||||
|
ZetClose();
|
||||||
|
|
||||||
MSM6295Reset(0);
|
MSM6295Reset(0);
|
||||||
|
|
||||||
EEPROMReset();
|
EEPROMReset();
|
||||||
|
|
||||||
|
BurnWatchdogResetEnable();
|
||||||
|
|
||||||
|
HiscoreReset();
|
||||||
|
|
||||||
nVideoIRQ = 1;
|
nVideoIRQ = 1;
|
||||||
nSoundIRQ = 1;
|
nSoundIRQ = 1;
|
||||||
nUnknownIRQ = 1;
|
nUnknownIRQ = 1;
|
||||||
|
|
||||||
nIRQPending = 0;
|
nIRQPending = 0;
|
||||||
|
|
||||||
SoundLatch = 0;
|
SoundLatch = 0;
|
||||||
DrvZ80Bank = 0;
|
DrvZ80Bank = 0;
|
||||||
DrvOkiBank1 = 0;
|
DrvOkiBank1 = 0;
|
||||||
DrvOkiBank2 = 0;
|
DrvOkiBank2 = 0;
|
||||||
|
|
||||||
SoundLatch = 0;
|
SoundLatch = 0;
|
||||||
SoundLatchStatus = 0x0C;
|
SoundLatchStatus = 0x0C;
|
||||||
|
|
||||||
memset(SoundLatchReply, 0, sizeof(SoundLatchReply));
|
memset(SoundLatchReply, 0, sizeof(SoundLatchReply));
|
||||||
SoundLatchReplyIndex = 0;
|
SoundLatchReplyIndex = 0;
|
||||||
SoundLatchReplyMax = -1;
|
SoundLatchReplyMax = -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,13 +409,13 @@ inline static INT32 CheckSleep(INT32)
|
||||||
static INT32 DrvFrame()
|
static INT32 DrvFrame()
|
||||||
{
|
{
|
||||||
INT32 nCyclesVBlank;
|
INT32 nCyclesVBlank;
|
||||||
|
|
||||||
INT32 nInterleave = 80;
|
INT32 nInterleave = 80;
|
||||||
|
|
||||||
INT32 nCyclesSegment;
|
INT32 nCyclesSegment;
|
||||||
|
|
||||||
|
BurnWatchdogUpdate();
|
||||||
|
|
||||||
if (DrvReset) { // Reset machine
|
if (DrvReset) { // Reset machine
|
||||||
DrvDoReset();
|
DrvDoReset(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile digital inputs
|
// Compile digital inputs
|
||||||
|
@ -424,10 +430,10 @@ static INT32 DrvFrame()
|
||||||
|
|
||||||
SekNewFrame();
|
SekNewFrame();
|
||||||
ZetNewFrame();
|
ZetNewFrame();
|
||||||
|
|
||||||
SekOpen(0);
|
SekOpen(0);
|
||||||
ZetOpen(0);
|
ZetOpen(0);
|
||||||
|
|
||||||
nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE));
|
nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE));
|
||||||
nCyclesTotal[1] = (INT32)(4000000 / CAVE_REFRESHRATE);
|
nCyclesTotal[1] = (INT32)(4000000 / CAVE_REFRESHRATE);
|
||||||
nCyclesDone[0] = nCyclesDone[1] = 0;
|
nCyclesDone[0] = nCyclesDone[1] = 0;
|
||||||
|
@ -455,7 +461,7 @@ static INT32 DrvFrame()
|
||||||
if (pBurnDraw != NULL) {
|
if (pBurnDraw != NULL) {
|
||||||
DrvDraw(); // Draw screen if needed
|
DrvDraw(); // Draw screen if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
CaveSpriteBuffer();
|
CaveSpriteBuffer();
|
||||||
UINT8 Temp = nCaveSpriteBank;
|
UINT8 Temp = nCaveSpriteBank;
|
||||||
nCaveSpriteBank = nCaveSpriteBankDelay;
|
nCaveSpriteBank = nCaveSpriteBankDelay;
|
||||||
|
@ -466,26 +472,26 @@ static INT32 DrvFrame()
|
||||||
nUnknownIRQ = 0;
|
nUnknownIRQ = 0;
|
||||||
UpdateIRQStatus();
|
UpdateIRQStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
|
nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
|
||||||
if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting
|
if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting
|
||||||
nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
|
nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
|
||||||
} else {
|
} else {
|
||||||
nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment);
|
nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment);
|
||||||
}
|
}
|
||||||
|
|
||||||
BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave));
|
BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave));
|
||||||
}
|
}
|
||||||
|
|
||||||
SekClose();
|
SekClose();
|
||||||
|
|
||||||
BurnTimerEndFrame(nCyclesTotal[1]);
|
BurnTimerEndFrame(nCyclesTotal[1]);
|
||||||
|
|
||||||
if (pBurnSoundOut) {
|
if (pBurnSoundOut) {
|
||||||
BurnYM2203Update(pBurnSoundOut, nBurnSoundLen);
|
BurnYM2203Update(pBurnSoundOut, nBurnSoundLen);
|
||||||
MSM6295Render(0, pBurnSoundOut, nBurnSoundLen);
|
MSM6295Render(0, pBurnSoundOut, nBurnSoundLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZetClose();
|
ZetClose();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -547,7 +553,7 @@ static INT32 LoadRoms()
|
||||||
{
|
{
|
||||||
BurnLoadRom(Rom01 + 0x00000, 0, 1);
|
BurnLoadRom(Rom01 + 0x00000, 0, 1);
|
||||||
BurnLoadRom(Rom01 + 0x80000, 1, 1);
|
BurnLoadRom(Rom01 + 0x80000, 1, 1);
|
||||||
|
|
||||||
BurnLoadRom(RomZ80, 2, 1);
|
BurnLoadRom(RomZ80, 2, 1);
|
||||||
|
|
||||||
UINT8 *pTemp = (UINT8*)BurnMalloc(0x400000);
|
UINT8 *pTemp = (UINT8*)BurnMalloc(0x400000);
|
||||||
|
@ -561,7 +567,7 @@ static INT32 LoadRoms()
|
||||||
|
|
||||||
BurnLoadRom(CaveTileROM[0], 5, 1);
|
BurnLoadRom(CaveTileROM[0], 5, 1);
|
||||||
NibbleSwap2(CaveTileROM[0], 0x200000);
|
NibbleSwap2(CaveTileROM[0], 0x200000);
|
||||||
|
|
||||||
pTemp = (UINT8*)BurnMalloc(0x200000);
|
pTemp = (UINT8*)BurnMalloc(0x200000);
|
||||||
BurnLoadRom(pTemp, 6, 1);
|
BurnLoadRom(pTemp, 6, 1);
|
||||||
for (INT32 i = 0; i < 0x0100000; i++) {
|
for (INT32 i = 0; i < 0x0100000; i++) {
|
||||||
|
@ -572,7 +578,7 @@ static INT32 LoadRoms()
|
||||||
|
|
||||||
// Load MSM6295 ADPCM data
|
// Load MSM6295 ADPCM data
|
||||||
BurnLoadRom(MSM6295ROMSrc, 7, 1);
|
BurnLoadRom(MSM6295ROMSrc, 7, 1);
|
||||||
|
|
||||||
BurnLoadRom(DefEEPROM, 8, 1);
|
BurnLoadRom(DefEEPROM, 8, 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -591,7 +597,7 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
|
||||||
|
|
||||||
if (nAction & ACB_VOLATILE) { // Scan volatile ram
|
if (nAction & ACB_VOLATILE) { // Scan volatile ram
|
||||||
memset(&ba, 0, sizeof(ba));
|
memset(&ba, 0, sizeof(ba));
|
||||||
ba.Data = RamStart;
|
ba.Data = RamStart;
|
||||||
ba.nLen = RamEnd - RamStart;
|
ba.nLen = RamEnd - RamStart;
|
||||||
ba.szName = "RAM";
|
ba.szName = "RAM";
|
||||||
BurnAcb(&ba);
|
BurnAcb(&ba);
|
||||||
|
@ -614,13 +620,14 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
|
||||||
SCAN_VAR(DrvZ80Bank);
|
SCAN_VAR(DrvZ80Bank);
|
||||||
SCAN_VAR(DrvOkiBank1);
|
SCAN_VAR(DrvOkiBank1);
|
||||||
SCAN_VAR(DrvOkiBank2);
|
SCAN_VAR(DrvOkiBank2);
|
||||||
|
|
||||||
|
BurnWatchdogScan(nAction);
|
||||||
|
|
||||||
if (nAction & ACB_WRITE) {
|
if (nAction & ACB_WRITE) {
|
||||||
ZetOpen(0);
|
ZetOpen(0);
|
||||||
ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000));
|
ZetMapMemory(RomZ80 + (DrvZ80Bank * 0x4000), 0x4000, 0x7FFF, MAP_ROM);
|
||||||
ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000));
|
|
||||||
ZetClose();
|
ZetClose();
|
||||||
|
|
||||||
memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000);
|
memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000);
|
||||||
memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000);
|
memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000);
|
||||||
|
|
||||||
|
@ -633,11 +640,7 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
|
||||||
|
|
||||||
static void DrvFMIRQHandler(INT32, INT32 nStatus)
|
static void DrvFMIRQHandler(INT32, INT32 nStatus)
|
||||||
{
|
{
|
||||||
if (nStatus & 1) {
|
ZetSetIRQLine(0, (nStatus) ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
|
||||||
ZetSetIRQLine(0xff, CPU_IRQSTATUS_ACK);
|
|
||||||
} else {
|
|
||||||
ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT32 drvZInit()
|
static INT32 drvZInit()
|
||||||
|
@ -650,19 +653,12 @@ static INT32 drvZInit()
|
||||||
ZetSetWriteHandler(mazingerZWrite);
|
ZetSetWriteHandler(mazingerZWrite);
|
||||||
|
|
||||||
// ROM bank 1
|
// ROM bank 1
|
||||||
ZetMapArea (0x0000, 0x3FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM
|
ZetMapMemory(RomZ80 + 0x0000, 0x0000, 0x3FFF, MAP_ROM);
|
||||||
ZetMapArea (0x0000, 0x3FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM
|
|
||||||
// ROM bank 2
|
// ROM bank 2
|
||||||
ZetMapArea (0x4000, 0x7FFF, 0, RomZ80 + 0x4000); // Direct Read from ROM
|
ZetMapMemory(RomZ80 + 0x4000, 0x4000, 0x7FFF, MAP_ROM);
|
||||||
ZetMapArea (0x4000, 0x7FFF, 2, RomZ80 + 0x4000); //
|
|
||||||
// RAM
|
// RAM
|
||||||
ZetMapArea (0xc000, 0xc7FF, 0, RamZ80 + 0x0000); // Direct Read from RAM
|
ZetMapMemory(RamZ80 + 0x0000, 0xc000, 0xc7FF, MAP_RAM);
|
||||||
ZetMapArea (0xc000, 0xc7FF, 1, RamZ80 + 0x0000); // Direct Write to RAM
|
ZetMapMemory(RamZ80 + 0x0800, 0xf800, 0xffFF, MAP_RAM);
|
||||||
ZetMapArea (0xc000, 0xc7FF, 2, RamZ80 + 0x0000); //
|
|
||||||
|
|
||||||
ZetMapArea (0xf800, 0xffFF, 0, RamZ80 + 0x0800); // Direct Read from RAM
|
|
||||||
ZetMapArea (0xf800, 0xffFF, 1, RamZ80 + 0x0800); // Direct Write to RAM
|
|
||||||
ZetMapArea (0xf800, 0xffFF, 2, RamZ80 + 0x0800); //
|
|
||||||
ZetClose();
|
ZetClose();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -711,12 +707,12 @@ static INT32 DrvInit()
|
||||||
SekSetWriteByteHandler(0, mazingerWriteByte);
|
SekSetWriteByteHandler(0, mazingerWriteByte);
|
||||||
SekSetReadWordHandler(0, mazingerReadWord);
|
SekSetReadWordHandler(0, mazingerReadWord);
|
||||||
SekSetWriteWordHandler(0, mazingerWriteWord);
|
SekSetWriteWordHandler(0, mazingerWriteWord);
|
||||||
|
|
||||||
SekSetWriteWordHandler(1, mazingerWriteWordPalette);
|
SekSetWriteWordHandler(1, mazingerWriteWordPalette);
|
||||||
SekSetWriteByteHandler(1, mazingerWriteBytePalette);
|
SekSetWriteByteHandler(1, mazingerWriteBytePalette);
|
||||||
SekClose();
|
SekClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
drvZInit();
|
drvZInit();
|
||||||
|
|
||||||
CavePalInit(0x8000);
|
CavePalInit(0x8000);
|
||||||
|
@ -724,24 +720,26 @@ static INT32 DrvInit()
|
||||||
CaveSpriteInit(2, 0x0800000);
|
CaveSpriteInit(2, 0x0800000);
|
||||||
CaveTileInitLayer(0, 0x400000, 8, 0x0000);
|
CaveTileInitLayer(0, 0x400000, 8, 0x0000);
|
||||||
CaveTileInitLayer(1, 0x400000, 6, 0x4400);
|
CaveTileInitLayer(1, 0x400000, 6, 0x4400);
|
||||||
|
|
||||||
|
BurnWatchdogInit(DrvDoReset, 180 /*NOT REALLY*/);
|
||||||
|
|
||||||
BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, 0);
|
BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, 0);
|
||||||
BurnTimerAttachZet(4000000);
|
BurnTimerAttachZet(4000000);
|
||||||
BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH);
|
BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH);
|
||||||
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH);
|
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH);
|
||||||
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH);
|
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH);
|
||||||
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH);
|
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH);
|
||||||
|
|
||||||
memcpy(MSM6295ROM, MSM6295ROMSrc, 0x40000);
|
memcpy(MSM6295ROM, MSM6295ROMSrc, 0x40000);
|
||||||
MSM6295Init(0, 1056000 / 132, 1);
|
MSM6295Init(0, 1056000 / 132, 1);
|
||||||
MSM6295SetRoute(0, 2.00, BURN_SND_ROUTE_BOTH);
|
MSM6295SetRoute(0, 2.00, BURN_SND_ROUTE_BOTH);
|
||||||
|
|
||||||
EEPROMInit(&eeprom_interface_93C46);
|
EEPROMInit(&eeprom_interface_93C46);
|
||||||
if (!EEPROMAvailable()) EEPROMFill(DefEEPROM,0, 0x80);
|
if (!EEPROMAvailable()) EEPROMFill(DefEEPROM, 0, 0x80);
|
||||||
|
|
||||||
bDrawScreen = true;
|
bDrawScreen = true;
|
||||||
|
|
||||||
DrvDoReset(); // Reset machine
|
DrvDoReset(1); // Reset machine
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -750,7 +748,7 @@ static INT32 DrvInit()
|
||||||
static struct BurnRomInfo mazingerRomDesc[] = {
|
static struct BurnRomInfo mazingerRomDesc[] = {
|
||||||
{ "mzp-0.u24", 0x080000, 0x43a4279f, BRF_ESS | BRF_PRG }, // 0 CPU #0 code
|
{ "mzp-0.u24", 0x080000, 0x43a4279f, BRF_ESS | BRF_PRG }, // 0 CPU #0 code
|
||||||
{ "mzp-1.924", 0x080000, 0xdb40acba, BRF_ESS | BRF_PRG }, // 1
|
{ "mzp-1.924", 0x080000, 0xdb40acba, BRF_ESS | BRF_PRG }, // 1
|
||||||
|
|
||||||
{ "mzs.u21", 0x020000, 0xc5b4f7ed, BRF_ESS | BRF_PRG }, // 2 Z80 Code
|
{ "mzs.u21", 0x020000, 0xc5b4f7ed, BRF_ESS | BRF_PRG }, // 2 Z80 Code
|
||||||
|
|
||||||
{ "bp943a-2.u56", 0x200000, 0x97e13959, BRF_GRA }, // 3 Sprite data
|
{ "bp943a-2.u56", 0x200000, 0x97e13959, BRF_GRA }, // 3 Sprite data
|
||||||
|
@ -760,7 +758,7 @@ static struct BurnRomInfo mazingerRomDesc[] = {
|
||||||
{ "bp943a-0.u63", 0x200000, 0xc1fed98a, BRF_GRA }, // 6 Layer 1 Tile data
|
{ "bp943a-0.u63", 0x200000, 0xc1fed98a, BRF_GRA }, // 6 Layer 1 Tile data
|
||||||
|
|
||||||
{ "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data
|
{ "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data
|
||||||
|
|
||||||
{ "mazinger_world.nv", 0x0080, 0x4f6225c6, BRF_ESS | BRF_PRG },
|
{ "mazinger_world.nv", 0x0080, 0x4f6225c6, BRF_ESS | BRF_PRG },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -771,7 +769,7 @@ STD_ROM_FN(mazinger)
|
||||||
static struct BurnRomInfo mazingerjRomDesc[] = {
|
static struct BurnRomInfo mazingerjRomDesc[] = {
|
||||||
{ "mzp-0.u24", 0x080000, 0x43a4279f, BRF_ESS | BRF_PRG }, // 0 CPU #0 code
|
{ "mzp-0.u24", 0x080000, 0x43a4279f, BRF_ESS | BRF_PRG }, // 0 CPU #0 code
|
||||||
{ "mzp-1.924", 0x080000, 0xdb40acba, BRF_ESS | BRF_PRG }, // 1
|
{ "mzp-1.924", 0x080000, 0xdb40acba, BRF_ESS | BRF_PRG }, // 1
|
||||||
|
|
||||||
{ "mzs.u21", 0x020000, 0xc5b4f7ed, BRF_ESS | BRF_PRG }, // 2 Z80 Code
|
{ "mzs.u21", 0x020000, 0xc5b4f7ed, BRF_ESS | BRF_PRG }, // 2 Z80 Code
|
||||||
|
|
||||||
{ "bp943a-2.u56", 0x200000, 0x97e13959, BRF_GRA }, // 3 Sprite data
|
{ "bp943a-2.u56", 0x200000, 0x97e13959, BRF_GRA }, // 3 Sprite data
|
||||||
|
@ -781,7 +779,7 @@ static struct BurnRomInfo mazingerjRomDesc[] = {
|
||||||
{ "bp943a-0.u63", 0x200000, 0xc1fed98a, BRF_GRA }, // 6 Layer 1 Tile data
|
{ "bp943a-0.u63", 0x200000, 0xc1fed98a, BRF_GRA }, // 6 Layer 1 Tile data
|
||||||
|
|
||||||
{ "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data
|
{ "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data
|
||||||
|
|
||||||
{ "mazinger_japan.nv", 0x0080, 0xf84a2a45, BRF_ESS | BRF_PRG },
|
{ "mazinger_japan.nv", 0x0080, 0xf84a2a45, BRF_ESS | BRF_PRG },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -793,7 +791,7 @@ struct BurnDriver BurnDrvmazinger = {
|
||||||
"mazinger", NULL, NULL, NULL, "1994",
|
"mazinger", NULL, NULL, NULL, "1994",
|
||||||
"Mazinger Z (World, ver. 94/06/27)\0", NULL, "Banpresto / Dynamic Pl. Toei Animation", "Cave",
|
"Mazinger Z (World, ver. 94/06/27)\0", NULL, "Banpresto / Dynamic Pl. Toei Animation", "Cave",
|
||||||
L"Mazinger Z\0\u30DE\u30B8\u30F3\u30AC\u30FC \uFF3A (World, ver. 94/06/27)\0", NULL, NULL, NULL,
|
L"Mazinger Z\0\u30DE\u30B8\u30F3\u30AC\u30FC \uFF3A (World, ver. 94/06/27)\0", NULL, NULL, NULL,
|
||||||
BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL |BDF_ORIENTATION_FLIPPED | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0,
|
BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_16BIT_ONLY | BDF_HISCORE_SUPPORTED, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0,
|
||||||
NULL, mazingerRomInfo, mazingerRomName, NULL, NULL, mazingerInputInfo, NULL,
|
NULL, mazingerRomInfo, mazingerRomName, NULL, NULL, mazingerInputInfo, NULL,
|
||||||
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
|
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
|
||||||
&CaveRecalcPalette, 0x8000, 240, 384, 3, 4
|
&CaveRecalcPalette, 0x8000, 240, 384, 3, 4
|
||||||
|
@ -803,7 +801,7 @@ struct BurnDriver BurnDrvmazingerj = {
|
||||||
"mazingerj", "mazinger", NULL, NULL, "1994",
|
"mazingerj", "mazinger", NULL, NULL, "1994",
|
||||||
"Mazinger Z (Japan, ver. 94/06/27)\0", NULL, "Banpresto / Dynamic Pl. Toei Animation", "Cave",
|
"Mazinger Z (Japan, ver. 94/06/27)\0", NULL, "Banpresto / Dynamic Pl. Toei Animation", "Cave",
|
||||||
L"Mazinger Z\0\u30DE\u30B8\u30F3\u30AC\u30FC \uFF3A (Japan, ver. 94/06/27)\0", NULL, NULL, NULL,
|
L"Mazinger Z\0\u30DE\u30B8\u30F3\u30AC\u30FC \uFF3A (Japan, ver. 94/06/27)\0", NULL, NULL, NULL,
|
||||||
BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL |BDF_ORIENTATION_FLIPPED | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0,
|
BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_16BIT_ONLY | BDF_HISCORE_SUPPORTED, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0,
|
||||||
NULL, mazingerjRomInfo, mazingerjRomName, NULL, NULL, mazingerInputInfo, NULL,
|
NULL, mazingerjRomInfo, mazingerjRomName, NULL, NULL, mazingerInputInfo, NULL,
|
||||||
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
|
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
|
||||||
&CaveRecalcPalette, 0x8000, 240, 384, 3, 4
|
&CaveRecalcPalette, 0x8000, 240, 384, 3, 4
|
||||||
|
|
Loading…
Reference in New Issue