/*****************************************************************************/ /* pcetil16.c */ /* PCE Tile BitPlane Decoder Module (16-color) */ /* (c) 2002 Dave Shadoff */ /*****************************************************************************/ #include "dm.h" void startup() { export.help = SystemHelp; } int tile_pack(unsigned char *dest,const unsigned char *src,int width,int height) { int i, j, pix; for(i = 0; i < 32; i++) { dest[i] = 0; } for(i = 0; i < 8; i++) { for(j = 0; j < 8; j++) { pix = (128 >> j); dest[0] |= (src[j] & 2) ? pix:0; dest[1] |= (src[j] & 1) ? pix:0; dest[16] |= (src[j] & 8) ? pix:0; dest[17] |= (src[j] & 4) ? pix:0; } dest += 2; src += 8; } return 32; } int tile_unpack(unsigned char *dest,const unsigned char *src,int width,int height) { int i, j, pix; for(i = 0; i < 8; i++) { for(j = 0; j < 8; j++) { pix = (128 >> j); dest[j] = ( ( (src[0] & pix) ? 2:0 ) | ( (src[1] & pix) ? 1:0 ) | ( (src[16] & pix) ? 8:0 ) | ( (src[17] & pix) ? 4:0 ) ); } src += 2; dest += 8; } return 32; } /* you must define an EXPORTSTRUC with 'export' in order to export data */ static EXPORTSTRUC export = { /*entry*/ startup, /*tile_pack*/ tile_pack, /*tile_unpack*/ tile_unpack, /*update*/ NULL, /*save*/ NULL, /*minwidth*/ 8, /*minheight*/ 8, /*maxwidth*/ 8, /*maxheight*/ 8, /*bpp*/ 4, /*maxpal*/ 2, /*modestr*/ "PCE TILE", /*help*/ NULL, /*key*/ { 0, 0, 0, 0 }, /*KeyHandler*/ { NULL, NULL, NULL, NULL } };