Problem with tiles

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
M-374 LX
Very interested
Posts: 60
Joined: Mon Aug 11, 2008 10:15 pm
Contact:

Problem with tiles

Post by M-374 LX » Tue Aug 19, 2008 6:48 pm

What can cause this problem with tiles?

Image

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.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Tue Aug 19, 2008 7:24 pm

Nobody can answer what is wrong if you do not explain what you do and what you try to get. More information - more chances for answer.

M-374 LX
Very interested
Posts: 60
Joined: Mon Aug 11, 2008 10:15 pm
Contact:

Post by M-374 LX » Tue Aug 19, 2008 7:36 pm

Shiru wrote:Nobody can answer what is wrong if you do not explain what you do and what you try to get. More information - more chances for answer.
Do you see the image?
There are some black parts where should be green.
And some green parts where should de yellow.

Christuserloeser
Very interested
Posts: 145
Joined: Sun Jan 28, 2007 2:01 am
Location: DCEvolution.net
Contact:

Post by Christuserloeser » Tue Aug 19, 2008 7:40 pm

I think he sees the image, but it is just ...well, an image. How on earth would anyone know what it is supposed to look like ?


- What are you working on btw ? (I am always curious about new homebrew :))
http://www.DCEvolution.net - Gigabytes of free Dreamcast software for you

Image

M-374 LX
Very interested
Posts: 60
Joined: Mon Aug 11, 2008 10:15 pm
Contact:

Post by M-374 LX » Tue Aug 19, 2008 7:46 pm

I think that the problem is with the positions of the tiles.
What are you working on btw ?
Nothing interesting.
I am just testing.

devzone
Interested
Posts: 18
Joined: Sun Jun 01, 2008 12:21 am
Contact:

Post by devzone » Wed Aug 20, 2008 1:20 am

Without explaining what it is that you are doing nobody will be able to answer what is wrong

Posting the source code that generates the tiles would help greatly

M-374 LX
Very interested
Posts: 60
Joined: Mon Aug 11, 2008 10:15 pm
Contact:

Post by M-374 LX » Wed Aug 20, 2008 4:17 pm

As I said, I think that the problem is with the positions.

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];
}

Edit: I posted a different image, which is easier to understand.

Post Reply