--- xmil/vram/palettes.c 2004/08/17 12:30:41 1.12 +++ xmil/vram/palettes.c 2005/02/04 06:42:12 1.18 @@ -7,13 +7,16 @@ #include "makescrn.h" - UINT xmil_palettes; - RGB32 xmil_pal32[XMILPAL_MAX]; // xm_palette + UINT xmil_palettes; + RGB32 xmil_pal32[XMILPAL_MAX]; // xm_palette #if defined(SUPPORT_16BPP) - RGB16 xmil_pal16[XMILPAL_MAX]; + RGB16 xmil_pal16[XMILPAL_MAX]; +#endif +#if defined(SUPPORT_PALEVENT) + PALEVENT palevent; #endif - +#if defined(SUPPORT_TURBOZ) static const UINT16 pal4096banktbl[2][64] = { { 0x000, 0x008, 0x080, 0x088, 0x800, 0x808, 0x880, 0x888, 0x004, 0x00C, 0x084, 0x08C, 0x804, 0x80C, 0x884, 0x88C, @@ -33,9 +36,21 @@ static const UINT16 pal4096banktbl[2][64 0x110, 0x112, 0x130, 0x132, 0x310, 0x312, 0x330, 0x332, 0x111, 0x113, 0x131, 0x133, 0x311, 0x313, 0x331, 0x333}}; +static void pal4096to64(RGB32 *pal, const UINT16 *map) { + UINT r; + + r = 64; + do { + pal->d = xmil_pal32[XMILPAL_4096G + (*map++)].d; + pal++; + } while(--r); +} +#endif +// ---- + void pal_makegrad(RGB32 *pal, int pals, UINT32 bg, UINT32 fg) { int i; @@ -94,7 +109,7 @@ static void pal_settext(REG8 num) { pals.text[num+8].p.b = (UINT8)((pals.skipline * rgb.p.b) >> 8); pals.text[num+8].p.g = (UINT8)((pals.skipline * rgb.p.g) >> 8); pals.text[num+8].p.r = (UINT8)((pals.skipline * rgb.p.r) >> 8); - makescrn.palandply = 1; + crtc.e.palandply = 1; } #else void pal_settext(REG8 num) { @@ -133,7 +148,7 @@ void pal_settext(REG8 num) { pals.text[num+8].p.b = (UINT8)((pals.skipline * rgb.p.b) >> 8); pals.text[num+8].p.g = (UINT8)((pals.skipline * rgb.p.g) >> 8); pals.text[num+8].p.r = (UINT8)((pals.skipline * rgb.p.r) >> 8); - makescrn.palandply = 1; + crtc.e.palandply = 1; } void pal_setgrph(REG8 bank, REG8 num) { @@ -170,7 +185,7 @@ void pal_setgrph(REG8 bank, REG8 num) { pals.grph[bank][num+8].p.g = (UINT8)((pals.skipline * rgb.p.g) >> 8); pals.grph[bank][num+8].p.r = (UINT8)((pals.skipline * rgb.p.r) >> 8); } - makescrn.palandply = 1; + crtc.e.palandply = 1; } void pal_setgrph4096(UINT num) { @@ -205,27 +220,13 @@ void pal_setgrph4096(UINT num) { xmil_pal16[XMILPAL_4096G + num] = scrnmng_makepal16(rgb); } #endif - makescrn.palandply = 1; + crtc.e.palandply = 1; } #endif // ---- -#if defined(SUPPORT_TURBOZ) -static void pal4096to64(RGB32 *pal, const UINT16 *map) { - - UINT r; - - r = 64; - do { - pal->d = xmil_pal32[XMILPAL_4096G + (*map++)].d; - pal++; - } while(--r); -} -#endif - - void pal_update1(const UINT8 *rgbp) { UINT i; @@ -273,7 +274,7 @@ void pal_update1(const UINT8 *rgbp) { } } else { - bcnt = (crtc.s.BLACKPAL & 15) - 8; + bcnt = (rgbp[CRTC_BLACK] & 15) - 8; for (j=i+8; j<64; j+=8) { bcnt--; if (bcnt) { @@ -287,17 +288,32 @@ void pal_update1(const UINT8 *rgbp) { } } } +#if defined(SUPPORT_16BPP) + if (scrnmng_getbpp() == 16) { + for (i=0; i