Tidied Toaplan drivers

This commit is contained in:
Barry Harris 2011-12-13 16:10:31 +00:00
parent 89b8c63833
commit a1dfaf99ee
26 changed files with 222 additions and 388 deletions

View File

@ -714,7 +714,7 @@ static INT32 drvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8*)0;
if ((Mem = (UINT8*)malloc(nLen)) == NULL) {
if ((Mem = (UINT8*)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // Zero memory
@ -776,18 +776,14 @@ static INT32 drvInit()
nTextROMStatus = -1;
bDrawScreen = true;
#if defined FBA_DEBUG && defined USE_SPEEDHACKS
bprintf(PRINT_IMPORTANT, _T(" * Using speed-hacks (detecting idle loops).\n"));
#endif
drvDoReset(); // Reset machine
return 0;
}
static INT32 drvExit()
{
MSM6295Exit(1);
MSM6295Exit(0);
MSM6295Exit(1);
BurnYM2151Exit();
ToaPalExit();
@ -796,28 +792,13 @@ static INT32 drvExit()
ToaZExit(); // Z80 exit
SekExit(); // Deallocate 68000
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
inline static INT32 CheckSleep(INT32)
{
#if 1 && defined USE_SPEEDHACKS
INT32 nCurrentPC = SekGetPC(-1);
if (!nIRQPending &&
((nCurrentPC >= 0x0009F4 && nCurrentPC <= 0x0009FA) ||
(nCurrentPC >= 0x001FF6 && nCurrentPC <= 0x001FFC) ||
(nCurrentPC >= 0x003C7C && nCurrentPC <= 0x003C82)))
{
return 1;
}
#endif
return 0;
}
@ -862,6 +843,8 @@ static INT32 drvFrame()
nCyclesTotal[1] = TOA_Z80_SPEED / 60;
nCyclesDone[0] = nCyclesDone[1] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
@ -869,7 +852,6 @@ static INT32 drvFrame()
INT32 nSoundBufferPos = 0;
SekOpen(0);
ZetOpen(0);
for (INT32 i = 1; i <= nInterleave; i++) {
INT32 nCurrentCPU;

View File

@ -483,7 +483,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -536,10 +536,6 @@ static INT32 DrvInit()
bDrawScreen = true;
#if defined FBA_DEBUG && defined USE_SPEEDHACKS
bprintf(PRINT_IMPORTANT, _T(" * Using speed-hacks (detecting idle loops).\n"));
#endif
DrvDoReset(); // Reset machine
return 0;
@ -549,17 +545,14 @@ static INT32 DrvExit()
{
ToaPalExit();
BurnYM2151Exit();
MSM6295Exit(0);
ToaExitGP9001();
SekExit(); // Deallocate 68000s
VezExit();
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
MSM6295ROM = NULL;
@ -582,11 +575,7 @@ static INT32 DrvDraw()
inline static INT32 CheckSleep(INT32)
{
if (SekGetPC(-1) >= 0x94BC && SekGetPC(-1) <= 0x94D0) {
return 1;
} else {
return 0;
}
return 0;
}
static INT32 DrvFrame()
@ -618,12 +607,13 @@ static INT32 DrvFrame()
nCyclesDone[0] = 0;
nCyclesDone[1] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
bVBlank = false;
SekOpen(0);
VezOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
@ -665,6 +655,14 @@ static INT32 DrvFrame()
} else {
nCyclesDone[1] += VezRun(nCyclesTotal[1] / nInterleave);
}
if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen / nInterleave;
INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
BurnYM2151Render(pSoundBuf, nSegmentLength);
MSM6295Render(0, pSoundBuf, nSegmentLength);
nSoundBufferPos += nSegmentLength;
}
}
if (pBurnSoundOut) {

View File

@ -17,8 +17,6 @@ static INT32 nSoundCommand;
// Z80 ROM bank
static INT32 nCurrentBank;
static INT32 nSpeedHackOffset;
// Rom information
static struct BurnRomInfo bgareggaRomDesc[] = {
{ "prg0.bin", 0x080000, 0xF80C2FC2, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even)
@ -674,7 +672,7 @@ static INT32 battlegInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -732,15 +730,6 @@ static INT32 battlegInit()
// mar 2 1996 & apr 2 1996 ver: 0x0009AC - 0x0009B8 & 0x001F5E - 0x001F64 & 0x003A1C - 0x003A22
// feb 2 1996 ver: 0x0009AC - 0x0009B8 & 0x001F2E - 0x001F34 & 0x0039EC - 0x0039F2
nSpeedHackOffset = 0;
if (strcmp(BurnDrvGetTextA(DRV_NAME), "bgaregga") == 0) {
nSpeedHackOffset = 0x30;
}
#if defined FBA_DEBUG && defined USE_SPEEDHACKS
bprintf(PRINT_IMPORTANT, _T(" * Using speed-hacks (detecting idle loops).\n"));
#endif
DrvDoReset(); // Reset machine
return 0;
}
@ -756,11 +745,7 @@ static INT32 DrvExit()
ToaZExit(); // Z80 exit
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -782,23 +767,6 @@ static INT32 DrvDraw()
inline static INT32 CheckSleep(INT32)
{
#if 1 && defined USE_SPEEDHACKS
INT32 nCurrentPC = SekGetPC(-1);
if (!nIRQPending && nCurrentPC >= 0x0009AC && nCurrentPC <= 0x0009B8) {
return 1;
}
nCurrentPC += nSpeedHackOffset;
if (!nIRQPending &&
((nCurrentPC >= 0x001F5E && nCurrentPC <= 0x001F64) ||
(nCurrentPC >= 0x003A1C && nCurrentPC <= 0x003A22)))
{
return 1;
}
#endif
return 0;
}
@ -828,6 +796,8 @@ static INT32 DrvFrame()
nCyclesTotal[1] = TOA_Z80_SPEED / 60;
nCyclesDone[0] = nCyclesDone[1] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
@ -835,7 +805,6 @@ static INT32 DrvFrame()
INT32 nSoundBufferPos = 0;
SekOpen(0);
ZetOpen(0);
for (INT32 i = 1; i <= nInterleave; i++) {
INT32 nCurrentCPU;

View File

@ -7,46 +7,13 @@
// #define ADJUST_Z80_SPEED
static const UINT8 bbakraid_unlimited_nvram[512] = {
0xc2,0x49,0x00,0x07,0xa1,0x20,0x2a,0x2a,0x2a,0x90,0x90,0x90,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x06,0x1a,0x80,0x2a,0x2a,0x2a,0x94,
0x94,0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,
0x93,0xe0,0x2a,0x2a,0x2a,0x98,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x00,0x03,0x0d,0x40,0x2a,0x2a,0x2a,0x9c,0x9c,0x9c,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x86,0xa0,0x2a,0x2a,
0x2a,0xa0,0xa0,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x00,0x07,0xa1,0x20,0x2b,0x2b,0x2b,0x90,0x90,0x90,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x06,0x1a,0x80,0x2b,0x2b,0x2b,0x94,0x94,0x94,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,0x93,0xe0,
0x2b,0x2b,0x2b,0x98,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x02,0x00,0x03,0x0d,0x40,0x2b,0x2b,0x2b,0x9c,0x9c,0x9c,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x86,0xa0,0x2b,0x2b,0x2b,0xa0,
0xa0,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x07,
0xa1,0x20,0x23,0x23,0x23,0x90,0x90,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x00,0x06,0x1a,0x80,0x23,0x23,0x23,0x94,0x94,0x94,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,0x93,0xe0,0x23,0x23,
0x23,0x98,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x00,0x03,0x0d,0x40,0x23,0x23,0x23,0x9c,0x9c,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x86,0xa0,0x23,0x23,0x23,0xa0,0xa0,0xa0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x07,0xa1,0x20,
0x3f,0x3f,0x3f,0x90,0x90,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x02,0x00,0x06,0x1a,0x80,0x3f,0x3f,0x3f,0x94,0x94,0x94,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,0x93,0xe0,0x3f,0x3f,0x3f,0x98,
0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x03,
0x0d,0x40,0x3f,0x3f,0x3f,0x9c,0x9c,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x00,0x01,0x86,0xa0,0x3f,0x3f,0x3f,0xa0,0xa0,0xa0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,0xc2,0x49,0xc2,0x49,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0xcf,0x00,0x04,0x00,0x00,0x21,0xd5,
0x00,0x05,0x06,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xc2,0x49
};
static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0};
static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0};
static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0};
static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static UINT8 *DefaultEEPROM = NULL;
static UINT8 DrvRegion = 0;
static UINT8 DrvReset = 0;
@ -369,6 +336,7 @@ static INT32 MemIndex()
RomZ80 = Next; Next += 0x020000; // Z80 ROM
GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data
YMZ280BROM = Next; Next += 0xC00000;
DefaultEEPROM = Next; Next += 0x000200;
RamStart = Next;
ExtraTROM = Next; Next += 0x008000; // Extra Text layer tile data
ExtraTRAM = Next; Next += 0x002000; // Extra tile layer
@ -440,6 +408,8 @@ static INT32 LoadRoms()
BurnLoadRom(YMZ280BROM + 0x400000, 10, 1);
BurnLoadRom(YMZ280BROM + 0x800000, 11, 1);
BurnLoadRom(DefaultEEPROM, 12, 1);
return 0;
}
@ -759,13 +729,13 @@ static INT32 DrvDoReset()
{
// Insert region code into 68K ROM, code by BisonSAS
UINT8 nRegion = DrvRegion & 0x1F;
if (nRegion<=25) {
Rom01[0x00000^1]=(UINT8)(nRegion<<13) | (DrvRegion & 0x1F);
}
if (nRegion<=25) {
Rom01[0x00000^1]=(UINT8)(nRegion<<13) | (DrvRegion & 0x1F);
}
SekOpen(0);
nIRQPending = 0;
SekSetIRQLine(0, SEK_IRQSTATUS_NONE);
SekSetIRQLine(0, SEK_IRQSTATUS_NONE);
SekReset();
SekClose();
@ -781,11 +751,13 @@ static INT32 DrvDoReset()
nSoundlatchAck = 0;
YMZ280BReset();
nCyclesDone[0] = nCyclesDone[1] = 0;
BurnTimerReset();
ZetOpen(0);
BurnTimerSetRetrig(0, 1.0 / 445.0);
ZetClose();
return 0;
}
@ -817,11 +789,16 @@ static INT32 bbakraidInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
MemIndex(); // Index the allocated memory
// Load the roms into memory
if (LoadRoms()) {
return 1;
}
EEPROMInit(&eeprom_interface_93C66);
@ -834,16 +811,12 @@ static INT32 bbakraidInit()
bBurnUseASMCPUEmulation = false;
}
if (strcmp("bbakraid", BurnDrvGetTextA(DRV_NAME)) == 0 || strcmp("bbakraidj", BurnDrvGetTextA(DRV_NAME)) == 0) {
if (!EEPROMAvailable()) EEPROMFill(bbakraid_unlimited_nvram, 0, sizeof(bbakraid_unlimited_nvram));
}
// if (strcmp("bbakraid", BurnDrvGetTextA(DRV_NAME)) == 0 || strcmp("bbakraidj", BurnDrvGetTextA(DRV_NAME)) == 0) {
// if (!EEPROMAvailable()) EEPROMFill(bbakraid_unlimited_nvram, 0, sizeof(bbakraid_unlimited_nvram));
// }
if (!EEPROMAvailable()) EEPROMFill(DefaultEEPROM, 0, 0x200);
// Load the roms into memory
if (LoadRoms()) {
return 1;
}
{
SekInit(0, 0x68000); // Allocate 68000
SekOpen(0);
@ -897,10 +870,6 @@ static INT32 bbakraidInit()
nTextROMStatus = -1;
bDrawScreen = true;
#if defined FBA_DEBUG && defined USE_SPEEDHACKS
bprintf(PRINT_IMPORTANT, _T(" * Using speed-hacks (detecting idle loops).\n"));
#endif
DrvDoReset(); // Reset machine
return 0;
@ -926,11 +895,7 @@ static INT32 DrvExit()
bBurnUseASMCPUEmulation = true;
}
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -952,17 +917,6 @@ static INT32 DrvDraw()
inline static INT32 CheckSleep(INT32)
{
#if 0 && defined USE_SPEEDHACKS
INT32 nCurrentPC = SekGetPC(-1);
if (!nIRQPending &&
((nCurrentPC >= 0x000A42 && nCurrentPC <= 0x000A48) ||
(nCurrentPC >= 0x001FF0 && nCurrentPC <= 0x001FF6)))
{
return 1;
}
#endif
return 0;
}
@ -995,6 +949,9 @@ static INT32 DrvFrame()
#else
nCyclesTotal[1] = TOA_Z80_SPEED / 60;
#endif
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
@ -1002,7 +959,6 @@ static INT32 DrvFrame()
INT32 nSoundBufferPos = 0;
SekOpen(0);
ZetOpen(0);
SekIdle(nCyclesDone[0]);

View File

@ -329,13 +329,15 @@ void __fastcall demonwld_sound_write_port(UINT16 p, UINT8 d)
{
switch (p & 0xff)
{
case 0x00:
case 0x00: {
BurnYM3812Write(0, d);
return;
return;
}
case 0x01:
case 0x01: {
BurnYM3812Write(1, d);
return;
return;
}
case 0x40: // toaplan1_coin_w
return;
@ -442,7 +444,7 @@ static INT32 DrvInit()
AllMem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((AllMem = (UINT8 *)malloc(nLen)) == NULL) {
if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(AllMem, 0, nLen);
@ -513,13 +515,9 @@ static INT32 DrvExit()
ToaExitBCU2();
ToaZExit();
ZetExit();
SekExit();
if (AllMem) {
free(AllMem);
AllMem = NULL;
}
BurnFree(AllMem);
return 0;
}
@ -566,11 +564,11 @@ static INT32 DrvFrame()
ToaClearOpposites(&DrvInputs[0]);
ToaClearOpposites(&DrvInputs[1]);
SekOpen(0);
ZetOpen(0);
SekNewFrame();
ZetNewFrame();
SekOpen(0);
ZetOpen(0);
SekIdle(nCyclesDone[0]);
ZetIdle(nCyclesDone[1]);
@ -615,11 +613,13 @@ static INT32 DrvFrame()
} else {
SekIdle(nCyclesSegment);
}
BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave));
}
nToa1Cycles68KSync = SekTotalCycles();
BurnTimerEndFrameYM3812(nCyclesTotal[1]);
BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0];

View File

@ -561,7 +561,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -624,17 +624,14 @@ static INT32 DrvExit()
{
ToaPalExit();
BurnYM2151Exit();
MSM6295Exit(0);
ToaExitGP9001();
SekExit(); // Deallocate 68000s
VezExit();
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
MSM6295ROM = NULL;
@ -689,12 +686,13 @@ static INT32 DrvFrame()
nCyclesDone[0] = 0;
nCyclesDone[1] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
bVBlank = false;
SekOpen(0);
VezOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
@ -732,6 +730,14 @@ static INT32 DrvFrame()
} else {
nCyclesDone[1] += VezRun(nCyclesTotal[1] / nInterleave);
}
if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen / nInterleave;
INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
BurnYM2151Render(pSoundBuf, nSegmentLength);
MSM6295Render(0, pSoundBuf, nSegmentLength);
nSoundBufferPos += nSegmentLength;
}
}
if (pBurnSoundOut) {
@ -740,7 +746,6 @@ static INT32 DrvFrame()
INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
BurnYM2151Render(pSoundBuf, nSegmentLength);
MSM6295Render(0, pSoundBuf, nSegmentLength);
}
}

View File

@ -278,11 +278,7 @@ static INT32 DrvExit()
EEPROMExit();
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -333,6 +329,7 @@ inline static INT32 CheckSleep(INT32)
static INT32 DrvFrame()
{
INT32 nInterleave = 100;
INT32 nSoundBufferPos = 0;
if (DrvReset) { // Reset machine
DrvDoReset();
@ -360,12 +357,13 @@ static INT32 DrvFrame()
nCyclesDone[0] = 0;
nCyclesDone[1] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
bVBlank = false;
SekOpen(0);
VezOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
@ -407,12 +405,23 @@ static INT32 DrvFrame()
} else {
nCyclesDone[1] += VezRun(nCyclesTotal[1] / nInterleave);
}
if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen / nInterleave;
INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
BurnYM2151Render(pSoundBuf, nSegmentLength);
MSM6295Render(0, pSoundBuf, nSegmentLength);
nSoundBufferPos += nSegmentLength;
}
}
// Make sure the buffer is entirely filled.
if (pBurnSoundOut) {
BurnYM2151Render(pBurnSoundOut, nBurnSoundLen);
MSM6295Render(0, pBurnSoundOut, nBurnSoundLen);
INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
if (nSegmentLength) {
INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
BurnYM2151Render(pSoundBuf, nSegmentLength);
MSM6295Render(0, pSoundBuf, nSegmentLength);
}
}
VezClose();
@ -536,7 +545,7 @@ static INT32 DrvInit(INT32 region)
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -599,10 +608,6 @@ static INT32 DrvInit(INT32 region)
bDrawScreen = true;
#if defined FBA_DEBUG && defined USE_SPEEDHACKS
bprintf(PRINT_IMPORTANT, _T(" * Using speed-hacks (detecting idle loops).\n"));
#endif
DrvDoReset(); // Reset machine
return 0;

View File

@ -398,7 +398,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -422,7 +422,7 @@ static INT32 DrvInit()
SekClose();
}
nToa1Cycles68KSync = SekTotalCycles();
nToa1Cycles68KSync = 0;
nSpriteYOffset = 0x0001;
@ -449,11 +449,7 @@ static INT32 DrvExit()
ToaExitGP9001();
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}

View File

@ -604,7 +604,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -667,11 +667,7 @@ static INT32 DrvExit()
ToaZExit(); // Z80 exit
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
Hellfire = 0;
@ -719,11 +715,11 @@ static INT32 DrvFrame()
ToaClearOpposites(&DrvInput[0]);
ToaClearOpposites(&DrvInput[1]);
SekOpen(0);
ZetOpen(0);
SekNewFrame();
ZetNewFrame();
SekOpen(0);
ZetOpen(0);
SekIdle(nCyclesDone[0]);
ZetIdle(nCyclesDone[1]);
@ -768,11 +764,13 @@ static INT32 DrvFrame()
} else {
SekIdle(nCyclesSegment);
}
BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave));
}
nToa1Cycles68KSync = SekTotalCycles();
BurnTimerEndFrameYM3812(nCyclesTotal[1]);
BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0];
nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1];

View File

@ -411,7 +411,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -476,17 +476,14 @@ static INT32 DrvExit()
{
ToaPalExit();
BurnYM2151Exit();
MSM6295Exit(0);
ToaExitGP9001();
SekExit(); // Deallocate 68000s
VezExit();
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
MSM6295ROM = NULL;
@ -541,12 +538,13 @@ static INT32 DrvFrame()
nCyclesDone[0] = 0;
nCyclesDone[1] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
bVBlank = false;
SekOpen(0);
VezOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
@ -581,6 +579,14 @@ static INT32 DrvFrame()
}
nCyclesDone[1] += VezRun(nCyclesTotal[1] / nInterleave);
if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen / nInterleave;
INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
BurnYM2151Render(pSoundBuf, nSegmentLength);
MSM6295Render(0, pSoundBuf, nSegmentLength);
nSoundBufferPos += nSegmentLength;
}
}
if (pBurnSoundOut) {

View File

@ -377,7 +377,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -429,12 +429,11 @@ static INT32 DrvExit()
ToaExitGP9001();
SekExit(); // Deallocate 68000s
MSM6295Exit(0);
MSM6295Exit(1);
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -482,14 +481,14 @@ static INT32 DrvFrame()
nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60));
nCyclesDone[0] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
bVBlank = false;
SekOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
INT32 nCurrentCPU;
INT32 nNext;

View File

@ -208,7 +208,7 @@ static INT32 MemIndex()
RamPal = Next; Next += 0x001000; // palette
RamZ80 = Next; Next += 0x004000; // Z80 RAM
GP9001RAM[0]= Next; Next += 0x004000;
GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(INT16);
GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16);
RamEnd = Next;
ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32);
MemEnd = Next;
@ -467,7 +467,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -531,11 +531,7 @@ static INT32 DrvExit()
ToaZExit(); // Z80 exit
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -586,6 +582,8 @@ static INT32 DrvFrame()
nCyclesTotal[1] = TOA_Z80_SPEED / 60;
nCyclesDone[0] = nCyclesDone[1] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
@ -593,7 +591,6 @@ static INT32 DrvFrame()
INT32 nSoundBufferPos = 0;
SekOpen(0);
ZetOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
INT32 nCurrentCPU;

View File

@ -786,7 +786,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -849,11 +849,7 @@ static INT32 DrvExit()
ToaZExit(); // Z80 exit
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -947,11 +943,13 @@ static INT32 DrvFrame()
} else {
SekIdle(nCyclesSegment);
}
BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave));
}
nToa1Cycles68KSync = SekTotalCycles();
BurnTimerEndFrameYM3812(nCyclesTotal[1]);
BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0];
nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1];

View File

@ -343,7 +343,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -385,7 +385,7 @@ static INT32 DrvInit()
ZetClose();
}
nToa1Cycles68KSync = SekTotalCycles();
nToa1Cycles68KSync = 0;
BurnYM3812Init(3375000, &toaplan1FMIRQHandler, pipibibsSynchroniseStream, 0);
BurnTimerAttachZetYM3812(3375000);
@ -416,11 +416,7 @@ static INT32 DrvExit()
SekExit(); // Deallocate 68000s
ZetExit();
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -507,6 +503,8 @@ static INT32 DrvFrame()
} else {
SekIdle(nCyclesSegment);
}
BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave));
}
nToa1Cycles68KSync = SekTotalCycles();

View File

@ -315,7 +315,7 @@ static INT32 MemIndex()
static void DrvSpriteDecode()
{
UINT8 *tmp = (UINT8*)malloc(0x40000);
UINT8 *tmp = (UINT8*)BurnMalloc(0x40000);
if (tmp == NULL) {
return;
}
@ -329,10 +329,7 @@ static void DrvSpriteDecode()
}
}
if (tmp) {
free (tmp);
tmp = NULL;
}
BurnFree (tmp);
}
static INT32 DrvInit()
@ -352,7 +349,7 @@ static INT32 DrvInit()
AllMem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((AllMem = (UINT8 *)malloc(nLen)) == NULL) {
if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(AllMem, 0, nLen);
@ -441,13 +438,9 @@ static INT32 DrvExit()
ToaExitBCU2();
ToaZExit();
ZetExit();
SekExit();
if (AllMem) {
free(AllMem);
AllMem = NULL;
}
BurnFree(AllMem);
Rallybik = 0;
@ -491,11 +484,11 @@ static INT32 DrvFrame()
ToaClearOpposites(&DrvInputs[0]);
ToaClearOpposites(&DrvInputs[1]);
SekOpen(0);
ZetOpen(0);
SekNewFrame();
ZetNewFrame();
SekOpen(0);
ZetOpen(0);
SekIdle(nCyclesDone[0]);
ZetIdle(nCyclesDone[1]);
@ -540,11 +533,13 @@ static INT32 DrvFrame()
} else {
SekIdle(nCyclesSegment);
}
BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave));
}
nToa1Cycles68KSync = SekTotalCycles();
BurnTimerEndFrameYM3812(nCyclesTotal[1]);
BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0];

View File

@ -444,7 +444,7 @@ static INT32 DrvInit()
AllMem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((AllMem = (UINT8 *)malloc(nLen)) == NULL) {
if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(AllMem, 0, nLen);
@ -493,13 +493,9 @@ static INT32 DrvExit()
ToaPalExit();
ToaExitBCU2();
ToaZExit();
SekExit();
if (AllMem) {
free(AllMem);
AllMem = NULL;
}
BurnFree(AllMem);
return 0;
}
@ -541,9 +537,9 @@ static INT32 DrvFrame()
ToaClearOpposites(&DrvInputs[0]);
ToaClearOpposites(&DrvInputs[1]);
SekOpen(0);
SekNewFrame();
SekOpen(0);
SekIdle(nCyclesDone[0]);

View File

@ -483,7 +483,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -550,11 +550,7 @@ static INT32 DrvExit()
ToaZExit(); // Z80 exit
SekExit(); // Deallocate 68000s
// Free memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -604,6 +600,8 @@ static INT32 DrvFrame()
nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60));
nCyclesTotal[1] = TOA_Z80_SPEED / 60;
nCyclesDone[0] = nCyclesDone[1] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
@ -612,7 +610,6 @@ static INT32 DrvFrame()
INT32 nSoundBufferPos = 0;
SekOpen(0);
ZetOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
INT32 nCurrentCPU;

View File

@ -328,11 +328,8 @@ static INT32 DrvExit()
ToaExitGP9001();
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -397,6 +394,8 @@ static INT32 DrvFrame()
nCyclesTotal[0] = (int)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60));
nCyclesDone[0] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
@ -405,8 +404,6 @@ static INT32 DrvFrame()
INT32 nSoundBufferPos = 0;
SekOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
INT32 nCurrentCPU;
INT32 nNext;
@ -545,7 +542,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory

View File

@ -447,7 +447,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -500,11 +500,7 @@ static INT32 DrvExit()
ToaExitGP9001();
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -552,14 +548,14 @@ static INT32 DrvFrame()
nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * 60));
nCyclesDone[0] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
bVBlank = false;
SekOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
INT32 nCurrentCPU;
INT32 nNext;

View File

@ -492,7 +492,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -555,11 +555,7 @@ static INT32 DrvExit()
ToaZExit(); // Z80 exit
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -604,11 +600,11 @@ static INT32 DrvFrame()
ToaClearOpposites(&DrvInput[0]);
ToaClearOpposites(&DrvInput[1]);
SekOpen(0);
ZetOpen(0);
SekNewFrame();
ZetNewFrame();
SekOpen(0);
ZetOpen(0);
SekIdle(nCyclesDone[0]);
ZetIdle(nCyclesDone[1]);
@ -653,11 +649,13 @@ static INT32 DrvFrame()
} else {
SekIdle(nCyclesSegment);
}
BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave));
}
nToa1Cycles68KSync = SekTotalCycles();
BurnTimerEndFrameYM3812(nCyclesTotal[1]);
BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0];
nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1];

View File

@ -306,11 +306,7 @@ static INT32 DrvExit()
ToaExitGP9001();
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -346,14 +342,6 @@ static INT32 DrvDraw()
inline static INT32 CheckSleep(INT32)
{
#if 1 && defined USE_SPEEDHACKS
INT32 nCurrentPC = SekGetPC(-1);
if (!nIRQPending && nCurrentPC >= 0x00027E && nCurrentPC <= 0x000284) {
return 1;
}
#endif
return 0;
}
@ -381,6 +369,8 @@ static INT32 DrvFrame()
nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60));
nCyclesDone[0] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
@ -389,8 +379,6 @@ static INT32 DrvFrame()
INT32 nSoundBufferPos = 0;
SekOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
INT32 nCurrentCPU;
INT32 nNext;
@ -542,7 +530,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -591,10 +579,6 @@ static INT32 DrvInit()
bDrawScreen = true;
#if defined FBA_DEBUG && defined USE_SPEEDHACKS
bprintf(PRINT_IMPORTANT, _T(" * Using speed-hacks (detecting idle loops).\n"));
#endif
DrvDoReset(); // Reset machine
return 0;

View File

@ -458,7 +458,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -521,14 +521,11 @@ static INT32 DrvExit()
ToaPalExit();
ToaExitGP9001();
BurnYM2151Exit();
SekExit(); // Deallocate 68000s
VezExit();
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
return 0;
}
@ -581,13 +578,14 @@ static INT32 DrvFrame()
nCyclesTotal[1] = (INT32)((INT64)5000000 * nBurnCPUSpeedAdjust / (0x0100 * 60));
nCyclesDone[0] = 0;
nCyclesDone[1] = 0;
SekOpen(0);
SekSetCyclesScanline(nCyclesTotal[0] / 262);
nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262);
nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262);
bVBlank = false;
SekOpen(0);
VezOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
@ -627,6 +625,13 @@ static INT32 DrvFrame()
} else {
nCyclesDone[1] += VezRun(nCyclesTotal[1] / nInterleave);
}
if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen / nInterleave;
INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
BurnYM2151Render(pSoundBuf, nSegmentLength);
nSoundBufferPos += nSegmentLength;
}
}
if (pBurnSoundOut) {

View File

@ -408,7 +408,7 @@ static INT32 DrvInit()
AllMem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((AllMem = (UINT8 *)malloc(nLen)) == NULL) {
if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(AllMem, 0, nLen);
@ -453,13 +453,9 @@ static INT32 DrvExit()
ToaPalExit();
ToaExitBCU2();
ToaZExit();
SekExit();
if (AllMem) {
free(AllMem);
AllMem = NULL;
}
BurnFree(AllMem);
return 0;
}
@ -501,9 +497,9 @@ static INT32 DrvFrame()
ToaClearOpposites(&DrvInputs[0]);
ToaClearOpposites(&DrvInputs[1]);
SekOpen(0);
SekNewFrame();
SekOpen(0);
SekIdle(nCyclesDone[0]);

View File

@ -551,7 +551,7 @@ static INT32 DrvInit()
Mem = NULL;
MemIndex();
nLen = MemEnd - (UINT8 *)0;
if ((Mem = (UINT8 *)malloc(nLen)) == NULL) {
if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
@ -615,11 +615,7 @@ static INT32 DrvExit()
ToaZExit(); // Z80 exit
SekExit(); // Deallocate 68000s
// Deallocate all used memory
if (Mem) {
free(Mem);
Mem = NULL;
}
BurnFree(Mem);
Hellfire = 0;
@ -716,11 +712,13 @@ static INT32 DrvFrame()
} else {
SekIdle(nCyclesSegment);
}
BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave));
}
nToa1Cycles68KSync = SekTotalCycles();
BurnTimerEndFrameYM3812(nCyclesTotal[1]);
BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0];
nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1];

View File

@ -329,10 +329,10 @@ INT32 ToaInitBCU2()
nBCU2MaxTile = (nBCU2ROMSize - 1) >> 5;
nSize = 1280 * 4 * 0x10 * sizeof(ToaTile);
pBCU2TileQueueData = (ToaTile*)malloc(nSize);
pBCU2TileQueueData = (ToaTile*)BurnMalloc(nSize);
memset(pBCU2TileQueueData, 0, nSize);
BCU2TileAttrib = (UINT8*)malloc(32768);
BCU2TileAttrib = (UINT8*)BurnMalloc(32768);
memset(BCU2TileAttrib, 0, 32768);
for (UINT32 j = 0; j < (nBCU2ROMSize >> 5); j++) {
bool bTransparent = true, bSolid = true;
@ -359,12 +359,12 @@ INT32 ToaInitBCU2()
nFCU2MaxSprite = (nFCU2ROMSize - 1) >> 5;
nSize = 0x10 * 0x101 * sizeof(UINT16*);
pFCU2SpriteQueueData = (UINT16**)malloc(nSize);
pFCU2SpriteQueueData = (UINT16**)BurnMalloc(nSize);
memset(pFCU2SpriteQueueData, 0, nSize);
pFCU2SpriteBuffer = (UINT8*)malloc(0x0800);
pFCU2SpriteBuffer = (UINT8*)BurnMalloc(0x0800);
FCU2TileAttrib = (UINT8*)malloc(32768);
FCU2TileAttrib = (UINT8*)BurnMalloc(32768);
memset(FCU2TileAttrib, 0, 32768);
for (UINT32 j = 0; j < (nFCU2ROMSize >> 5); j++) {
bool bTransparent = true, bSolid = true;
@ -430,30 +430,11 @@ INT32 ToaExitBCU2()
nLayer2YOffset = 0;
nLayer3YOffset = 0;
if (pBCU2TileQueueData) {
free(pBCU2TileQueueData);
pBCU2TileQueueData = NULL;
}
if (BCU2TileAttrib) {
free(BCU2TileAttrib);
BCU2TileAttrib = NULL;
}
if (pFCU2SpriteQueueData) {
free(pFCU2SpriteQueueData);
pFCU2SpriteQueueData = NULL;
}
if (pFCU2SpriteBuffer) {
free(pFCU2SpriteBuffer);
pFCU2SpriteBuffer = NULL;
}
if (FCU2TileAttrib) {
free(FCU2TileAttrib);
FCU2TileAttrib = NULL;
}
BurnFree(pBCU2TileQueueData);
BurnFree(BCU2TileAttrib);
BurnFree(pFCU2SpriteQueueData);
BurnFree(pFCU2SpriteBuffer);
BurnFree(FCU2TileAttrib);
return 0;
}

View File

@ -488,18 +488,18 @@ INT32 ToaInitGP9001(INT32 n)
nMaxSprite[i] = (nGP9001ROMSize[i] - 1) >> 5;
nSize = 512 * 3 * 0x10 * 2 * sizeof(INT32);
pTileQueueData[i] = (UINT32*)malloc(nSize);
pTileQueueData[i] = (UINT32*)BurnMalloc(nSize);
memset(pTileQueueData[i], 0, nSize);
nSize = 0x10 * 0x101 * sizeof(UINT8*);
pSpriteQueueData[i] = (UINT8**)malloc(nSize);
pSpriteQueueData[i] = (UINT8**)BurnMalloc(nSize);
memset(pSpriteQueueData[i], 0, nSize);
nSize = 0x0800 * 2;
pSpriteBufferData[i] = (UINT8*)malloc(nSize);
pSpriteBufferData[i] = (UINT8*)BurnMalloc(nSize);
memset(pSpriteBufferData[i], 0, nSize);
GP9001TileAttrib[i] = (UINT8*)malloc(nGP9001ROMSize[i] >> 5);
GP9001TileAttrib[i] = (UINT8*)BurnMalloc(nGP9001ROMSize[i] >> 5);
for (UINT32 j = 0; j < (nGP9001ROMSize[i] >> 5); j++) {
bool bTransparent = true, bSolid = true;
INT32 nTwoPixels;
@ -583,26 +583,10 @@ INT32 ToaExitGP9001()
nLayer2YOffset = 0;
for (INT32 i = 0; i < nControllers; i++) {
if (pSpriteBufferData[i]) {
free(pSpriteBufferData[i]);
pSpriteBufferData[i] = NULL;
}
if (pSpriteQueueData[i]) {
free(pSpriteQueueData[i]);
pSpriteQueueData[i] = NULL;
}
if (pTileQueueData[i]) {
free(pTileQueueData[i]);
pTileQueueData[i] = NULL;
}
if (GP9001TileAttrib[i]) {
free(GP9001TileAttrib[i]);
GP9001TileAttrib[i] = NULL;
}
BurnFree(pSpriteBufferData[i]);
BurnFree(pSpriteQueueData[i]);
BurnFree(pTileQueueData[i]);
BurnFree(GP9001TileAttrib[i]);
}
return 0;