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;
}
Exemple #2
0
void __fastcall k1945iiiWriteWordPalette(unsigned int sekAddress, unsigned short wordValue)
{
	sekAddress -= 0x200000;
	sekAddress >>= 1;
	RamPal[sekAddress] = wordValue;
	RamCurPal[sekAddress] = CalcCol( wordValue );
}
Exemple #3
0
static void DrvCalcPalette()
{
	for (int i = 0; i < 0x100; i++) {
		int Val = DrvPaletteRam1[i] + (DrvPaletteRam2[i] << 8);
		
		DrvPalette[i] = CalcCol(Val);
	}
}
Exemple #4
0
// Update the PC copy of the palette on writes to the palette memory
void PsikyoPalWriteByte(unsigned int nAddress, unsigned char byteValue)
{
	nAddress ^= 1;
	PsikyoPalSrc[nAddress] = byteValue;							// write byte

	if (*((unsigned char*)(PsikyoPalCopy + nAddress)) != byteValue) {
		*((unsigned char*)(PsikyoPalCopy + nAddress)) = byteValue;
		PsikyoPalette[nAddress >> 1] = CalcCol(*(unsigned short*)(PsikyoPalSrc + (nAddress & ~0x01)));
	}
Exemple #5
0
static void KorokoroPaletteUpdate()
{
	for (INT32 color = 0; color < 0x40; color++) {
		for (INT32 pen = 0; pen < 0x10; pen++) {
			CavePalette[(color << 8) | pen] = CalcCol(*(UINT16*)(CavePalSrc + ((0x3c00 | (color << 4) | pen)*2)));
		}

		for (INT32 pen = 0x10; pen < 0x100; pen++) {
			CavePalette[(color << 8) | pen] = CalcCol(*(UINT16*)(CavePalSrc + ((0x0000 | (color << 8) | pen)*2)));
		}
	}

	for (INT32 color = 0; color < 0x4000; color++) {
		CavePalette[color+0x4000] = CalcCol(*(UINT16*)(CavePalSrc + color*2));
	}

	pBurnDrvPalette = CavePalette;
}
// Update the PC copy of the palette on writes to the palette memory
void CavePalWriteByte(UINT32 nAddress, UINT8 byteValue)
{
	nAddress ^= 1;
	CavePalSrc[nAddress] = byteValue;							// write byte

	if (*((UINT8*)(CavePalCopy + nAddress)) != byteValue) {
		*((UINT8*)(CavePalCopy + nAddress)) = byteValue;
		CavePalette[nAddress >> 1] = CalcCol(*(UINT16*)(CavePalSrc + (nAddress & ~0x01)));
	}
Exemple #7
0
void __fastcall m92WriteByte(unsigned int vezAddress, unsigned char byteValue)
{
	static unsigned int sprite_extent;
	
	if ((vezAddress & 0xFF800) == 0xF8800 ) {
		RamPal[ vezAddress - 0xF8800 + PalBank ] = byteValue;
		if (vezAddress & 1) {
			int offs = (vezAddress - 0xF8800 + PalBank) >> 1;
			RamCurPal[ offs ] = CalcCol( offs << 1 );
		}
Exemple #8
0
int SupermanPalUpdate()
{
	int i;
	unsigned short* ps;
	unsigned int* pd;

	for (i = 0, ps = (unsigned short*)Superman_src_pal, pd = Superman_pal; i < 0x400; i++, ps++, pd++) {
		*pd = CalcCol(*ps);
	}
	return 0;
}
Exemple #9
0
// Update the PC copy of the palette on writes to the palette memory
void __fastcall NeoPalWriteByte(unsigned int nAddress, unsigned char byteValue)
{
	nAddress &= 0x1FFF;
	nAddress ^= 1;

	NeoPalSrc[nNeoPaletteBank][nAddress] = byteValue;							// write byte

	if (*((unsigned char*)(NeoPaletteCopy[nNeoPaletteBank] + nAddress)) != byteValue) {
		*((unsigned char*)(NeoPaletteCopy[nNeoPaletteBank] + nAddress)) = byteValue;
		NeoPaletteData[nNeoPaletteBank][nAddress >> 1] = CalcCol(*(unsigned short*)(NeoPalSrc[nNeoPaletteBank] + (nAddress & ~0x01)));
	}
Exemple #10
0
int twinhawkPalUpdate()
{
	int i;
	unsigned short* ps;
	unsigned int* pd;

	for (i = 0, ps = (unsigned short*)twinhawk_src_pal, pd = twinhawk_pal; i < 0x400; i++, ps++, pd++) {
		*pd = CalcCol(*ps);
	}
	return 0;
}
Exemple #11
0
int rastanPalUpdate()
{
	int i;
	unsigned short* ps;
	unsigned int* pd;

	for (i = 0, ps = (unsigned short*)rastan_src_pal, pd = rastan_pal; i < 0x800; i++, ps++, pd++) {
		*pd = CalcCol(*ps);
	}
	return 0;
}
Exemple #12
0
static int DrvFrame()
{
	if (DrvReset) DrvDoReset();
	
	if (bRecalcPalette) {
		for (int i=0;i<(0x1000/2); i++)
			RamCurPal[i] = CalcCol( RamPal[i] );
		bRecalcPalette = 0;	
	}
	
	DrvInput[0] = 0x00;													// Joy1
	DrvInput[1] = 0x00;													// Joy2
	DrvInput[2] = 0x00;													// Buttons
	for (int i = 0; i < 8; i++) {
		DrvInput[0] |= (DrvJoy1[i] & 1) << i;
		DrvInput[1] |= (DrvJoy2[i] & 1) << i;
		DrvInput[2] |= (DrvButton[i] & 1) << i;
	}

	
	SekNewFrame();
	SekOpen(0);

#if 0	
	int nCyclesDone = 0;
	int nCyclesNext = 0;
	for(int i=0; i<10; i++) {
		nCyclesNext += (16000000 / 60 / 10);
		nCyclesDone += SekRun( nCyclesNext - nCyclesDone );
	}
#else

	SekRun(16000000 / 60);
	
#endif
	
	SekSetIRQLine(4, SEK_IRQSTATUS_AUTO);
	
	SekClose();
	
	if (pBurnDraw) DrvDraw();
	
	if (pBurnSoundOut) {
		memset(pBurnSoundOut, 0, nBurnSoundLen * 4);
		MSM6295Render(0, pBurnSoundOut, nBurnSoundLen);
		MSM6295Render(1, pBurnSoundOut, nBurnSoundLen);
	}
	return 0;
}
Exemple #13
0
int PsikyoPalUpdate()
{
	if (PsikyoRecalcPalette) {
		unsigned short c;

		for (int i = 0; i < 0x1000; i++) {
			c = ((unsigned short*)PsikyoPalSrc)[i];
			PsikyoPalCopy[i] = c;
			PsikyoPalette[i] = CalcCol(c);
		}

		PsikyoRecalcPalette = 0;
	}

	return 0;
}
Exemple #14
0
int TmntPalUpdate(int /*bRecalc*/)
{
	// If any colors have changed, convert them from TmntRam08 into the High palette
	int a; unsigned short *ps; unsigned int *ph;


	ps=(unsigned short *)TmntRam08; 
	ph=TmntPal; 
	for (a=0;a<0x80; a++)
	{
		int b; /*unsigned char d;*/ unsigned char m; // dirt info and mask

		for (b=0,m=1; b<8; b++,m<<=1, ps+=2,ph++)
		{
    		*ph=CalcCol(ps,(a<<3)|b); // If dirty recalculate
		}
	}
	return 0;
}
Exemple #15
0
int NeoUpdatePalette()
{
	if (NeoRecalcPalette) {
		int i;
		unsigned short* ps;
		unsigned short* pc;
		unsigned int* pd;

		// Update both palette banks
		for (int j = 0; j < 2; j++) {
			for (i = 0, ps = (unsigned short*)NeoPalSrc[j], pc = NeoPaletteCopy[j], pd = NeoPaletteData[j]; i < 4096; i++, ps++, pc++, pd++) {
				*pc = *ps;
				*pd = CalcCol(*ps);
			}
		}

		NeoRecalcPalette = 0;

	}

	return 0;
}
Exemple #16
0
	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(unsigned int sekAddress, unsigned short wordValue)
{
	sekAddress = (sekAddress - 0xa00000) >> 1;
	PGMPalRAM[sekAddress] = wordValue;
	RamCurPal[sekAddress] = CalcCol(wordValue);
}

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

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

unsigned char __fastcall PgmZ80PortRead(unsigned short port)
{
	switch (port >> 8)
	{