I've been thinking about this. why not use a lookup table?? tell me what you think of this.
you got 8 pixels per line of a tile, you have "two" bytes of pattern table data. and two bits of attribute data.
so there are only 256*256*4 permiutations of this. you could store every possible combination of bitmapped data in an array of about 3 to 4 meg. you whould have to make the array linear, ie one dimension to avoid the overhead of multiplication.
dword *pIndex = &patterntabbyte1;
byte bpadding = 0;
when it comes time to draw the tile,
fill in the fields
Byte *p = lookup[*pIndex];
now p, points to an array of 8 bytes which is the converted bitmapped data.
now you got the 8 bytes(the palette entries) with only 3 assignments, and attribute byte fetch, which could be implimented as a lookup aswell.