⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 .#palette.c.1.24

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 24
📖 第 1 页 / 共 4 页
字号:
					\      *ct++ = res;			\					\   }while(--cols);			\}BUILD_MAPPER3(Map_12bit_xBGR_8,UINT8,GET_PEN_FOR_COLOUR_8)BUILD_MAPPER3(Map_12bit_xBGR_15,UINT16,GET_PEN_FOR_COLOUR_15)BUILD_MAPPER3(Map_12bit_xBGR_16,UINT16,GET_PEN_FOR_COLOUR_16)BUILD_MAPPER3(Map_12bit_xBGR_24,UINT32,GET_PEN_FOR_COLOUR_24)BUILD_MAPPER3(Map_12bit_xBGR_32,UINT32,GET_PEN_FOR_COLOUR_32)struct COLOUR_MAPPER col_map_xxxx_bbbb_gggg_rrrr ={   "12bit xxxx bbbb gggg rrrr",   Map_12bit_xBGR_8,   Map_12bit_xBGR_15,   Map_12bit_xBGR_16,   Map_12bit_xBGR_24,   Map_12bit_xBGR_32,};/******************************************************************************//* 12-bit RGBx (12-bit mapping)                                               *//******************************************************************************/void Map_12bit_RGBx(int bank, int cols){   UINT16 yy;   UINT16 *ta;   UINT8 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5));   ct = coltab[bank];   do{      yy = (*ta++) >> 4;      GET_PEN_FOR_COLOUR_8(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}void map_12bit_rrrr_gggg_bbbb_xxxx_8(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT8 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5));   ct = coltab[bank];   do{      yy = (*ta++) >> 4;      GET_PEN_FOR_COLOUR_8(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}void map_12bit_rrrr_gggg_bbbb_xxxx_15(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT16 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5));   ct = (UINT16 *) coltab[bank];   do{      yy = (*ta++) >> 4;      GET_PEN_FOR_COLOUR_15(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}void map_12bit_rrrr_gggg_bbbb_xxxx_16(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT16 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5));   ct = (UINT16 *) coltab[bank];   do{      yy = (*ta++) >> 4;      GET_PEN_FOR_COLOUR_16(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}void map_12bit_rrrr_gggg_bbbb_xxxx_24(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT32 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5));   ct = (UINT32 *) coltab[bank];   do{      yy = (*ta++) >> 4;      GET_PEN_FOR_COLOUR_24(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}void map_12bit_rrrr_gggg_bbbb_xxxx_32(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT32 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5));   ct = (UINT32 *) coltab[bank];   do{      yy = (*ta++) >> 4;      GET_PEN_FOR_COLOUR_32(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}struct COLOUR_MAPPER col_map_rrrr_gggg_bbbb_xxxx ={   "12bit rrrr gggg bbbb xxxx",   map_12bit_rrrr_gggg_bbbb_xxxx_8,   map_12bit_rrrr_gggg_bbbb_xxxx_15,   map_12bit_rrrr_gggg_bbbb_xxxx_16,   map_12bit_rrrr_gggg_bbbb_xxxx_24,   map_12bit_rrrr_gggg_bbbb_xxxx_32,};/******************************************************************************//* 15-bit RRRRGGGGBBBBRGBx Reverse Colour Order (Jaleco MS-1)                 *//******************************************************************************/void map_15bit_rrrr_gggg_bbbb_rgbx_rev_8(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT8 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_8(         ((yy&0x7800)>>9) | ((yy&0x0004)>>1),         ((yy&0x0780)>>5) | ((yy&0x0002)>>0),         ((yy&0x0078)>>1) | ((yy&0x0001)<<1),         res      );      *ct++ = res;   }while(--cols);}void map_15bit_rrrr_gggg_bbbb_rgbx_rev_15(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT16 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT16 *) coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_15(         ((yy&0x7800)>>9) | ((yy&0x0004)>>1),         ((yy&0x0780)>>5) | ((yy&0x0002)>>0),         ((yy&0x0078)>>1) | ((yy&0x0001)<<1),         res      );      *ct++ = res;   }while(--cols);}void map_15bit_rrrr_gggg_bbbb_rgbx_rev_16(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT16 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT16 *) coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_16(         ((yy&0x7800)>>9) | ((yy&0x0004)>>1),         ((yy&0x0780)>>5) | ((yy&0x0002)>>0),         ((yy&0x0078)>>1) | ((yy&0x0001)<<1),         res      );      *ct++ = res;   }while(--cols);}void map_15bit_rrrr_gggg_bbbb_rgbx_rev_24(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT32 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT32 *) coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_24(         ((yy&0x7800)>>9) | ((yy&0x0004)>>1),         ((yy&0x0780)>>5) | ((yy&0x0002)>>0),         ((yy&0x0078)>>1) | ((yy&0x0001)<<1),         res      );      *ct++ = res;   }while(--cols);}void map_15bit_rrrr_gggg_bbbb_rgbx_rev_32(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT32 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT32 *) coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_32(         ((yy&0x7800)>>9) | ((yy&0x0004)>>1),         ((yy&0x0780)>>5) | ((yy&0x0002)>>0),         ((yy&0x0078)>>1) | ((yy&0x0001)<<1),         res      );      *ct++ = res;   }while(--cols);}struct COLOUR_MAPPER col_map_rrrr_gggg_bbbb_rgbx_rev ={   "15bit rrrr gggg bbbb rgbx [reverse]",   map_15bit_rrrr_gggg_bbbb_rgbx_rev_8,   map_15bit_rrrr_gggg_bbbb_rgbx_rev_15,   map_15bit_rrrr_gggg_bbbb_rgbx_rev_16,   map_15bit_rrrr_gggg_bbbb_rgbx_rev_24,   map_15bit_rrrr_gggg_bbbb_rgbx_rev_32,};// Map_15bit_RRRRGGGGBBBBRGBx#define BUILD_MAPPER5(NAME, TYPE, PEN_FUNC)		\void NAME(UINT32 bank, UINT32 cols)	\{							\   UINT16 yy;						\   UINT16 *ta;						\   TYPE *ct,res;					\                                                        \   bank_status[bank] = cols;                            \   ta = (UINT16 *) (RAM_PAL+(bank<<5));                 \   ct = (TYPE*)coltab[bank];                            \   do{                                                  \      yy = (*ta++) >> 1;                                \                                                        \      PEN_FUNC(                             \         ((yy&0x7800)>>9) | ((yy&0x0004)>>1),           \         ((yy&0x0780)>>5) | ((yy&0x0002)>>0),           \         ((yy&0x0078)>>1) | ((yy&0x0001)<<1),           \         res                                            \      );                                                \                                                        \      *ct++ = res;                                      \                                                        \   }while(--cols);                                      \}BUILD_MAPPER5(Map_15bit_RRRRGGGGBBBBRGBx_8,UINT8,GET_PEN_FOR_COLOUR_8)BUILD_MAPPER5(Map_15bit_RRRRGGGGBBBBRGBx_15,UINT16,GET_PEN_FOR_COLOUR_15)BUILD_MAPPER5(Map_15bit_RRRRGGGGBBBBRGBx_16,UINT16,GET_PEN_FOR_COLOUR_16)BUILD_MAPPER5(Map_15bit_RRRRGGGGBBBBRGBx_24,UINT32,GET_PEN_FOR_COLOUR_24)BUILD_MAPPER5(Map_15bit_RRRRGGGGBBBBRGBx_32,UINT32,GET_PEN_FOR_COLOUR_32)struct COLOUR_MAPPER col_Map_15bit_RRRRGGGGBBBBRGBx ={   "15bit_RRRRGGGGBBBBRGBx",   Map_15bit_RRRRGGGGBBBBRGBx_8,   Map_15bit_RRRRGGGGBBBBRGBx_15,   Map_15bit_RRRRGGGGBBBBRGBx_16,   Map_15bit_RRRRGGGGBBBBRGBx_24,   Map_15bit_RRRRGGGGBBBBRGBx_32,};void map_15bit_rrrr_rggg_ggbb_bbbx_rev_8(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT8 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_8(         (yy&0x7C00)>>9,         (yy&0x03E0)>>4,         (yy&0x001F)<<1,         res      );      *ct++ = res;   }while(--cols);}void map_15bit_rrrr_rggg_ggbb_bbbx_rev_15(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT16 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT16 *) coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_15(         (yy&0x7C00)>>9,         (yy&0x03E0)>>4,         (yy&0x001F)<<1,         res      );      *ct++ = res;   }while(--cols);}void map_15bit_rrrr_rggg_ggbb_bbbx_rev_16(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT16 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT16 *) coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_16(         (yy&0x7C00)>>9,         (yy&0x03E0)>>4,         (yy&0x001F)<<1,         res      );      *ct++ = res;   }while(--cols);}void map_15bit_rrrr_rggg_ggbb_bbbx_rev_24(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT32 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT32 *) coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_24(         (yy&0x7C00)>>9,         (yy&0x03E0)>>4,         (yy&0x001F)<<1,         res      );      *ct++ = res;   }while(--cols);}void map_15bit_rrrr_rggg_ggbb_bbbx_rev_32(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT32 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT32 *) coltab[bank];   do{      yy = (*ta--) >> 1;      GET_PEN_FOR_COLOUR_32(         (yy&0x7C00)>>9,         (yy&0x03E0)>>4,         (yy&0x001F)<<1,         res      );      *ct++ = res;   }while(--cols);}struct COLOUR_MAPPER col_map_rrrr_rggg_ggbb_bbbx_rev ={   "15bit rrrr rggg ggbb bbbx [reverse]",   map_15bit_rrrr_rggg_ggbb_bbbx_rev_8,   map_15bit_rrrr_rggg_ggbb_bbbx_rev_15,   map_15bit_rrrr_rggg_ggbb_bbbx_rev_16,   map_15bit_rrrr_rggg_ggbb_bbbx_rev_24,   map_15bit_rrrr_rggg_ggbb_bbbx_rev_32,};/******************************************************************************//* 12-bit xBGR (12-bit mapping) Reverse Colour Order (WestStory)              *//******************************************************************************/// Map_12bit_xBGR_Rev#define BUILD_MAPPER4(NAME, TYPE, PEN_FUNC)		\void NAME(UINT32 bank, UINT32 cols)	\{							\   UINT16 yy;						\   UINT16 *ta;						\   TYPE *ct,res;					\							\   bank_status[bank] = cols;				\   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);		\   ct = (TYPE *)coltab[bank];				\   do{							\      yy = (*ta--) & 0x0FFF;				\							\      PEN_FUNC(						\         (yy&0x000F)<<2,				\         (yy&0x00F0)>>2,				\         (yy&0x0F00)>>6,				\         res						\      );						\							\      *ct++ = res;					\							\   }while(--cols);					\}BUILD_MAPPER4(Map_12bit_xBGR_Rev_8,UINT8,GET_PEN_FOR_COLOUR_8)BUILD_MAPPER4(Map_12bit_xBGR_Rev_15,UINT16,GET_PEN_FOR_COLOUR_15)BUILD_MAPPER4(Map_12bit_xBGR_Rev_16,UINT16,GET_PEN_FOR_COLOUR_16)BUILD_MAPPER4(Map_12bit_xBGR_Rev_24,UINT32,GET_PEN_FOR_COLOUR_24)BUILD_MAPPER4(Map_12bit_xBGR_Rev_32,UINT32,GET_PEN_FOR_COLOUR_32)struct COLOUR_MAPPER col_map_xxxx_bbbb_gggg_rrrr_rev ={   "12bit xxxx bbbb gggg rrrr_rev",   Map_12bit_xBGR_Rev_8,   Map_12bit_xBGR_Rev_15,   Map_12bit_xBGR_Rev_16,   Map_12bit_xBGR_Rev_24,   Map_12bit_xBGR_Rev_32,};/******************************************************************************//* 12-bit xBGR (12-bit mapping) Reverse Colour Order 2BPP (Cabal FG0)         *//*                                                                            *//* Each bank in RAM has 4 colors (2 bitplanes per pixel). Each coltab[bank]   *//* has 16 colors and thus can store 4 RAM banks                               *//*                                                                            *//******************************************************************************/void Map_12bit_xBGR_Rev_2BPP(int bank, int cols){   UINT16 yy;   UINT16 *ta;   UINT8 *ct,res;   bank_status[bank>>2]|= 1<<(bank&3);   ta = (UINT16 *) (RAM_PAL+(bank<<3)+6);   ct = coltab[bank>>2]+((bank&3)<<2);   do{      yy = (*ta--) & 0x0FFF;      GET_PEN_FOR_COLOUR_8(         (yy&0x000F)<<2,         (yy&0x00F0)>>2,         (yy&0x0F00)>>6,         res      );      *ct++ = res;   }while(--cols);}/******************************************************************************//* 12-bit RGBx (12-bit mapping)                                               *//******************************************************************************/void map_12bit_rrrr_gggg_bbbb_xxxx_rev_8(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT8 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = coltab[bank];   do{      yy = ReadWord68k(ta--) >> 4;      GET_PEN_FOR_COLOUR_8(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}void map_12bit_rrrr_gggg_bbbb_xxxx_rev_15(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT16 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT16 *) coltab[bank];   do{      yy = ReadWord68k(ta--) >> 4;      GET_PEN_FOR_COLOUR_15(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}void map_12bit_rrrr_gggg_bbbb_xxxx_rev_16(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT16 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT16 *) coltab[bank];   do{      yy = ReadWord68k(ta--) >> 4;      GET_PEN_FOR_COLOUR_16(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}void map_12bit_rrrr_gggg_bbbb_xxxx_rev_24(UINT32 bank, UINT32 cols){   UINT16 yy;   UINT16 *ta;   UINT32 *ct,res;   bank_status[bank] = cols;   ta = (UINT16 *) (RAM_PAL+(bank<<5)+30);   ct = (UINT32 *) coltab[bank];   do{      yy = ReadWord68k(ta--) >> 4;      GET_PEN_FOR_COLOUR_24(         (yy&0x0F00)>>6,         (yy&0x00F0)>>2,         (yy&0x000F)<<2,         res      );      *ct++ = res;   }while(--cols);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -