GernotFrisch
Member
- Joined
- Jan 2, 2007
- Messages
- 445
Hi,
I have this blitter code so far:
	
	
	
		
But, the desitnation rectangle seems offset by 1 byte. Am I missing something?
What's more: Can anyone tell me how to specify a transparent color in source?
				
			I have this blitter code so far:
		Code:
	
	void gp2x_blit(unsigned int hardware_ptr, int x, int y, int w, int h)
{
int x_from=31; int y_from=31;
	blitter32[0x4 >> 2] = (0x3381000 + (y*640) + (x<<1) ) & ~3; // dest ptr
	blitter32[0x0] = 1<<5  | ((x & 0x00000001) << 4); 			// Destination is 16 bpp
	blitter32[0x8 >> 2] = 640;									// Destination stride size in bytes
	//Set the source address
	// I'm missing something here??
	
	blitter32[0x0010 >> 2] = (hardware_ptr +(y_from*640)+(x_from<<1) )&~3;
	//Set the pitch of source in bytes
	blitter32[0x0014 >> 2] = 640;
	//Do nothing with pattern
	blitter32[0x0020 >> 2] = 0;
	// Set a 16bit source, enable source and say the source is not controlled by CPU(?)
	blitter32[0x000C >> 2] = (1 << 8) | (1 << 7) | (1 << 5);
	// Clear the source input FIFO, positive X,Y. And do a copy ROP.
	blitter32[0x0030 >> 2] = (1 << 10) | (1 << 9) | (1 << 8) | 0xCC;
	blitter32[0x2c >> 2] = (h << 16) | (w << 0);				// Height and width to blit
	// Wait for blitter to be free, start it, and then wait for completion.
	// Throw in some nop's so we don't saturate the address bus with polling requests.
	while (blitter32[0x0034 >> 2] & 1)
	{
		asm volatile ("nop");
		asm volatile ("nop");
		asm volatile ("nop");
		asm volatile ("nop");
	}
	blitter32[0x34 >> 2] = 1;
	gp2x_dummy_blit();
}What's more: Can anyone tell me how to specify a transparent color in source?
 
	
 
 
		 
 
		