void RenderTile4bit(unsigned long X,unsigned long Y,unsigned long &Address,unsigned long Palette[256],unsigned long PaletteIndex,unsigned long Flip){SrcPntr8=GetPointer8(Address);switch(Flip){case 0: LoopStart[2]=0;LoopEnd[2]=8;LoopStep[2]=1;LoopStart[3]=0;LoopEnd[3]=8;LoopStep[3]=1; break;case 1: LoopStart[2]=0;LoopEnd[2]=8;LoopStep[2]=1;LoopStart[3]=8;LoopEnd[3]=0;LoopStep[3]=0xFFFFFFFF;X--; break;case 2: LoopStart[2]=8;LoopEnd[2]=0;LoopStep[2]=0xFFFFFFFF;LoopStart[3]=0;LoopEnd[3]=8;LoopStep[3]=1;Y--; break;case 3: LoopStart[2]=8;LoopEnd[2]=0;LoopStep[2]=0xFFFFFFFF;LoopStart[3]=8;LoopEnd[3]=0;LoopStep[3]=0xFFFFFFFF;X--;Y--; break;default: break;};for(unsigned long y=LoopStart[2];y!=LoopEnd[2];y+=LoopStep[2]){for(unsigned long x=LoopStart[3];x!=LoopEnd[3];x+=LoopStep[3]){PositionX=X+x;PositionY=Y+y;if(x%2==0){if((*SrcPntr8&0x0F)!=0){WritePixel(PositionX,PositionY,Palette[(*SrcPntr8&0x0F)+PaletteIndex]);}}else{if((*SrcPntr8>>4)!=0){WritePixel(PositionX,PositionY,Palette[(*SrcPntr8>>4)+PaletteIndex]);}SrcPntr8++;}}}return;}void RenderTile8bit(unsigned long X,unsigned long Y,unsigned long &Address,unsigned long Palette[256],unsigned long Flip){SrcPntr8=GetPointer8(Address);switch(Flip){case 0: LoopStart[2]=0;LoopEnd[2]=8;LoopStep[2]=1;LoopStart[3]=0;LoopEnd[3]=8;LoopStep[3]=1; break;case 1: LoopStart[2]=0;LoopEnd[2]=8;LoopStep[2]=1;LoopStart[3]=8;LoopEnd[3]=0;LoopStep[3]=0xFFFFFFFF;X--; break;case 2: LoopStart[2]=8;LoopEnd[2]=0;LoopStep[2]=0xFFFFFFFF;LoopStart[3]=0;LoopEnd[3]=8;LoopStep[3]=1;Y--; break;case 3: LoopStart[2]=8;LoopEnd[2]=0;LoopStep[2]=0xFFFFFFFF;LoopStart[3]=8;LoopEnd[3]=0;LoopStep[3]=0xFFFFFFFF;X--;Y--; break;default: break;};for(unsigned long y=LoopStart[2];y!=LoopEnd[2];y+=LoopStep[2]){for(unsigned long x=LoopStart[3];x!=LoopEnd[3];x+=LoopStep[3]){PositionX=X+x;PositionY=Y+y;if(*SrcPntr8!=0){WritePixel(PositionX,PositionY,Palette[*SrcPntr8]); }SrcPntr8++;}}return;}
this is what's called better algorithm deisgn:
#define WritePixel(x,y,p) if(p!=0 && (unsigned)x<=255 && (unsigned)y<=255){ScreenMemory[y][x]=Palette.Colour;}void RenderTile(long X,long Y,unsigned char *Src,PaletteEntry *Palette,unsigned short Flip,bool Colours){for(long i=0;i<0x40;i++){if(bool(Flip&0x0001)){PositionX=(7-(i%8))+X;}else{PositionX=(i%8)+X;}if(bool(Flip&0x0002)){PositionY=(7-(i/8))+Y;}else{PositionY=(i/8)+Y;}if(!Colours){if(i%2==0){WritePixel(PositionX,PositionY,(*Src&0x0F));}else{WritePixel(PositionX,PositionY,(*Src>>4));Src++;}}else{WritePixel(PositionX,PositionY,*Src);Src++;}}return;}
So I can now display the sprites and maps that where to the left of screen(negative) which has fixed a huge number of graphics problems.
Also after messing with LDR opcode I was ABLE TO RUN A GBA DEMO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(add a million more !'s)!
HOORAY!!!! REAL PROGRESS!
hmmm I can't find the demo online, it was a plasma demo from gbadev.org. Anyway it runs really slow but at least it works [smile]
I'll keep downloading demos and seeing if I can get them working.
Edit: Also don't froget that Epson is run by Satan and Jebus commands you to boycott them.>
TABS FFS