newbie's questions
Moderator: BigEvilCorporation
newbie's questions
Hi guys. I want to program a rom for Sega Genesis/Mega Drive. I attempted BasiEgaXorz, but I think it is not enough (it lacks of comfortable way to use many files for one project).
I've downloaded enviroment from here: http://gens.consolemul.com/download/tem ... sDev04.zip I tried to install XGCC before, but I failed.
I managed to compile a simple hello-worldish app.
But how do I code tiles to display? Is there any simple way to do it? I've searched in include directory, but I don't have any idea what should I do with VDP_loadTileTo command (where should I take tile data from).
Or should I move to te XGCC? But I don't know how to install it.
Please help, I've searched, but failed to get helpful info.
ps. correct me if I'm wrong somewhere.
I've downloaded enviroment from here: http://gens.consolemul.com/download/tem ... sDev04.zip I tried to install XGCC before, but I failed.
I managed to compile a simple hello-worldish app.
But how do I code tiles to display? Is there any simple way to do it? I've searched in include directory, but I don't have any idea what should I do with VDP_loadTileTo command (where should I take tile data from).
Or should I move to te XGCC? But I don't know how to install it.
Please help, I've searched, but failed to get helpful info.
ps. correct me if I'm wrong somewhere.
-
- Very interested
- Posts: 208
- Joined: Mon Jun 25, 2007 7:19 pm
- Location: Besançon,France
- Contact:
hi,
if you wan read the french language , i have write a tutorial on my website for use Gendev:
here is the link:
http://sega4ever.power-heberg.com/artic ... g=fr&pg=17
if you wan read the french language , i have write a tutorial on my website for use Gendev:
here is the link:
http://sega4ever.power-heberg.com/artic ... g=fr&pg=17
-
- Very interested
- Posts: 208
- Joined: Mon Jun 25, 2007 7:19 pm
- Location: Besançon,France
- Contact:
here is the text fonction in Gendev , and "Hello World" the textJaklub wrote:Thank you for your help, but i've got another problem.
How can i change the palette to display from 0 to other ones? I tried to figure out, but i didn't find the answer.
VDP_drawText(APLAN,"Hello World", 0x0000, 10, 10);
-0x0000 : is the palette number 0
0x2000 for the number 1
0x4000 for the number 2
0x6000 for the number 3
for exemple if you want to write "hello world " in red with the palette number 2 , the right code is:
Code: Select all
#include "genesis.h"
int main()
{
VDP_init();
VDP_setPaletteColor(2, 15, 0x00F);
VDP_drawText(APLAN,"Hello World", 0x4000, 10, 10);
}
-
- Very interested
- Posts: 208
- Joined: Mon Jun 25, 2007 7:19 pm
- Location: Besançon,France
- Contact:
i explain everything of this in my tuto:Jaklub wrote:But what should I do to apply this to tiles and sprites? (change palette to draw, not one of palette colours, to be exact)
just read this:
http://sega4ever.power-heberg.com/artic ... g=fr&pg=36
-
- Very interested
- Posts: 208
- Joined: Mon Jun 25, 2007 7:19 pm
- Location: Besançon,France
- Contact:
with Genitile you can convert a picture in BMP format in two ASM file.
one for the tiles and the second for the pal.
look the exemple in my tuto i try with this picture :
i have converted with genitile so i have got 2 files in *.S
after you need to add these in the two files :
after this step for add the *.s files in your source code you must write this:
and for load the bitmap pal in the pal0 for exemple :
after this you must load the bitmap tiles in the genesis Vram , for exemple write this :
0 for start to add tiles in the beginning of the vram
76800 is the bytes in my picture in the files zelda_tiles :
and finally for display the picture use this :
0x0000 number pal
0 ( axe of X)
0 ( axe of Y)
320 is the height of the bitmap
248 is the width
so my complete code is :
and here is the result with kmods:
excuse me for my bad english
one for the tiles and the second for the pal.
look the exemple in my tuto i try with this picture :
i have converted with genitile so i have got 2 files in *.S
after you need to add these in the two files :
after this step for add the *.s files in your source code you must write this:
Code: Select all
extern u32 Zelda_tiles[];
extern u16 Zelda_pal[];
Code: Select all
VDP_setPalette(0, Zelda_pal);
Code: Select all
VDP_DoVRamDMA( (u32) Zelda_tiles, 0, 76800);
76800 is the bytes in my picture in the files zelda_tiles :
and finally for display the picture use this :
Code: Select all
VDP_fillTileRectInc(0xc000, 0x0000,0,0,320/8,248/8);
0 ( axe of X)
0 ( axe of Y)
320 is the height of the bitmap
248 is the width
so my complete code is :
Code: Select all
#include "genesis.h"
extern u32 Zelda_tiles[];
extern u16 Zelda_pal[];
int main()
{
VDP_init();
// Ecran Titre
VDP_setPalette(0, Zelda_pal);
VDP_DoVRamDMA( (u32) Zelda_tiles, 0, 76800);
VDP_fillTileRectInc(0xc000, 0x0000,0,0,320/8,248/8);
VDP_updateSprites();
}
excuse me for my bad english
That's nice you translated the tutorial.
but how do I change palette when using this function:
is it impossible?
anyway, thanks for help.
but how do I change palette when using this function:
Code: Select all
VDP_setTile(u16 plan, u16 tile, u16 x, u16 y);
anyway, thanks for help.
-
- Very interested
- Posts: 208
- Joined: Mon Jun 25, 2007 7:19 pm
- Location: Besançon,France
- Contact:
first convert your image BMP with genitile
and after you can choose the pallette :
with this:
VDP_setPalette(0, Zelda_pal);
for load the zelda palette in this palette number 0:
VDP_setPalette(1, Zelda_pal);
for load the zelda palette in this palette number 1:
please if you can read the french language , read this:
http://sega4ever.power-heberg.com/artic ... g=fr&pg=28
and after you can choose the pallette :
with this:
VDP_setPalette(0, Zelda_pal);
for load the zelda palette in this palette number 0:
VDP_setPalette(1, Zelda_pal);
for load the zelda palette in this palette number 1:
please if you can read the french language , read this:
http://sega4ever.power-heberg.com/artic ... g=fr&pg=28
I've got the tiles and palette in h files. Instead of VDP_fillTileRectInc command I use VDP_setTile (which at least I think I understand). But, the tiles display always in 0 palette and that's the problem - I want to display some tiles in palette 1 instead.
linked? I know a single displayed tile can't have more than 1 palette, but can you explain this?Every tile in tilemap (not in tileset) is linked to one of four palettes (defined by bits D14,D13).
I don't speak english well, so this may be wrong word. Single tile can have any of 4 palettes. The tile defined by single word (16-bit number), which contains the tile number itself, and some flags, including the palette number. As I can see from Stef's libs sourcecode, you can pass tile number with flags to VDP_setTile directly. Read 'Name Tables' section of this document.Jaklub wrote:linked? I know a single displayed tile can't have more than 1 palette, but can you explain this?
I've read the 'Name Tables' section (and priority one) and I wrote this.
I'm trying to draw a sprite 130 with palette 1, but even when I change it to "0xF0000130<<11" or remove "<<11" it's not working - tile is black. I tried "0xF010000000000130" and "0xF000000000000130" before (with and without "<<11"), but no effects.
I really have no idea what am I doing wrong, please help me. I think I understood "The pattern name is the upper 11 bits" wrong. ;p
Code: Select all
VDP_setTile(APLAN, 0xF0100130<<11, 3, 10);
I really have no idea what am I doing wrong, please help me. I think I understood "The pattern name is the upper 11 bits" wrong. ;p