示例#1
0
static int DrvFrame()
{
	if (DrvReset) {
		DrvDoReset();
	}

	Sh2NewFrame();

	{
		DrvInputs = ~0x60 | (DrvDips[0] & 0x60);
		for (int i = 0; i < 32; i++) {
			DrvInputs ^= (DrvJoy1[i] & 1) << i;
		}
	}

	BurnTimerEndFrame(28636350 / 60);

	Sh2SetIRQLine(4, SH2_IRQSTATUS_AUTO);

	if (pBurnSoundOut) {
		BurnYMF278BUpdate(nBurnSoundLen);
	}

	if (pBurnDraw) {
		PsikyoshDraw();
	}

	memcpy (DrvSprBuf, DrvSprRAM, 0x4000);

	return 0;
}
示例#2
0
文件: qs.cpp 项目: SiN13/pifba
void QsndEndFrame()
{
	BurnTimerEndFrame(nCpsZ80Cycles);
	if (pBurnSoundOut) QscUpdate(nBurnSoundLen);

	nQsndCyclesExtra = ZetTotalCycles() - nCpsZ80Cycles;
}
示例#3
0
void endframe_dec_aud(int cycles)
{
	BurnTimerEndFrame(cycles);

	if (pBurnSoundOut)
	{
		BurnYM2203Update(pBurnSoundOut, nBurnSoundLen);
		BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
		MSM6295Render(0, pBurnSoundOut, nBurnSoundLen);
	}	
}
示例#4
0
void QsndEndFrame()
{
	BurnTimerEndFrame(nCpsZ80Cycles);
	if (pBurnSoundOut) QscUpdate(nBurnSoundLen);

	nQsndCyclesExtra = ZetTotalCycles() - nCpsZ80Cycles;
   QUARK_LOG_VAR(nBurnSoundLen);
   QUARK_LOG_VAR(ZetTotalCycles());
   QUARK_LOG_VAR(nCpsZ80Cycles);
   QUARK_LOG_VAR(nQsndCyclesExtra);

	ZetClose();
}
示例#5
0
int SupermanFrame()
{
	if (SupermanReset) {	// Reset machine
		SupermanDoReset();
	}

	SupermanInpMake();

	SekNewFrame();
	ZetNewFrame();

	SekOpen(0);
	ZetOpen(0);

	SekIdle(nCyclesDone[0]);
	ZetIdle(nCyclesDone[1]);

	nCyclesTotal[0] = 8000000 / 60;
	nCyclesTotal[1] = 4000000 / 60;

	SekRun(nCyclesTotal[0] - SekTotalCycles());

	SekSetIRQLine(6, SEK_IRQSTATUS_AUTO);

	nCycles68KSync = SekTotalCycles();
	BurnTimerEndFrame(nCyclesTotal[1]);
	BurnYM2610Update(nBurnSoundLen);

	nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0];
	nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1];

	ZetClose();
	SekClose();

	if (pBurnDraw) {
		SupermanDraw();														// Draw screen if needed
	}

	return 0;
}
示例#6
0
static int DrvFrame()
{
	if (DrvReset) {
		DrvDoReset();
	}

	ZetNewFrame();

	{
		memset (DrvInputs, 0xff, 3);
		for (int i = 0; i < 8; i++) {
			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
			DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
		}

		// Clear opposites
		if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03;
		if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c;
		if ((DrvInputs[2] & 0x03) == 0) DrvInputs[1] |= 0x03;
		if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[1] |= 0x0c;
	}

	int nInterleave = 100;
	int nSoundBufferPos = 0;
	int nCyclesTotal[2] =  { 3072000 / 60, 3072000 / 60 };

	M6809Open(0);
	ZetOpen(0);

	for (int i = 0; i < nInterleave; i++) {
		
		M6809Run(nCyclesTotal[0] / nInterleave);

		BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave));

		if (pBurnSoundOut) {
			int nSegmentLength = nBurnSoundLen - nSoundBufferPos;
			short* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
			BurnYM2203Update(pSoundBuf, nSegmentLength);
			nSoundBufferPos += nSegmentLength;
		}
	}

	BurnTimerEndFrame(nCyclesTotal[1]);

	if (*irq_enable) M6809SetIRQ(0, M6809_IRQSTATUS_AUTO);

	if (pBurnSoundOut) {
		int nSegmentLength = nBurnSoundLen - nSoundBufferPos;
		short* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
		if (nSegmentLength) {
			BurnYM2203Update(pSoundBuf, nSegmentLength);
		}
	}

	ZetClose();
	M6809Close();
	
	if (pBurnDraw) {
		DrvDraw();
	}

	return 0;
}
示例#7
0
static int DrvFrame()
{
    int nInterleave = 4;

    if (DrvReset) {														// Reset machine
        DrvDoReset();
    }

    // Compile digital inputs
    DrvInput[0] = 0x00;													// Buttons
    DrvInput[1] = 0x00;													// Player 1
    DrvInput[4] = 0x00;													// Player 2
    for (int i = 0; i < 8; i++) {
        DrvInput[0] |= (DrvJoy1[i] & 1) << i;
        DrvInput[1] |= (DrvJoy2[i] & 1) << i;
        DrvInput[4] |= (DrvButton[i] & 1) << i;
    }
    ToaClearOpposites(&DrvInput[0]);
    ToaClearOpposites(&DrvInput[1]);

    SekOpen(0);
    ZetOpen(0);

    SekNewFrame();
    ZetNewFrame();

    SekIdle(nCyclesDone[0]);
    ZetIdle(nCyclesDone[1]);

    nCyclesTotal[0] = (int)((long long)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE));
    nCyclesTotal[1] = int(28000000.0 / 8 / REFRESHRATE);

    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;

    for (int i = 0; i < nInterleave; i++) {
        int nNext;

        // Run 68000

        nNext = (i + 1) * nCyclesTotal[0] / nInterleave;

        // Trigger VBlank interrupt
        if (nNext > nToaCyclesVBlankStart) {
            if (SekTotalCycles() < nToaCyclesVBlankStart) {
                nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles();
                SekRun(nCyclesSegment);
            }

            if (pBurnDraw) {
                DrvDraw();												// Draw screen if needed
            }

            ToaBufferFCU2Sprites();

            bVBlank = true;
            if (bEnableInterrupts) {
                SekSetIRQLine(4, SEK_IRQSTATUS_AUTO);
            }
        }

        nCyclesSegment = nNext - SekTotalCycles();
        if (bVBlank || (!CheckSleep(0))) {								// See if this CPU is busywaiting
            SekRun(nCyclesSegment);
        } else {
            SekIdle(nCyclesSegment);
        }
    }

    nToa1Cycles68KSync = SekTotalCycles();
    BurnTimerEndFrame(nCyclesTotal[1]);
    BurnYM3812Update(nBurnSoundLen);

    nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0];
    nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1];

//	bprintf(PRINT_NORMAL, _T("    %i\n"), nCyclesDone[0]);

    ZetClose();
    SekClose();

//	ToaBufferFCU2Sprites();

    return 0;
}