Problem with tiles
Moderators: BigEvilCorporation, Mask of Destiny
Problem with tiles
What can cause this problem with tiles?
I think that the problem is with the positions of the tiles.
I think that the problem is with the positions of the tiles.
Last edited by M-374 LX on Thu Aug 21, 2008 10:10 pm, edited 2 times in total.
-
- Very interested
- Posts: 145
- Joined: Sun Jan 28, 2007 2:01 am
- Location: DCEvolution.net
- Contact:
As I said, I think that the problem is with the positions.
This is the full source:
Edit: I posted a different image, which is easier to understand.
This is the full source:
Code: Select all
#include "genesis.h"
void init_gfx();
void load_tiles();
void show_tiles();
void set_colors();
unsigned int Pal[128] = {
0x0000,0x00EE,0x0E0E,0x000E,0x0EE0,0x00E0,0x0E00,0x0888,
0x0CCC,0x0088,0x0808,0x0008,0x0880,0x0080,0x0800,0x0EEE,
};
unsigned long Tiles[32] = {
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0xDD5D5D55, 0x55D5DD5D, 0xD5DD55D5, 0x55555D5D, 0x55D5D555, 0xD55555D5, 0x5D5D5555, 0x5D55D55D,
0x55D51191, 0x5D5D1911, 0xD5551919, 0x5DD59119, 0x55559191, 0xD5DD1111, 0x5D5D9119, 0xD5551911,
0x91111911, 0x99111191, 0x11191191, 0x19919119, 0x91111111, 0x11191911, 0x99111111, 0x11191199,
} ;
unsigned short Map[48] = {1,1,1,1,2,3,3,3,3,1,1,1,1,1,2,3,3,3,3,3,3,
3,3,3,3,3,1,1,1,1,1,1,1,1,1,2,3,3,3,3,3,3,3,3,3,3,3,3};
void main()
{
init_gfx();
load_tiles();
set_colors();
show_tiles();
while (1)
{
asm("nop");
}
}
void init_gfx()
{
register uint *pw;
pw = (uint *) GFXCNTL;
*pw = 0x8016;
*pw = 0x8174;
*pw = 0x8230;
*pw = 0x8338;
*pw = 0x8407;
*pw = 0x857e;
*pw = 0x8600;
*pw = 0x8700;
*pw = 0x8801;
*pw = 0x8901;
*pw = 0x8a01;
*pw = 0x8b00;
*pw = 0x8c08;
*pw = 0x8d08;
*pw = 0x8f02;
*pw = 0x9000;
*pw = 0x9100;
*pw = 0x92ff;
}
void load_tiles()
{
register ulong *pl;
register uint i;
pl = (ulong *) GFXCNTL;
*pl = GFX_WRITE_ADDR(0);
pl = (ulong *) GFXDATA;
*pl=0;
for (i = 0; i < 8*4; i++)
*pl=Tiles[i];
}
void set_colors()
{
register ulong *pl;
register uint *pw;
uint i;
pl = (ulong *) GFXCNTL;
*pl = GFX_COLOR_WRITE_ADDR(0);
pw = (uint *) GFXDATA;
for (i=0; i<16; i++)
*pw=Pal[i];
}
void show_tiles()
{
register ulong *pl;
register uint *pw;
register uint i;
pl = (ulong *) GFXCNTL;
*pl = GFX_WRITE_ADDR(0xC000);
pw = (uint *) GFXDATA;
for (i = 0; i < 48; i++)
*pw = 0x8000 + Map[i];
}