INT32 CpsInit() { INT32 nMemLen, i; if (Cps == 2) BurnSetRefreshRate(59.629403); if (!nCPS68KClockspeed) { nCPS68KClockspeed = 11800000; } nCPS68KClockspeed = nCPS68KClockspeed * 100 / nBurnFPS; nMemLen = nCpsGfxLen + nCpsRomLen + nCpsCodeLen + nCpsZRomLen + nCpsQSamLen + nCpsAdLen; // Allocate Gfx, Rom and Z80 Roms CpsGfx = (UINT8*)BurnMalloc(nMemLen); if (CpsGfx == NULL) { return 1; } memset(CpsGfx, 0, nMemLen); CpsRom = CpsGfx + nCpsGfxLen; CpsCode = CpsRom + nCpsRomLen; CpsZRom = CpsCode + nCpsCodeLen; CpsQSam =(INT8*)(CpsZRom + nCpsZRomLen); CpsAd =(UINT8*)(CpsQSam + nCpsQSamLen); // Create Gfx addr mask for (i = 0; i < 31; i++) { if ((1 << i) >= (INT32)nCpsGfxLen) { break; } } nCpsGfxMask = (1 << i) - 1; // Offset to Scroll tiles nCpsGfxScroll[1] = nCpsGfxScroll[2] = nCpsGfxScroll[3] = 0x800000; #if 0 if (nCpsZRomLen>=5) { // 77->cfff and rst 00 in case driver doesn't load CpsZRom[0] = 0x3E; CpsZRom[1] = 0x77; CpsZRom[2] = 0x32; CpsZRom[3] = 0xFF; CpsZRom[4] = 0xCF; CpsZRom[5] = 0xc7; } #endif SepTableCalc(); // Precalc the separate table CpsReset = 0; Cpi01A = Cpi01C = Cpi01E = 0; // blank other inputs // Use this as default - all CPS-2 games use it SetCpsBId(CPS_B_21_DEF, 0); return 0; }
int CpsInit() { int nMemLen, i; BurnSetRefreshRate(59.633333); if (!nCPS68KClockspeed) { if (!(Cps & 1)) { nCPS68KClockspeed = 11800000; } else { nCPS68KClockspeed = 10000000; } } nCPS68KClockspeed = nCPS68KClockspeed * 100 / nBurnFPS; nMemLen = nCpsGfxLen + nCpsRomLen + nCpsCodeLen + nCpsZRomLen + nCpsQSamLen + nCpsAdLen; if (Cps1Qs == 1) { nMemLen += nCpsZRomLen * 2; } // Allocate Gfx, Rom and Z80 Roms CpsGfx = (unsigned char*)malloc(nMemLen); if (CpsGfx == NULL) { return 1; } memset(CpsGfx, 0, nMemLen); CpsRom = CpsGfx + nCpsGfxLen; CpsCode = CpsRom + nCpsRomLen; if (Cps1Qs == 1) { CpsEncZRom = CpsCode + nCpsCodeLen; CpsZRom = CpsEncZRom + nCpsZRomLen * 2; } else { CpsZRom = CpsCode + nCpsCodeLen; } CpsQSam =(char*)(CpsZRom + nCpsZRomLen); CpsAd =(unsigned char*)(CpsQSam + nCpsQSamLen); // Create Gfx addr mask for (i = 0; i < 31; i++) { if ((1 << i) >= (int)nCpsGfxLen) { break; } } nCpsGfxMask = (1 << i) - 1; // Offset to Scroll tiles if (!(Cps & 1)) { nCpsGfxScroll[1] = nCpsGfxScroll[2] = nCpsGfxScroll[3] = 0x800000; } else { nCpsGfxScroll[1] = nCpsGfxScroll[2] = nCpsGfxScroll[3] = 0; } if (nCpsZRomLen>=5) { // 77->cfff and rst 00 in case driver doesn't load CpsZRom[0] = 0x3E; CpsZRom[1] = 0x77; CpsZRom[2] = 0x32; CpsZRom[3] = 0xFF; CpsZRom[4] = 0xCF; CpsZRom[5] = 0xc7; } // mprot CpsMProt[0] = 0x40; CpsMProt[1] = 0x42; CpsMProt[2] = 0x44; CpsMProt[3] = 0x46; // Board ID (ffight is the default) CpsBID[0] = 0x60; CpsBID[1] = 0x00; CpsBID[2] = 0x04; SepTableCalc(); // Precalc the separate table CpsReset = 0; Cpi01A = Cpi01C = Cpi01E = 0; // blank other inputs nCpsLcReg = 0x66; // Layer controller usually at 0x66 // Usual bits for layer enable CpsLayEn[1] = 2; CpsLayEn[2] = 4; CpsLayEn[3] = 8; CpsLayEn[4] = 0; CpsLayEn[5] = 0; return 0; }