NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectRe: Pixel Writing  
Posted byTimW
Posted on8/28/03 6:25 PM
From IP209.178.144.18  



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.

check it
struct {
dword *pIndex = &patterntabbyte1;
byte patterntabbyte1;
byte patterntabbyte2;
byte attrib;
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.



-
Entire Thread
Subject  Posted byPosted On
*Pixel Writing  Laughy8/19/03 03:38 AM
.*Re: Pixel Writing  Big Time8/19/03 06:18 AM
..*Re: Pixel Writing  Big Time9/6/03 7:00 PM
..*Re: Pixel Writing  Laughy8/29/03 00:11 AM
...*Re: Pixel Writing  Big Time8/29/03 00:41 AM
..*Re: Pixel Writing  Laughy8/19/03 06:58 AM
...*Re: Pixel Writing  TimW8/20/03 06:38 AM
.....Re: Pixel Writing  TimW8/28/03 6:25 PM
.....*Re: Pixel Writing  Big Time8/28/03 11:44 PM
......*Re: Pixel Writing  TimW8/30/03 06:04 AM
.......*Re: Pixel Writing  Big Time8/30/03 5:18 PM
........*Re: Pixel Writing  TimW8/31/03 11:31 AM
....*Re: Pixel Writing  Big Time8/20/03 2:33 PM
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo