示例#1
0
static INT32 DrvReset()
{
	// Reset machine
	if (Cps == 2 || PangEEP || Cps1Qs == 1 || CpsBootlegEEPROM) EEPROMReset();
    
    //HACK
    if (glob_ffingeron&&virtual_stick_on) {
        wait_control=60;
        glob_framecpt=0;
        glob_replay_last_dx16=glob_replay_last_dy16=0;
        glob_delta_dy16=0;
        glob_replay_last_fingerOn=0;
    }
    //

	SekOpen(0);
	SekReset();
	SekClose();

	if (((Cps & 1) && !Cps1DisablePSnd) || ((Cps == 2) && !Cps2DisableQSnd)) {
		ZetOpen(0);
		ZetReset();
		ZetClose();
	}

	if (Cps == 2) {
		// Disable beam-synchronized interrupts
		*((UINT16*)(CpsReg + 0x4E)) = BURN_ENDIAN_SWAP_INT16(0x0200);
		*((UINT16*)(CpsReg + 0x50)) = BURN_ENDIAN_SWAP_INT16(nCpsNumScanlines);
		*((UINT16*)(CpsReg + 0x52)) = BURN_ENDIAN_SWAP_INT16(nCpsNumScanlines);
	}

	SekOpen(0);
	CpsMapObjectBanks(0);
	SekClose();

	nCpsCyclesExtra = 0;

	if (((Cps == 2) && !Cps2DisableQSnd) || Cps1Qs == 1) {			// Sound init (QSound)
		QsndReset();
	}
	
	if (CpsRunResetCallbackFunction) {
		CpsRunResetCallbackFunction();
	}
	
	HiscoreReset();

	return 0;
}
示例#2
0
INT32 CavePalUpdate4Bit(INT32 nOffset, INT32 nNumPalettes)
{
	INT32 i, j;

	UINT16* ps = (UINT16*)CavePalSrc + nOffset;
	UINT16* pc;
	UINT32* pd;

	UINT16 c;

	if (CaveRecalcPalette) {

		for (i = 0; i < 0 + nNumPalettes; i++) {

			pc = CavePalCopy + (i << 8);
			pd = CavePalette + (i << 8);

			for (j = 0; j < 16; j++, ps++, pc++, pd++) {

				c = *ps;
				*pc = c;
				*pd = CalcCol(BURN_ENDIAN_SWAP_INT16(c));

			}
		}

		CaveRecalcPalette = 0;
		return 0;
	}


	for (i = 0; i < 0 + nNumPalettes; i++) {

		pc = CavePalCopy + (i << 8);
		pd = CavePalette + (i << 8);

		for (j = 0; j < 16; j++, ps++, pc++, pd++) {

			c = *ps;
			if (*pc != c) {
				*pc = c;
				*pd = CalcCol(BURN_ENDIAN_SWAP_INT16(c));
			}

		}
	}

	return 0;
}
示例#3
0
void pgm_decrypt_dw2()
{
	UINT16 *src = (UINT16 *)PGM68KROM;

	for (INT32 i = 0; i<nPGM68KROMLen/2; i++) {
		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		if ((i & 0x020890) == 0x000000)				      x ^= 0x0002;
		if ((i & 0x020000) == 0x020000 && (i & 0x001500) != 0x001400) x ^= 0x0002;
		if ((i & 0x020400) == 0x000000 && (i & 0x002010) != 0x002010) x ^= 0x0400;
		if ((i & 0x020000) == 0x020000 && (i & 0x000148) != 0x000140) x ^= 0x0400;
	
		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#4
0
void pgm_decrypt_dw3()
{
	UINT16 *src = (UINT16 *)PGM68KROM;

	for (INT32 i = 0; i < nPGM68KROMLen/2; i++) {
		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		if ((i & 0x005460) == 0x001400) x ^= 0x0100;
		if ((i & 0x005450) == 0x001040) x ^= 0x0100;
		if ((i & 0x005e00) == 0x001c00) x ^= 0x0040;
		if ((i & 0x005580) == 0x001100) x ^= 0x0040;

		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#5
0
void pgm_decrypt_killbld()
{
	UINT16 *src = (UINT16 *)PGM68KROM;

	for (INT32 i = 0; i < nPGM68KROMLen/2; i++) {
		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		if ((i & 0x006d00) == 0x000400) x ^= 0x0008;
		if ((i & 0x006c80) == 0x000880) x ^= 0x0008;
		if ((i & 0x007500) == 0x002400) x ^= 0x1000;
		if ((i & 0x007600) == 0x003200) x ^= 0x1000;

		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#6
0
void pgm_decode_kovqhsgs_tile_data(UINT8 *source)
{
	INT32 i, j;
	UINT16 *src = (UINT16*)source;
	UINT16 *dst = (UINT16*)BurnMalloc(0x800000);

	for (i = 0; i < 0x800000 / 2; i++)
	{
		j = BITSWAP24(i, 23, 22, 9, 8, 21, 18, 0, 1, 2, 3, 16, 15, 14, 13, 12, 11, 10, 19, 20, 17, 7, 6, 5, 4);

		dst[j] = BURN_ENDIAN_SWAP_INT16(BITSWAP16(BURN_ENDIAN_SWAP_INT16(src[i]), 1, 14, 8, 7, 0, 15, 6, 9, 13, 2, 5, 10, 12, 3, 4, 11));
	}

	memcpy (src, dst, 0x800000);

	BurnFree (dst);
}
示例#7
0
void K053246Write(INT32 offset, INT32 data)
{
	if (data & 0x10000) { // handle it as a word
		*((UINT16*)(K053246Regs + (offset & 6))) = BURN_ENDIAN_SWAP_INT16(data);
	} else {
		K053246Regs[offset & 7] = data;
	}
}
示例#8
0
void K053247Write(INT32 offset, INT32 data)
{
	if (data & 0x10000) { // use word
		*((UINT16*)(K053247Ram + (offset & 0xffe))) = BURN_ENDIAN_SWAP_INT16(data);
	} else {
		K053247Ram[offset & 0xfff] = data;
	}
}
示例#9
0
static void pgm_decode_kovqhsgs_program()
{
	INT32 i, j;
	UINT16 *src = (UINT16*)PGM68KROM;
	UINT16 *dst = (UINT16*)BurnMalloc(0x400000);

	for (i = 0; i < 0x400000 / 2; i++)
	{
		j = BITSWAP24(i, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 6, 7, 5, 4, 3, 2, 1, 0);

		dst[j] = BURN_ENDIAN_SWAP_INT16(BITSWAP16(BURN_ENDIAN_SWAP_INT16(src[i]), 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0));
	}

	memcpy (src, dst, 0x400000);

	BurnFree (dst);
}
示例#10
0
void pgm_decrypt_svg()
{
	UINT16 *src = (UINT16 *)PGMUSER0;

	for (INT32 i = 0; i < nPGMExternalARMLen/2; i++) {
		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		if ((i & 0x040080) != 0x000080) x ^= 0x0001;
		if ((i & 0x004008) == 0x004008) x ^= 0x0002;
		if ((i & 0x080030) == 0x080010) x ^= 0x0004;
		if ((i & 0x000042) != 0x000042) x ^= 0x0008;
		if ((i & 0x048100) == 0x048000) x ^= 0x0010;
		if ((i & 0x002004) != 0x000004) x ^= 0x0020;
		if ((i & 0x011800) != 0x010000) x ^= 0x0040;
		if ((i & 0x000820) == 0x000820) x ^= 0x0080;

		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#11
0
uint16_t read_half(addr_t address)
{
    address &= 0xFFFFFFFF;

    UINT8 *pr = g_mmap->MemMap[PFN(address)];
    if ((uintptr_t)pr >= MIPS_MAXHANDLER) {
        return BURN_ENDIAN_SWAP_INT16(fast_read<uint16_t>(pr, address));
    }
    return g_mmap->ReadHalf[(uintptr_t)pr](address);
}
示例#12
0
void pgm_decrypt_ddp2()
{
	UINT16 *src = (UINT16 *)PGMUSER0;

	for (INT32 i = 0; i < nPGMExternalARMLen/2; i++) {
    		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		if ((i & 0x0480) != 0x0080) x ^= 0x0001;
		if ((i & 0x0042) != 0x0042) x ^= 0x0008;
		if ((i & 0x8100) == 0x8000) x ^= 0x0010;
		if ((i & 0x2004) != 0x0004) x ^= 0x0020;
		if ((i & 0x1800) != 0x0000) x ^= 0x0040;
		if ((i & 0x0820) == 0x0820) x ^= 0x0080;

		x ^= ddp2_tab[(i >> 1) & 0xff] << 8;

		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#13
0
void write_half(addr_t address, uint16_t value)
{
    address &= 0xFFFFFFFF;

    UINT8 *pr = g_mmap->MemMap[PAGE_WADD + PFN(address)];
    if ((uintptr_t)pr >= MIPS_MAXHANDLER) {
        fast_write<uint16_t>(pr, address, BURN_ENDIAN_SWAP_INT16(value));
        return;
    }
    g_mmap->WriteHalf[(uintptr_t)pr](address, value);
}
示例#14
0
void pgm_decrypt_puzlstar()
{
	UINT16 *src = (UINT16 *)PGM68KROM;

	for (INT32 i = 0; i < nPGM68KROMLen/2; i++) {
		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		if ((i & 0x40480) != 0x00080) x ^= 0x0001;
		if ((i & 0x00030) == 0x00010) x ^= 0x0004;
		if ((i & 0x00242) != 0x00042) x ^= 0x0008;
		if ((i & 0x08100) == 0x08000) x ^= 0x0010;
		if ((i & 0x22004) != 0x00004) x ^= 0x0020;
		if ((i & 0x11800) != 0x10000) x ^= 0x0040;
		if ((i & 0x04820) == 0x04820) x ^= 0x0080;

		x ^= puzlstar_tab[i & 0xff] << 8;

		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#15
0
void pgm_decrypt_happy6in1()
{
	UINT16 *src = (UINT16*)PGMUSER0;

	for (INT32 i = 0; i < nPGMExternalARMLen/2; i++) {
		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		if ((i & 0x040480) != 0x000080) x ^= 0x0001;
		if ((i & 0x104008) == 0x104008) x ^= 0x0002;
		if ((i & 0x080030) == 0x080010) x ^= 0x0004;
		if ((i & 0x000242) != 0x000042) x ^= 0x0008;
		if ((i & 0x048100) == 0x048000) x ^= 0x0010;
		if ((i & 0x002004) != 0x000004) x ^= 0x0020;
		if ((i & 0x011800) != 0x010000) x ^= 0x0040;
		if ((i & 0x000820) == 0x000820) x ^= 0x0080;

		x ^= happy6in1_tab[(i >> 1) & 0xff] << 8;

		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#16
0
void pgm_decrypt_espgaluda()
{
	UINT16 *src = (UINT16 *)PGM68KROM;

	for (INT32 i = 0; i < nPGM68KROMLen/2; i++) {
		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		if ((i & 0x040480) != 0x000080) x ^= 0x0001;
		if ((i & 0x084008) == 0x084008) x ^= 0x0002;
		if ((i & 0x000030) == 0x000010) x ^= 0x0004;
		if ((i & 0x000042) != 0x000042) x ^= 0x0008;
		if ((i & 0x048100) == 0x048000) x ^= 0x0010;
		if ((i & 0x022004) != 0x000004) x ^= 0x0020;
		if ((i & 0x011800) != 0x010000) x ^= 0x0040;
		if ((i & 0x000820) == 0x000820) x ^= 0x0080;

		x ^= espgal_tab[i & 0xff] << 8;

		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#17
0
void pgm_decrypt_ketsui()
{
	UINT16 *src = (UINT16 *)PGM68KROM;

	for (INT32 i = 0; i < nPGM68KROMLen/2; i++) {
		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		if ((i & 0x040480) != 0x000080) x ^= 0x0001;
		if ((i & 0x004008) == 0x004008) x ^= 0x0002;
		if ((i & 0x080030) == 0x000010) x ^= 0x0004; // due to address starting at 0 and not 100000/2!
		if ((i & 0x000042) != 0x000042) x ^= 0x0008;
		if ((i & 0x008100) == 0x008000) x ^= 0x0010;
		if ((i & 0x002004) != 0x000004) x ^= 0x0020;
		if ((i & 0x011800) != 0x010000) x ^= 0x0040;
		if ((i & 0x000820) == 0x000820) x ^= 0x0080;

		x ^= ketsui_tab[i & 0xff] << 8;

		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#18
0
static INT32 DrvReset()
{
	// Reset machine
	if (Cps == 2 || PangEEP || Cps1Qs == 1 || CpsBootlegEEPROM) EEPROMReset();

	SekOpen(0);
	SekReset();
	SekClose();

	if (((Cps & 1) && !Cps1DisablePSnd) || ((Cps == 2) && !Cps2DisableQSnd)) {
		ZetOpen(0);
		ZetReset();
		ZetClose();
	}

	if (Cps == 2) {
		// Disable beam-synchronized interrupts
		*((UINT16*)(CpsReg + 0x4E)) = BURN_ENDIAN_SWAP_INT16(0x0200);
		*((UINT16*)(CpsReg + 0x50)) = BURN_ENDIAN_SWAP_INT16(nCpsNumScanlines);
		*((UINT16*)(CpsReg + 0x52)) = BURN_ENDIAN_SWAP_INT16(nCpsNumScanlines);
	}

	SekOpen(0);
	CpsMapObjectBanks(0);
	SekClose();

	nCpsCyclesExtra = 0;

	if (((Cps == 2) && !Cps2DisableQSnd) || Cps1Qs == 1) {			// Sound init (QSound)
		QsndReset();
	}
	
	if (CpsRunResetCallbackFunction) {
		CpsRunResetCallbackFunction();
	}
	
	HiscoreReset();

	return 0;
}
示例#19
0
void pgm_decrypt_svgpcb()
{
	UINT16 *src = (UINT16 *)PGMUSER0;

	for (INT32 i = 0; i < nPGMExternalARMLen/2; i++) {
		UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]);

		// preliminary!
		if ((i & 0x040080) != 0x000080) x ^= 0x0001; // ok?
		if ((i & 0x084008) == 0x084008) x ^= 0x0002;
		if ((i & 0x080030) == 0x080010) x ^= 0x0004;
		if ((i & 0x000242) != 0x000042) x ^= 0x0008; // ok?
		if ((i & 0x048100) == 0x048000) x ^= 0x0010; //
		if ((i & 0x022004) != 0x000004) x ^= 0x0020; // ok?
		if ((i & 0x011800) != 0x010000) x ^= 0x0040;
		if ((i & 0x000820) == 0x000820) x ^= 0x0080;

		x ^= svgpcb_tab[(i >> 1) & 0xff] << 8;

		src[i] = BURN_ENDIAN_SWAP_INT16(x);
	}
}
示例#20
0
void __fastcall fuuki32_write_word(UINT32 address, UINT16 data)
{
	if ((address & 0xffffe0) == 0x8c0000) {

		if (address == 0x8c001c) {
			DrvRasterPos[0] = data & 0xff;
		}

		*((UINT16*)(DrvVidRegs + (address & 0x1e))) = BURN_ENDIAN_SWAP_INT16(data);

		return;
	}

	if ((address & 0xffffe0) == 0x903fe0) {
		cpu_sync();

		DrvShareRAM[(address & 0x1f) >> 1] = data & 0xff;
		return;
	}
示例#21
0
static UINT16 __fastcall kovsh_asic27a_read_word(UINT32 address)
{
	if ((address & 0xffffc0) == 0x4f0000) {
		return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(PGMARMShareRAM + (address & 0x3e))));
	}

	switch (address)
	{
		case 0x500000:
		case 0x600000:
			pgm_cpu_sync();
			return kovsh_lowlatch_arm_w;

		case 0x500002:
		case 0x600002:
			pgm_cpu_sync();
			return kovsh_highlatch_arm_w;
	}

	return 0;
}
示例#22
0
INT32 Cps2Frame()
{
	INT32 nDisplayEnd, nNext;									// variables to keep track of executed 68K cyles
	INT32 i;

	if (CpsReset) {
		DrvReset();
	}

//	extern INT32 prevline;
//	prevline = -1;

	SekNewFrame();
	if (!Cps2DisableQSnd) QsndNewFrame();

	nCpsCycles = (INT32)(((INT64)nCPS68KClockspeed * nBurnCPUSpeedAdjust) / 0x0100);
	SekOpen(0);
	SekSetCyclesScanline(nCpsCycles / nCpsNumScanlines);

	CpsRwGetInp();											// Update the input port values
	
	// Check the volumes every 5 frames or so
#if 0
	if (GetCurrentFrame() % 5 == 0) {
		if (Cps2VolUp) Cps2Volume++;
		if (Cps2VolDwn) Cps2Volume--;
		
		if (Cps2Volume > 39) Cps2Volume = 39;
		if (Cps2Volume < 0) Cps2Volume = 0;
		
		QscSetRoute(BURN_SND_QSND_OUTPUT_1, Cps2Volume / 39.0, BURN_SND_ROUTE_LEFT);
		QscSetRoute(BURN_SND_QSND_OUTPUT_2, Cps2Volume / 39.0, BURN_SND_ROUTE_RIGHT);
	}
#endif
	
	nDisplayEnd = nCpsCycles * (nFirstLine + 224) / nCpsNumScanlines;	// Account for VBlank

	nInterrupt = 0;
   memset(nRasterline, 0, MAX_RASTER + 2 * sizeof(nRasterline[0]));

	// Determine which (if any) of the line counters generates the first IRQ
	bEnableAutoIrq50 = bEnableAutoIrq52 = false;
	nIrqLine50 = nIrqLine52 = nCpsNumScanlines;
	if (BURN_ENDIAN_SWAP_INT16(*((UINT16*)(CpsReg + 0x50))) & 0x8000) {
		bEnableAutoIrq50 = true;
	}
	if (bEnableAutoIrq50 || (BURN_ENDIAN_SWAP_INT16(*((UINT16*)(CpsReg + 0x4E))) & 0x0200) == 0) {
		nIrqLine50 = (BURN_ENDIAN_SWAP_INT16(*((UINT16*)(CpsReg + 0x50))) & 0x01FF);
	}
	if (BURN_ENDIAN_SWAP_INT16(*((UINT16*)(CpsReg + 0x52))) & 0x8000) {
		bEnableAutoIrq52 = true;
	}
	if (bEnableAutoIrq52 || (BURN_ENDIAN_SWAP_INT16(*((UINT16*)(CpsReg + 0x4E))) & 0x0200) == 0) {
		nIrqLine52 = (BURN_ENDIAN_SWAP_INT16(*((UINT16*)(CpsReg + 0x52))) & 0x01FF);
	}
	ScheduleIRQ();

	SekIdle(nCpsCyclesExtra);

	if (nIrqCycles < nCpsCycles * nFirstLine / nCpsNumScanlines) {
		SekRun(nIrqCycles);
		DoIRQ();
	}
	nNext = nCpsCycles * nFirstLine / nCpsNumScanlines;
	if (SekTotalCycles() < nNext) {
		SekRun(nNext - SekTotalCycles());
	}

	CopyCpsReg(0);										// Get inititial copy of registers
	CopyCpsFrg(0);										//

	if (nIrqLine >= nCpsNumScanlines && (BURN_ENDIAN_SWAP_INT16(*((UINT16*)(CpsReg + 0x4E))) & 0x0200) == 0) {
		nIrqLine50 = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(CpsReg + 0x50))) & 0x01FF;
		nIrqLine52 = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(CpsReg + 0x52))) & 0x01FF;
		ScheduleIRQ();
	}

	{
		nNext = (nDisplayEnd) / 3;			// find out next cycle count to run to

		while (nNext > nIrqCycles && nInterrupt < MAX_RASTER) {
			SekRun(nIrqCycles - SekTotalCycles());
			DoIRQ();
		}
		SekRun(nNext - SekTotalCycles());				// run cpu

		nNext = (2 * nDisplayEnd) / 3;			// find out next cycle count to run to

		while (nNext > nIrqCycles && nInterrupt < MAX_RASTER) {
			SekRun(nIrqCycles - SekTotalCycles());
			DoIRQ();
		}
		SekRun(nNext - SekTotalCycles());				// run cpu

		nNext = (3 * nDisplayEnd) / 3;			// find out next cycle count to run to

		while (nNext > nIrqCycles && nInterrupt < MAX_RASTER) {
			SekRun(nIrqCycles - SekTotalCycles());
			DoIRQ();
		}
		SekRun(nNext - SekTotalCycles());				// run cpu
	}
	
	CpsObjGet();										// Get objects

//	nCpsCyclesSegment[0] = (nCpsCycles * nVBlank) / nCpsNumScanlines;
//	nDone += SekRun(nCpsCyclesSegment[0] - nDone);

	SekSetIRQLine(2, SEK_IRQSTATUS_AUTO);				// VBlank
	//if (pBurnDraw)
		CpsDraw();
	SekRun(nCpsCycles - SekTotalCycles());	

	nCpsCyclesExtra = SekTotalCycles() - nCpsCycles;

	if (!Cps2DisableQSnd) QsndEndFrame();

	SekClose();

//	bprintf(PRINT_NORMAL, _T("    -\n"));

#if 0 && defined FBA_DEBUG
	if (nInterrupt) {
		bprintf(PRINT_IMPORTANT, _T("Beam synchronized interrupt at line %2X.\r"), nRasterline[nInterrupt]);
	} else {
		bprintf(PRINT_NORMAL, _T("Beam synchronized interrupt disabled.   \r"));
	}

	extern INT32 counter;
	if (counter) {
		bprintf(PRINT_NORMAL, _T("\n\nSlices start at: "));
		for (i = 0; i < MAX_RASTER + 2; i++) {
			bprintf(PRINT_NORMAL, _T("%2X "), nRasterline[i]);
		}
		bprintf(PRINT_NORMAL, _T("\n"));
		for (i = 0; i < 0x80; i++) {
			if (*((UINT16*)(CpsSaveReg[0] + i * 2)) != *((UINT16*)(CpsSaveReg[nInterrupt] + i * 2))) {
				bprintf(PRINT_NORMAL, _T("Register %2X: %4X -> %4X\n"), i * 2, *((UINT16*)(CpsSaveReg[0] + i * 2)), *((UINT16*)(CpsSaveReg[nInterrupt] + i * 2)));
			}
		}
		bprintf(PRINT_NORMAL, _T("\n"));
		for (i = 0; i < 0x010; i++) {
			if (CpsSaveFrg[0][i] != CpsSaveFrg[nInterrupt][i]) {
				bprintf(PRINT_NORMAL, _T("FRG %X: %02X -> %02X\n"), i, CpsSaveFrg[0][i], CpsSaveFrg[nInterrupt][i]);
			}
		}
		bprintf(PRINT_NORMAL, _T("\n"));
		if (((CpsSaveFrg[0][4] << 8) | CpsSaveFrg[0][5]) != ((CpsSaveFrg[nInterrupt][4] << 8) | CpsSaveFrg[nInterrupt][5])) {
			bprintf(PRINT_NORMAL, _T("Layer-sprite priority: %04X -> %04X\n"), ((CpsSaveFrg[0][4] << 8) | CpsSaveFrg[0][5]), ((CpsSaveFrg[nInterrupt][4] << 8) | CpsSaveFrg[nInterrupt][5]));
		}

		bprintf(PRINT_NORMAL, _T("\n"));
		for (INT32 j = 0; j <= nInterrupt; j++) {
			if (j) {
				bprintf(PRINT_NORMAL, _T("IRQ : %i (triggered at line %3i)\n\n"), j, nRasterline[j]);
			} else {
				bprintf(PRINT_NORMAL, _T("Initial register status\n\n"));
			}

			for (i = 0; i < 0x080; i+= 8) {
				bprintf(PRINT_NORMAL, _T("%2X: %4X %4X %4X %4X %4X %4X %4X %4X\n"), i * 2, *((UINT16*)(CpsSaveReg[j] + 0 + i * 2)), *((UINT16*)(CpsSaveReg[j] + 2 + i * 2)), *((UINT16*)(CpsSaveReg[j] + 4 + i * 2)), *((UINT16*)(CpsSaveReg[j] + 6 + i * 2)), *((UINT16*)(CpsSaveReg[j] + 8 + i * 2)), *((UINT16*)(CpsSaveReg[j] + 10 + i * 2)), *((UINT16*)(CpsSaveReg[j] + 12 + i * 2)), *((UINT16*)(CpsSaveReg[j] + 14 + i * 2)));
			}

			bprintf(PRINT_NORMAL, _T("\nFRG: "));
			for (i = 0; i < 0x010; i++) {
				bprintf(PRINT_NORMAL, _T("%02X "), CpsSaveFrg[j][i]);
			}
			bprintf(PRINT_NORMAL, _T("\n\n"));

		}

		extern INT32 bRunPause;
		bRunPause = 1;
		counter = 0;
	}
#endif

	return 0;
}
示例#23
0
static void kovsh_asic27a_arm7_write_word(UINT32 address, UINT16 data)
{
	if ((address & 0xffffff80) == 0x50800000) {	// written... but never read?
		*((UINT16*)(PGMARMShareRAM + ((address>>1) & 0x3e))) = BURN_ENDIAN_SWAP_INT16(data);
		return;
	}
示例#24
0
void PC090OJDrawSprites(UINT8 *pSrc)
{
	UINT16 *VideoRam = (UINT16*)PC090OJRam;
	
	INT32 PC090OJCtrl = BURN_ENDIAN_SWAP_INT16(VideoRam[0xdff]);
	
	INT32 Offset;
	INT32 SpriteColBank = (PC090OJSpriteCtrl & 0x0f) << 4;
	
	for (Offset = 0x400 - 4; Offset >= 0; Offset -= 4)
	{
		INT32 xFlip, yFlip;
		INT32 x, y;
		INT32 Data, Code, Colour;

		Data = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset + 0]);
		yFlip = (Data & 0x8000) >> 15;
		xFlip = (Data & 0x4000) >> 14;
		Colour = (Data & 0x000f) | SpriteColBank | PC090OJPaletteOffset;

		Code = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset + 2]) & 0x1fff;
		if (Code >= PC090OJNumTiles) {
			Code %= PC090OJNumTiles; // ok? Mod seems to work fine for bonze.
		}

		x = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset + 3]) & 0x1ff;
		y = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset + 1]) & 0x1ff;

		if (x > 0x140) x -= 0x200;
		if (y > 0x140) y -= 0x200;
		
		if (!(PC090OJCtrl & 1))	{
			x = 320 - x - 16;
			y = 256 - y - 16;
			xFlip = !xFlip;
			yFlip = !yFlip;
		}

		x -= PC090OJXOffset;
		y -= PC090OJYOffset;

		if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) {
			if (xFlip) {
				if (yFlip) {
					Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
				} else {
					Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
				}
			} else {
				if (yFlip) {
					Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
				} else {
					Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
				}
			}
		} else {
			if (xFlip) {
				if (yFlip) {
					Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
				} else {
					Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
				}
			} else {
				if (yFlip) {
					Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
				} else {
					Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc);
				}
			}
		}
	}
}
示例#25
0
	INT32 r, g, b;

	r = (nColour & 0x7C00) >> 7;	// Red 
	r |= r >> 5;
	g = (nColour & 0x03E0) >> 2;	// Green
	g |= g >> 5;
	b = (nColour & 0x001F) << 3;	// Blue
	b |= b >> 5;

	return BurnHighCol(r, g, b, 0);
}

void __fastcall PgmPaletteWriteWord(UINT32 sekAddress, UINT16 wordValue)
{
	sekAddress = (sekAddress - 0xa00000) >> 1;
	PGMPalRAM[sekAddress] =BURN_ENDIAN_SWAP_INT16(wordValue);
	RamCurPal[sekAddress] = CalcCol(wordValue);
}

void __fastcall PgmPaletteWriteByte(UINT32 sekAddress, UINT8 byteValue)
{
	sekAddress -= 0xa00000;
	UINT8 *pal = (UINT8*)PGMPalRAM;
	pal[sekAddress ^ 1] = byteValue;

	RamCurPal[sekAddress >> 1] = CalcCol(PGMPalRAM[sekAddress >> 1]);
}

UINT8 __fastcall PgmZ80PortRead(UINT16 port)
{
	switch (port >> 8)